Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 56 static int GetViewInstanceId(content::WebContents* contents); | 56 static int GetViewInstanceId(content::WebContents* contents); |
| 57 static const char Type[]; | 57 static const char Type[]; |
| 58 | 58 |
| 59 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; | 59 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; |
| 60 // Shows the context menu for the guest. | 60 // Shows the context menu for the guest. |
| 61 // |items| acts as a filter. This restricts the current context's default | 61 // |items| acts as a filter. This restricts the current context's default |
| 62 // menu items to contain only the items from |items|. | 62 // menu items to contain only the items from |items|. |
| 63 // |items| == NULL means no filtering will be applied. | 63 // |items| == NULL means no filtering will be applied. |
| 64 void ShowContextMenu(int request_id, const MenuItemVector* items); | 64 void ShowContextMenu(int request_id, const MenuItemVector* items); |
| 65 | 65 |
| 66 // Sets the frame name of the guest. | |
| 67 void SetName(const std::string& name); | |
| 68 | |
| 66 // GuestViewBase implementation. | 69 // GuestViewBase implementation. |
| 67 virtual void Attach(content::WebContents* embedder_web_contents, | 70 virtual void Attach(content::WebContents* embedder_web_contents, |
| 68 const base::DictionaryValue& args) OVERRIDE; | 71 const base::DictionaryValue& args) OVERRIDE; |
| 69 | 72 |
| 70 // BrowserPluginGuestDelegate public implementation. | 73 // BrowserPluginGuestDelegate public implementation. |
| 71 virtual bool HandleContextMenu( | 74 virtual bool HandleContextMenu( |
| 72 const content::ContextMenuParams& params) OVERRIDE; | 75 const content::ContextMenuParams& params) OVERRIDE; |
| 73 | 76 |
| 74 // GuestDelegate implementation. | 77 // GuestDelegate implementation. |
| 75 virtual void AddMessageToConsole(int32 level, | 78 virtual void AddMessageToConsole(int32 level, |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 121 bool user_gesture, | 124 bool user_gesture, |
| 122 bool* was_blocked) OVERRIDE; | 125 bool* was_blocked) OVERRIDE; |
| 123 virtual content::WebContents* OpenURLFromTab( | 126 virtual content::WebContents* OpenURLFromTab( |
| 124 content::WebContents* source, | 127 content::WebContents* source, |
| 125 const content::OpenURLParams& params) OVERRIDE; | 128 const content::OpenURLParams& params) OVERRIDE; |
| 126 virtual void WebContentsCreated(content::WebContents* source_contents, | 129 virtual void WebContentsCreated(content::WebContents* source_contents, |
| 127 int opener_render_frame_id, | 130 int opener_render_frame_id, |
| 128 const base::string16& frame_name, | 131 const base::string16& frame_name, |
| 129 const GURL& target_url, | 132 const GURL& target_url, |
| 130 content::WebContents* new_contents) OVERRIDE; | 133 content::WebContents* new_contents) OVERRIDE; |
| 134 virtual void FrameNameChanged(int render_frame_id, | |
| 135 bool is_top_level, | |
| 136 const std::string& name) OVERRIDE; | |
| 131 | 137 |
| 132 // NotificationObserver implementation. | 138 // NotificationObserver implementation. |
| 133 virtual void Observe(int type, | 139 virtual void Observe(int type, |
| 134 const content::NotificationSource& source, | 140 const content::NotificationSource& source, |
| 135 const content::NotificationDetails& details) OVERRIDE; | 141 const content::NotificationDetails& details) OVERRIDE; |
| 136 | 142 |
| 137 // Set the zoom factor. | 143 // Set the zoom factor. |
| 138 virtual void SetZoom(double zoom_factor) OVERRIDE; | 144 virtual void SetZoom(double zoom_factor) OVERRIDE; |
| 139 | 145 |
| 140 // Returns the current zoom factor. | 146 // Returns the current zoom factor. |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 void OnWebViewDownloadPermissionResponse( | 194 void OnWebViewDownloadPermissionResponse( |
| 189 const base::Callback<void(bool)>& callback, | 195 const base::Callback<void(bool)>& callback, |
| 190 bool allow, | 196 bool allow, |
| 191 const std::string& user_input); | 197 const std::string& user_input); |
| 192 | 198 |
| 193 void OnWebViewPointerLockPermissionResponse( | 199 void OnWebViewPointerLockPermissionResponse( |
| 194 const base::Callback<void(bool)>& callback, | 200 const base::Callback<void(bool)>& callback, |
| 195 bool allow, | 201 bool allow, |
| 196 const std::string& user_input); | 202 const std::string& user_input); |
| 197 | 203 |
| 198 void OnWebViewNewWindowResponse(int new_window_instance_id, | 204 void OnWebViewNewWindowResponse( |
|
lazyboy
2014/05/21 16:27:05
nit: Revert this change.
Fady Samuel
2014/05/21 16:56:49
Done.
| |
| 199 bool allow, | 205 int new_window_instance_id, |
| 200 const std::string& user_input); | 206 bool allow, |
| 207 const std::string& user_input); | |
| 201 | 208 |
| 202 enum PermissionResponseAction { | 209 enum PermissionResponseAction { |
| 203 DENY, | 210 DENY, |
| 204 ALLOW, | 211 ALLOW, |
| 205 DEFAULT | 212 DEFAULT |
| 206 }; | 213 }; |
| 207 | 214 |
| 208 enum SetPermissionResult { | 215 enum SetPermissionResult { |
| 209 SET_PERMISSION_INVALID, | 216 SET_PERMISSION_INVALID, |
| 210 SET_PERMISSION_ALLOWED, | 217 SET_PERMISSION_ALLOWED, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 286 bool is_error_page, | 293 bool is_error_page, |
| 287 bool is_iframe_srcdoc, | 294 bool is_iframe_srcdoc, |
| 288 content::RenderViewHost* render_view_host) OVERRIDE; | 295 content::RenderViewHost* render_view_host) OVERRIDE; |
| 289 virtual void DocumentLoadedInFrame( | 296 virtual void DocumentLoadedInFrame( |
| 290 int64 frame_id, | 297 int64 frame_id, |
| 291 content::RenderViewHost* render_view_host) OVERRIDE; | 298 content::RenderViewHost* render_view_host) OVERRIDE; |
| 292 virtual void DidStopLoading( | 299 virtual void DidStopLoading( |
| 293 content::RenderViewHost* render_view_host) OVERRIDE; | 300 content::RenderViewHost* render_view_host) OVERRIDE; |
| 294 virtual void WebContentsDestroyed() OVERRIDE; | 301 virtual void WebContentsDestroyed() OVERRIDE; |
| 295 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; | 302 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; |
| 303 virtual void RenderViewReady() OVERRIDE; | |
| 304 | |
| 305 // Informs the embedder of a frame name change. | |
| 306 void ReportFrameNameChange(const std::string& name); | |
| 296 | 307 |
| 297 // Called after the load handler is called in the guest's main frame. | 308 // Called after the load handler is called in the guest's main frame. |
| 298 void LoadHandlerCalled(); | 309 void LoadHandlerCalled(); |
| 299 | 310 |
| 300 // Called when a redirect notification occurs. | 311 // Called when a redirect notification occurs. |
| 301 void LoadRedirect(const GURL& old_url, | 312 void LoadRedirect(const GURL& old_url, |
| 302 const GURL& new_url, | 313 const GURL& new_url, |
| 303 bool is_top_level); | 314 bool is_top_level); |
| 304 | 315 |
| 305 void AddWebViewToExtensionRendererState(); | 316 void AddWebViewToExtensionRendererState(); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 375 | 386 |
| 376 // Main frame ID of last committed page. | 387 // Main frame ID of last committed page. |
| 377 int64 main_frame_id_; | 388 int64 main_frame_id_; |
| 378 | 389 |
| 379 // Set to |true| if ChromeVox was already injected in main frame. | 390 // Set to |true| if ChromeVox was already injected in main frame. |
| 380 bool chromevox_injected_; | 391 bool chromevox_injected_; |
| 381 | 392 |
| 382 // Stores the current zoom factor. | 393 // Stores the current zoom factor. |
| 383 double current_zoom_factor_; | 394 double current_zoom_factor_; |
| 384 | 395 |
| 396 // Stores the window name of the main frame of the guest. | |
| 397 std::string name_; | |
| 398 | |
| 385 // Handles find requests and replies for the webview find API. | 399 // Handles find requests and replies for the webview find API. |
| 386 WebviewFindHelper find_helper_; | 400 WebviewFindHelper find_helper_; |
| 387 | 401 |
| 388 // Handles the JavaScript dialog requests. | 402 // Handles the JavaScript dialog requests. |
| 389 JavaScriptDialogHelper javascript_dialog_helper_; | 403 JavaScriptDialogHelper javascript_dialog_helper_; |
| 390 | 404 |
| 391 friend void WebviewFindHelper::DispatchFindUpdateEvent(bool canceled, | 405 friend void WebviewFindHelper::DispatchFindUpdateEvent(bool canceled, |
| 392 bool final_update); | 406 bool final_update); |
| 393 | 407 |
| 394 // Holds the RenderViewContextMenu that has been built but yet to be | 408 // Holds the RenderViewContextMenu that has been built but yet to be |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 413 name(name) {} | 427 name(name) {} |
| 414 }; | 428 }; |
| 415 | 429 |
| 416 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 430 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
| 417 PendingWindowMap pending_new_windows_; | 431 PendingWindowMap pending_new_windows_; |
| 418 | 432 |
| 419 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 433 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 420 }; | 434 }; |
| 421 | 435 |
| 422 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 436 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |