Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Side by Side Diff: content/browser/browser_plugin/browser_plugin_embedder.h

Issue 1970313002: Audio notification plumbed from guest WebContents up to embedder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's 5 // A BrowserPluginEmbedder handles messages coming from a BrowserPlugin's
6 // embedder that are not directed at any particular existing guest process. 6 // embedder that are not directed at any particular existing guest process.
7 // In the beginning, when a BrowserPlugin instance in the embedder renderer 7 // In the beginning, when a BrowserPlugin instance in the embedder renderer
8 // process requests an initial navigation, the WebContents for that renderer 8 // process requests an initial navigation, the WebContents for that renderer
9 // renderer creates a BrowserPluginEmbedder for itself. The 9 // renderer creates a BrowserPluginEmbedder for itself. The
10 // BrowserPluginEmbedder, in turn, forwards the requests to a 10 // BrowserPluginEmbedder, in turn, forwards the requests to a
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 bool Find(int request_id, 76 bool Find(int request_id,
77 const base::string16& search_text, 77 const base::string16& search_text,
78 const blink::WebFindOptions& options); 78 const blink::WebFindOptions& options);
79 bool StopFinding(StopFindAction action); 79 bool StopFinding(StopFindAction action);
80 80
81 // Returns the "full page" guest if there is one. That is, if there is a 81 // Returns the "full page" guest if there is one. That is, if there is a
82 // single BrowserPlugin in the embedder which takes up the full page, then it 82 // single BrowserPlugin in the embedder which takes up the full page, then it
83 // is returned. 83 // is returned.
84 BrowserPluginGuest* GetFullPageGuest(); 84 BrowserPluginGuest* GetFullPageGuest();
85 85
86 // Polls all guests for this web contents and returns true if any of them
87 // were audible recently.
88 bool WereAnyGuestsRecentlyAudible();
89
86 private: 90 private:
87 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents); 91 explicit BrowserPluginEmbedder(WebContentsImpl* web_contents);
88 92
89 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const; 93 BrowserPluginGuestManager* GetBrowserPluginGuestManager() const;
90 94
91 void ClearGuestDragStateIfApplicable(); 95 void ClearGuestDragStateIfApplicable();
92 96
93 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents); 97 static bool DidSendScreenRectsCallback(WebContents* guest_web_contents);
94 98
95 // Notifies a guest that the embedder's screen info has changed. 99 // Notifies a guest that the embedder's screen info has changed.
96 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents); 100 static bool NotifyScreenInfoChanged(WebContents* guest_web_contents);
97 101
98 // Closes modal dialogs in |guest_web_contents|. 102 // Closes modal dialogs in |guest_web_contents|.
99 static bool CancelDialogs(WebContents* guest_web_contents); 103 static bool CancelDialogs(WebContents* guest_web_contents);
100 104
101 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked, 105 static bool UnlockMouseIfNecessaryCallback(bool* mouse_unlocked,
102 WebContents* guest); 106 WebContents* guest);
103 107
104 static bool FindInGuest(int request_id, 108 static bool FindInGuest(int request_id,
105 const base::string16& search_text, 109 const base::string16& search_text,
106 const blink::WebFindOptions& options, 110 const blink::WebFindOptions& options,
107 WebContents* guest); 111 WebContents* guest);
108 static bool StopFindingInGuest(StopFindAction action, WebContents* guest); 112 static bool StopFindingInGuest(StopFindAction action, WebContents* guest);
109 113
114 static bool GuestRecentlyAudibleCallback(WebContents* guest);
115
110 // Message handlers. 116 // Message handlers.
111 117
112 void OnAttach(RenderFrameHost* render_frame_host, 118 void OnAttach(RenderFrameHost* render_frame_host,
113 int instance_id, 119 int instance_id,
114 const BrowserPluginHostMsg_Attach_Params& params); 120 const BrowserPluginHostMsg_Attach_Params& params);
115 void OnUpdateDragCursor(bool* handled); 121 void OnUpdateDragCursor(bool* handled);
116 122
117 // Used to correctly update the cursor when dragging over a guest, and to 123 // Used to correctly update the cursor when dragging over a guest, and to
118 // handle a race condition when dropping onto the guest that started the drag 124 // handle a race condition when dropping onto the guest that started the drag
119 // (the race is that the dragend message arrives before the drop message so 125 // (the race is that the dragend message arrives before the drop message so
120 // the drop never takes place). 126 // the drop never takes place).
121 // crbug.com/233571 127 // crbug.com/233571
122 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_; 128 base::WeakPtr<BrowserPluginGuest> guest_dragging_over_;
123 129
124 // Pointer to the guest that started the drag, used to forward necessary drag 130 // Pointer to the guest that started the drag, used to forward necessary drag
125 // status messages to the correct guest. 131 // status messages to the correct guest.
126 base::WeakPtr<BrowserPluginGuest> guest_started_drag_; 132 base::WeakPtr<BrowserPluginGuest> guest_started_drag_;
127 133
128 // Keeps track of "dragend" state. 134 // Keeps track of "dragend" state.
129 bool guest_drag_ending_; 135 bool guest_drag_ending_;
130 136
131 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_; 137 base::WeakPtrFactory<BrowserPluginEmbedder> weak_ptr_factory_;
132 138
133 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder); 139 DISALLOW_COPY_AND_ASSIGN(BrowserPluginEmbedder);
134 }; 140 };
135 141
136 } // namespace content 142 } // namespace content
137 143
138 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_ 144 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_EMBEDDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698