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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 bool is_main_frame, | 287 bool is_main_frame, |
285 const GURL& validated_url, | 288 const GURL& validated_url, |
286 bool is_error_page, | 289 bool is_error_page, |
287 bool is_iframe_srcdoc, | 290 bool is_iframe_srcdoc, |
288 content::RenderViewHost* render_view_host) OVERRIDE; | 291 content::RenderViewHost* render_view_host) OVERRIDE; |
289 virtual void DocumentLoadedInFrame( | 292 virtual void DocumentLoadedInFrame( |
290 int64 frame_id, | 293 int64 frame_id, |
291 content::RenderViewHost* render_view_host) OVERRIDE; | 294 content::RenderViewHost* render_view_host) OVERRIDE; |
292 virtual void DidStopLoading( | 295 virtual void DidStopLoading( |
293 content::RenderViewHost* render_view_host) OVERRIDE; | 296 content::RenderViewHost* render_view_host) OVERRIDE; |
| 297 virtual bool OnMessageReceived( |
| 298 const IPC::Message& message, |
| 299 content::RenderFrameHost* render_frame_host) OVERRIDE; |
294 virtual void WebContentsDestroyed() OVERRIDE; | 300 virtual void WebContentsDestroyed() OVERRIDE; |
295 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; | 301 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; |
| 302 virtual void RenderViewReady() OVERRIDE; |
| 303 |
| 304 // Informs the embedder of a frame name change. |
| 305 void ReportFrameNameChange(const std::string& name); |
296 | 306 |
297 // Called after the load handler is called in the guest's main frame. | 307 // Called after the load handler is called in the guest's main frame. |
298 void LoadHandlerCalled(); | 308 void LoadHandlerCalled(); |
299 | 309 |
300 // Called when a redirect notification occurs. | 310 // Called when a redirect notification occurs. |
301 void LoadRedirect(const GURL& old_url, | 311 void LoadRedirect(const GURL& old_url, |
302 const GURL& new_url, | 312 const GURL& new_url, |
303 bool is_top_level); | 313 bool is_top_level); |
304 | 314 |
305 void AddWebViewToExtensionRendererState(); | 315 void AddWebViewToExtensionRendererState(); |
(...skipping 30 matching lines...) Expand all Loading... |
336 | 346 |
337 // Requests resolution of a potentially relative URL. | 347 // Requests resolution of a potentially relative URL. |
338 GURL ResolveURL(const std::string& src); | 348 GURL ResolveURL(const std::string& src); |
339 | 349 |
340 // Notification that a load in the guest resulted in abort. Note that |url| | 350 // Notification that a load in the guest resulted in abort. Note that |url| |
341 // may be invalid. | 351 // may be invalid. |
342 void LoadAbort(bool is_top_level, | 352 void LoadAbort(bool is_top_level, |
343 const GURL& url, | 353 const GURL& url, |
344 const std::string& error_type); | 354 const std::string& error_type); |
345 | 355 |
| 356 void OnUpdateFrameName(bool is_top_level, const std::string& name); |
346 | 357 |
347 // Creates a new guest window owned by this WebViewGuest. | 358 // Creates a new guest window owned by this WebViewGuest. |
348 WebViewGuest* CreateNewGuestWindow(const content::OpenURLParams& params); | 359 WebViewGuest* CreateNewGuestWindow(const content::OpenURLParams& params); |
349 | 360 |
350 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); | 361 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); |
351 | 362 |
352 ObserverList<extensions::TabHelper::ScriptExecutionObserver> | 363 ObserverList<extensions::TabHelper::ScriptExecutionObserver> |
353 script_observers_; | 364 script_observers_; |
354 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 365 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
355 | 366 |
(...skipping 19 matching lines...) Expand all 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 |