| OLD | NEW |
| 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. It has a | 9 // BrowserPluginGuest lives on the UI thread of the browser process. It has a |
| 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The | 10 // helper, BrowserPluginGuestHelper, which is a RenderViewHostObserver. The |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 int error_code, | 148 int error_code, |
| 149 const string16& error_description, | 149 const string16& error_description, |
| 150 RenderViewHost* render_view_host) OVERRIDE; | 150 RenderViewHost* render_view_host) OVERRIDE; |
| 151 virtual void DidCommitProvisionalLoadForFrame( | 151 virtual void DidCommitProvisionalLoadForFrame( |
| 152 int64 frame_id, | 152 int64 frame_id, |
| 153 bool is_main_frame, | 153 bool is_main_frame, |
| 154 const GURL& url, | 154 const GURL& url, |
| 155 PageTransition transition_type, | 155 PageTransition transition_type, |
| 156 RenderViewHost* render_view_host) OVERRIDE; | 156 RenderViewHost* render_view_host) OVERRIDE; |
| 157 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; | 157 virtual void DidStopLoading(RenderViewHost* render_view_host) OVERRIDE; |
| 158 | 158 virtual void DidUpdateFrameName(int frame_id, |
| 159 bool is_top_level, |
| 160 const std::string& name, |
| 161 RenderViewHost* render_view_host) OVERRIDE; |
| 159 virtual void RenderViewReady() OVERRIDE; | 162 virtual void RenderViewReady() OVERRIDE; |
| 160 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; | 163 virtual void RenderViewGone(base::TerminationStatus status) OVERRIDE; |
| 161 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 164 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 162 | 165 |
| 163 | 166 |
| 164 // WebContentsDelegate implementation. | 167 // WebContentsDelegate implementation. |
| 165 | 168 |
| 166 // If a new window is created with target="_blank" and rel="noreferrer", then | 169 // If a new window is created with target="_blank" and rel="noreferrer", then |
| 167 // this method is called, indicating that the new WebContents is ready to be | 170 // this method is called, indicating that the new WebContents is ready to be |
| 168 // attached. | 171 // attached. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 void OnSetCursor(const WebCursor& cursor); | 373 void OnSetCursor(const WebCursor& cursor); |
| 371 // On MacOSX popups are painted by the browser process. We handle them here | 374 // On MacOSX popups are painted by the browser process. We handle them here |
| 372 // so that they are positioned correctly. | 375 // so that they are positioned correctly. |
| 373 #if defined(OS_MACOSX) | 376 #if defined(OS_MACOSX) |
| 374 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); | 377 void OnShowPopup(const ViewHostMsg_ShowPopup_Params& params); |
| 375 #endif | 378 #endif |
| 376 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); | 379 void OnShowWidget(int route_id, const gfx::Rect& initial_pos); |
| 377 // Overriden in tests. | 380 // Overriden in tests. |
| 378 virtual void OnTakeFocus(bool reverse); | 381 virtual void OnTakeFocus(bool reverse); |
| 379 void OnUpdateDragCursor(WebKit::WebDragOperation operation); | 382 void OnUpdateDragCursor(WebKit::WebDragOperation operation); |
| 380 void OnUpdateFrameName(int frame_id, | |
| 381 bool is_top_level, | |
| 382 const std::string& name); | |
| 383 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); | 383 void OnUpdateRect(const ViewHostMsg_UpdateRect_Params& params); |
| 384 | 384 |
| 385 // Helpers for |OnRespondPermission|. | 385 // Helpers for |OnRespondPermission|. |
| 386 void OnRespondPermissionDownload(int request_id, bool should_allow); | 386 void OnRespondPermissionDownload(int request_id, bool should_allow); |
| 387 void OnRespondPermissionGeolocation(int request_id, bool should_allow); | 387 void OnRespondPermissionGeolocation(int request_id, bool should_allow); |
| 388 void OnRespondPermissionMedia(int request_id, bool should_allow); | 388 void OnRespondPermissionMedia(int request_id, bool should_allow); |
| 389 void OnRespondPermissionNewWindow(int request_id, bool should_allow); | 389 void OnRespondPermissionNewWindow(int request_id, bool should_allow); |
| 390 | 390 |
| 391 // Requests download permission through embedder JavaScript API after | 391 // Requests download permission through embedder JavaScript API after |
| 392 // retrieving url information from IO thread. | 392 // retrieving url information from IO thread. |
| (...skipping 28 matching lines...) Expand all Loading... |
| 421 gfx::Size damage_view_size_; | 421 gfx::Size damage_view_size_; |
| 422 float damage_buffer_scale_factor_; | 422 float damage_buffer_scale_factor_; |
| 423 gfx::Rect guest_window_rect_; | 423 gfx::Rect guest_window_rect_; |
| 424 gfx::Rect guest_screen_rect_; | 424 gfx::Rect guest_screen_rect_; |
| 425 base::TimeDelta guest_hang_timeout_; | 425 base::TimeDelta guest_hang_timeout_; |
| 426 bool focused_; | 426 bool focused_; |
| 427 bool mouse_locked_; | 427 bool mouse_locked_; |
| 428 bool pending_lock_request_; | 428 bool pending_lock_request_; |
| 429 bool guest_visible_; | 429 bool guest_visible_; |
| 430 bool embedder_visible_; | 430 bool embedder_visible_; |
| 431 std::string name_; | |
| 432 bool auto_size_enabled_; | 431 bool auto_size_enabled_; |
| 433 gfx::Size max_auto_size_; | 432 gfx::Size max_auto_size_; |
| 434 gfx::Size min_auto_size_; | 433 gfx::Size min_auto_size_; |
| 435 | 434 |
| 436 typedef std::map<BrowserPluginGuest*, std::string> PendingWindowMap; | 435 typedef std::map<BrowserPluginGuest*, std::string> PendingWindowMap; |
| 437 PendingWindowMap pending_new_windows_; | 436 PendingWindowMap pending_new_windows_; |
| 438 BrowserPluginGuest* opener_; | 437 BrowserPluginGuest* opener_; |
| 439 // A counter to generate a unique request id for a permission request. | 438 // A counter to generate a unique request id for a permission request. |
| 440 // We only need the ids to be unique for a given BrowserPluginGuest. | 439 // We only need the ids to be unique for a given BrowserPluginGuest. |
| 441 int next_permission_request_id_; | 440 int next_permission_request_id_; |
| 442 // A map to store WebContents's media request object and callback. | 441 // A map to store WebContents's media request object and callback. |
| 443 // We need to store these because we need a roundtrip to the embedder to know | 442 // We need to store these because we need a roundtrip to the embedder to know |
| 444 // if we allow or disallow the request. The key of the map is unique only for | 443 // if we allow or disallow the request. The key of the map is unique only for |
| 445 // a given BrowserPluginGuest. | 444 // a given BrowserPluginGuest. |
| 446 MediaStreamRequestsMap media_requests_map_; | 445 MediaStreamRequestsMap media_requests_map_; |
| 447 // A map from request ID to instance ID for use by the New Window API. | 446 // A map from request ID to instance ID for use by the New Window API. |
| 448 typedef std::map<int, int> NewWindowRequestMap; | 447 typedef std::map<int, int> NewWindowRequestMap; |
| 449 NewWindowRequestMap new_window_request_map_; | 448 NewWindowRequestMap new_window_request_map_; |
| 450 | 449 |
| 451 typedef std::map<int, base::Callback<void(bool)> > DownloadRequestMap; | 450 typedef std::map<int, base::Callback<void(bool)> > DownloadRequestMap; |
| 452 DownloadRequestMap download_request_callback_map_; | 451 DownloadRequestMap download_request_callback_map_; |
| 453 | 452 |
| 454 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); | 453 DISALLOW_COPY_AND_ASSIGN(BrowserPluginGuest); |
| 455 }; | 454 }; |
| 456 | 455 |
| 457 } // namespace content | 456 } // namespace content |
| 458 | 457 |
| 459 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ | 458 #endif // CONTENT_BROWSER_BROWSER_PLUGIN_BROWSER_PLUGIN_GUEST_H_ |
| OLD | NEW |