File: presentation_receiver_window_view.h

package info (click to toggle)
chromium 138.0.7204.183-1~deb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm-proposed-updates
  • size: 6,080,960 kB
  • sloc: cpp: 34,937,079; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,954; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,811; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (137 lines) | stat: -rw-r--r-- 5,495 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
// Copyright 2017 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_UI_VIEWS_MEDIA_ROUTER_PRESENTATION_RECEIVER_WINDOW_VIEW_H_
#define CHROME_BROWSER_UI_VIEWS_MEDIA_ROUTER_PRESENTATION_RECEIVER_WINDOW_VIEW_H_

#include <memory>
#include <string>

#include "base/memory/raw_ptr.h"
#include "build/build_config.h"
#include "chrome/browser/command_updater_delegate.h"
#include "chrome/browser/command_updater_impl.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/media_router/presentation_receiver_window.h"
#include "chrome/browser/ui/toolbar/chrome_location_bar_model_delegate.h"
#include "chrome/browser/ui/views/exclusive_access_bubble_views_context.h"
#include "chrome/browser/ui/views/location_bar/location_bar_view.h"
#include "ui/base/metadata/metadata_header_macros.h"
#include "ui/views/widget/widget_delegate.h"

class ExclusiveAccessBubbleViews;
class PresentationReceiverWindowDelegate;
class PresentationReceiverWindowFrame;
class LocationBarModelImpl;

#if BUILDFLAG(IS_CHROMEOS)
class FullscreenWindowObserver;
#endif

// This class implements the View portion of PresentationReceiverWindow.  It
// contains a WebView for displaying the receiver page and a LocationBarView for
// displaying the URL.
class PresentationReceiverWindowView final
    : public PresentationReceiverWindow,
      public views::WidgetDelegateView,
      public LocationBarView::Delegate,
      public CommandUpdaterDelegate,
      public ChromeLocationBarModelDelegate,
      public ExclusiveAccessContext,
      public ExclusiveAccessBubbleViewsContext,
      public ui::AcceleratorProvider {
  METADATA_HEADER(PresentationReceiverWindowView, views::WidgetDelegateView)

 public:
  PresentationReceiverWindowView(PresentationReceiverWindowFrame* frame,
                                 PresentationReceiverWindowDelegate* delegate);
  PresentationReceiverWindowView(const PresentationReceiverWindowView&) =
      delete;
  PresentationReceiverWindowView& operator=(
      const PresentationReceiverWindowView&) = delete;
  ~PresentationReceiverWindowView() final;

  void Init();

  LocationBarView* location_bar_view() { return location_bar_view_; }

  // PresentationReceiverWindow overrides.
  void Close() final;
  bool IsWindowActive() const final;
  bool IsWindowFullscreen() const final;
  gfx::Rect GetWindowBounds() const final;
  void ShowInactiveFullscreen() final;
  void UpdateWindowTitle() final;
  void UpdateLocationBar() final;

  // LocationBarView::Delegate overrides.
  content::WebContents* GetWebContents() final;
  LocationBarModel* GetLocationBarModel() final;
  const LocationBarModel* GetLocationBarModel() const final;
  ContentSettingBubbleModelDelegate* GetContentSettingBubbleModelDelegate()
      final;

  // CommandUpdaterDelegate overrides.
  void ExecuteCommandWithDisposition(int id,
                                     WindowOpenDisposition disposition) final;

  // ChromeLocationBarModelDelegate overrides.
  content::WebContents* GetActiveWebContents() const final;

  // views::WidgetDelegateView overrides.
  std::u16string GetWindowTitle() const final;

  // ui::AcceleratorTarget overrides.
  bool AcceleratorPressed(const ui::Accelerator& accelerator) final;

  // ExclusiveAccessContext overrides.
  Profile* GetProfile() final;
  bool IsFullscreen() const final;
  void EnterFullscreen(const url::Origin& origin,
                       ExclusiveAccessBubbleType bubble_type,
                       const int64_t display_id) final;
  void ExitFullscreen() final;
  void UpdateExclusiveAccessBubble(
      const ExclusiveAccessBubbleParams& params,
      ExclusiveAccessBubbleHideCallback first_hide_callback) override;
  bool IsExclusiveAccessBubbleDisplayed() const final;
  void OnExclusiveAccessUserInput() final;
  content::WebContents* GetWebContentsForExclusiveAccess() final;
  bool CanUserEnterFullscreen() const final;
  bool CanUserExitFullscreen() const final;

  // ExclusiveAccessBubbleViewsContext overrides.
  ExclusiveAccessManager* GetExclusiveAccessManager() final;
  ui::AcceleratorProvider* GetAcceleratorProvider() final;
  gfx::NativeView GetBubbleParentView() const final;
  gfx::Rect GetClientAreaBoundsInScreen() const final;
  bool IsImmersiveModeEnabled() const final;
  gfx::Rect GetTopContainerBoundsInScreen() final;
  void DestroyAnyExclusiveAccessBubble() final;

  // ui::AcceleratorProvider overrides.
  bool GetAcceleratorForCommandId(int command_id,
                                  ui::Accelerator* accelerator) const final;

 private:
  // Updates the UI in response to a change to fullscreen state.
  void OnFullscreenChanged();

  const raw_ptr<PresentationReceiverWindowFrame> frame_;
  const raw_ptr<PresentationReceiverWindowDelegate> delegate_;
  std::u16string title_;
  const std::unique_ptr<LocationBarModelImpl> location_bar_model_;
  CommandUpdaterImpl command_updater_;
  raw_ptr<LocationBarView> location_bar_view_ = nullptr;
  ExclusiveAccessManager exclusive_access_manager_;
  ui::Accelerator fullscreen_accelerator_;
  std::unique_ptr<ExclusiveAccessBubbleViews> exclusive_access_bubble_;

#if BUILDFLAG(IS_CHROMEOS)
  std::unique_ptr<FullscreenWindowObserver> window_observer_;
#endif
};

#endif  // CHROME_BROWSER_UI_VIEWS_MEDIA_ROUTER_PRESENTATION_RECEIVER_WINDOW_VIEW_H_