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

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

Issue 239143007: <webview>: Move JavaScript Dialog API to chrome (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_pointer_lock_to_chrome
Patch Set: Addressed nits Created 6 years, 8 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
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 BrowserPluginGuest is the browser side of a browser <--> embedder 5 // A BrowserPluginGuest is the browser side of a browser <--> embedder
6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder 6 // renderer channel. A BrowserPlugin (a WebPlugin) is on the embedder
7 // renderer side of browser <--> embedder renderer communication. 7 // renderer side of browser <--> embedder renderer communication.
8 // 8 //
9 // BrowserPluginGuest lives on the UI thread of the browser process. Any 9 // BrowserPluginGuest lives on the UI thread of the browser process. Any
10 // messages about the guest render process that the embedder might be interested 10 // messages about the guest render process that the embedder might be interested
(...skipping 11 matching lines...) Expand all
22 #include <queue> 22 #include <queue>
23 23
24 #include "base/compiler_specific.h" 24 #include "base/compiler_specific.h"
25 #include "base/id_map.h" 25 #include "base/id_map.h"
26 #include "base/memory/shared_memory.h" 26 #include "base/memory/shared_memory.h"
27 #include "base/memory/weak_ptr.h" 27 #include "base/memory/weak_ptr.h"
28 #include "base/values.h" 28 #include "base/values.h"
29 #include "content/common/edit_command.h" 29 #include "content/common/edit_command.h"
30 #include "content/port/common/input_event_ack_state.h" 30 #include "content/port/common/input_event_ack_state.h"
31 #include "content/public/browser/browser_plugin_guest_delegate.h" 31 #include "content/public/browser/browser_plugin_guest_delegate.h"
32 #include "content/public/browser/javascript_dialog_manager.h"
33 #include "content/public/browser/web_contents_delegate.h" 32 #include "content/public/browser/web_contents_delegate.h"
34 #include "content/public/browser/web_contents_observer.h" 33 #include "content/public/browser/web_contents_observer.h"
35 #include "content/public/common/browser_plugin_permission_type.h" 34 #include "content/public/common/browser_plugin_permission_type.h"
36 #include "third_party/WebKit/public/web/WebCompositionUnderline.h" 35 #include "third_party/WebKit/public/web/WebCompositionUnderline.h"
37 #include "third_party/WebKit/public/web/WebDragOperation.h" 36 #include "third_party/WebKit/public/web/WebDragOperation.h"
38 #include "third_party/WebKit/public/web/WebDragStatus.h" 37 #include "third_party/WebKit/public/web/WebDragStatus.h"
39 #include "third_party/WebKit/public/web/WebInputEvent.h" 38 #include "third_party/WebKit/public/web/WebInputEvent.h"
40 #include "ui/base/ime/text_input_mode.h" 39 #include "ui/base/ime/text_input_mode.h"
41 #include "ui/base/ime/text_input_type.h" 40 #include "ui/base/ime/text_input_type.h"
42 #include "ui/gfx/rect.h" 41 #include "ui/gfx/rect.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 // the guest role and implements guest-specific overrides for ViewHostMsg_* 85 // the guest role and implements guest-specific overrides for ViewHostMsg_*
87 // messages. 86 // messages.
88 // 87 //
89 // When a guest is initially created, it is in an unattached state. That is, 88 // When a guest is initially created, it is in an unattached state. That is,
90 // it is not visible anywhere and has no embedder WebContents assigned. 89 // it is not visible anywhere and has no embedder WebContents assigned.
91 // A BrowserPluginGuest is said to be "attached" if it has an embedder. 90 // A BrowserPluginGuest is said to be "attached" if it has an embedder.
92 // A BrowserPluginGuest can also create a new unattached guest via 91 // A BrowserPluginGuest can also create a new unattached guest via
93 // CreateNewWindow. The newly created guest will live in the same partition, 92 // CreateNewWindow. The newly created guest will live in the same partition,
94 // which means it can share storage and can script this guest. 93 // which means it can share storage and can script this guest.
95 class CONTENT_EXPORT BrowserPluginGuest 94 class CONTENT_EXPORT BrowserPluginGuest
96 : public JavaScriptDialogManager, 95 : public WebContentsDelegate,
97 public WebContentsDelegate,
98 public WebContentsObserver { 96 public WebContentsObserver {
99 public: 97 public:
100 virtual ~BrowserPluginGuest(); 98 virtual ~BrowserPluginGuest();
101 99
102 // The WebContents passed into the factory method here has not been 100 // The WebContents passed into the factory method here has not been
103 // initialized yet and so it does not yet hold a SiteInstance. 101 // initialized yet and so it does not yet hold a SiteInstance.
104 // BrowserPluginGuest must be constructed and installed into a WebContents 102 // BrowserPluginGuest must be constructed and installed into a WebContents
105 // prior to its initialization because WebContents needs to determine what 103 // prior to its initialization because WebContents needs to determine what
106 // type of WebContentsView to construct on initialization. The content 104 // type of WebContentsView to construct on initialization. The content
107 // embedder needs to be aware of |guest_site_instance| on the guest's 105 // embedder needs to be aware of |guest_site_instance| on the guest's
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 const FileChooserParams& params) OVERRIDE; 228 const FileChooserParams& params) OVERRIDE;
231 virtual bool ShouldFocusPageAfterCrash() OVERRIDE; 229 virtual bool ShouldFocusPageAfterCrash() OVERRIDE;
232 virtual void RequestMediaAccessPermission( 230 virtual void RequestMediaAccessPermission(
233 WebContents* web_contents, 231 WebContents* web_contents,
234 const MediaStreamRequest& request, 232 const MediaStreamRequest& request,
235 const MediaResponseCallback& callback) OVERRIDE; 233 const MediaResponseCallback& callback) OVERRIDE;
236 virtual bool PreHandleGestureEvent( 234 virtual bool PreHandleGestureEvent(
237 content::WebContents* source, 235 content::WebContents* source,
238 const blink::WebGestureEvent& event) OVERRIDE; 236 const blink::WebGestureEvent& event) OVERRIDE;
239 237
240 // JavaScriptDialogManager implementation.
241 virtual void RunJavaScriptDialog(
242 WebContents* web_contents,
243 const GURL& origin_url,
244 const std::string& accept_lang,
245 JavaScriptMessageType javascript_message_type,
246 const base::string16& message_text,
247 const base::string16& default_prompt_text,
248 const DialogClosedCallback& callback,
249 bool* did_suppress_message) OVERRIDE;
250 virtual void RunBeforeUnloadDialog(
251 WebContents* web_contents,
252 const base::string16& message_text,
253 bool is_reload,
254 const DialogClosedCallback& callback) OVERRIDE;
255 virtual bool HandleJavaScriptDialog(
256 WebContents* web_contents,
257 bool accept,
258 const base::string16* prompt_override) OVERRIDE;
259 virtual void CancelActiveAndPendingDialogs(
260 WebContents* web_contents) OVERRIDE;
261 virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
262
263 // Exposes the protected web_contents() from WebContentsObserver. 238 // Exposes the protected web_contents() from WebContentsObserver.
264 WebContentsImpl* GetWebContents(); 239 WebContentsImpl* GetWebContents();
265 240
266 // Overridden in tests. 241 // Overridden in tests.
267 virtual void SetDamageBuffer( 242 virtual void SetDamageBuffer(
268 const BrowserPluginHostMsg_ResizeGuest_Params& params); 243 const BrowserPluginHostMsg_ResizeGuest_Params& params);
269 244
270 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const; 245 gfx::Point GetScreenCoordinates(const gfx::Point& relative_position) const;
271 246
272 // Helper to send messages to embedder. This methods fills the message with 247 // Helper to send messages to embedder. This methods fills the message with
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 289
315 void SetZoom(double zoom_factor); 290 void SetZoom(double zoom_factor);
316 291
317 void PointerLockPermissionResponse(bool allow); 292 void PointerLockPermissionResponse(bool allow);
318 293
319 private: 294 private:
320 class EmbedderWebContentsObserver; 295 class EmbedderWebContentsObserver;
321 friend class TestBrowserPluginGuest; 296 friend class TestBrowserPluginGuest;
322 297
323 class DownloadRequest; 298 class DownloadRequest;
324 class JavaScriptDialogRequest;
325 class NewWindowRequest; 299 class NewWindowRequest;
326 class PermissionRequest; 300 class PermissionRequest;
327 301
328 // Tracks the name, and target URL of the new window and whether or not it has 302 // Tracks the name, and target URL of the new window and whether or not it has
329 // changed since the WebContents has been created and before the new window 303 // changed since the WebContents has been created and before the new window
330 // has been attached to a BrowserPlugin. Once the first navigation commits, we 304 // has been attached to a BrowserPlugin. Once the first navigation commits, we
331 // no longer track this information. 305 // no longer track this information.
332 struct NewWindowInfo { 306 struct NewWindowInfo {
333 bool changed; 307 bool changed;
334 GURL url; 308 GURL url;
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 // Weak pointer used to ask GeolocationPermissionContext about geolocation 566 // Weak pointer used to ask GeolocationPermissionContext about geolocation
593 // permission. 567 // permission.
594 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_; 568 base::WeakPtrFactory<BrowserPluginGuest> weak_ptr_factory_;
595 569
596 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); 570 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest);
597 }; 571 };
598 572
599 } // namespace content 573 } // namespace content
600 574
601 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ 575 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_
OLDNEW
« no previous file with comments | « chrome/chrome_browser.gypi ('k') | content/browser/browser_plugin/browser_plugin_guest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698