| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 virtual void CreateWebContents( | 88 virtual void CreateWebContents( |
| 89 const std::string& embedder_extension_id, | 89 const std::string& embedder_extension_id, |
| 90 int embedder_render_process_id, | 90 int embedder_render_process_id, |
| 91 const base::DictionaryValue& create_params, | 91 const base::DictionaryValue& create_params, |
| 92 const WebContentsCreatedCallback& callback) OVERRIDE; | 92 const WebContentsCreatedCallback& callback) OVERRIDE; |
| 93 virtual void DidAttachToEmbedder() OVERRIDE; | 93 virtual void DidAttachToEmbedder() OVERRIDE; |
| 94 virtual void DidInitialize() OVERRIDE; | 94 virtual void DidInitialize() OVERRIDE; |
| 95 virtual void DidStopLoading() OVERRIDE; | 95 virtual void DidStopLoading() OVERRIDE; |
| 96 virtual void EmbedderDestroyed() OVERRIDE; | 96 virtual void EmbedderDestroyed() OVERRIDE; |
| 97 virtual void GuestDestroyed() OVERRIDE; | 97 virtual void GuestDestroyed() OVERRIDE; |
| 98 virtual void GuestReady() OVERRIDE; |
| 99 virtual void GuestSizeChangedDueToAutoSize( |
| 100 const gfx::Size& old_size, |
| 101 const gfx::Size& new_size) OVERRIDE; |
| 98 virtual bool IsDragAndDropEnabled() const OVERRIDE; | 102 virtual bool IsDragAndDropEnabled() const OVERRIDE; |
| 99 virtual void WillAttachToEmbedder() OVERRIDE; | 103 virtual void WillAttachToEmbedder() OVERRIDE; |
| 100 virtual void WillDestroy() OVERRIDE; | 104 virtual void WillDestroy() OVERRIDE; |
| 101 | 105 |
| 102 // WebContentsDelegate implementation. | 106 // WebContentsDelegate implementation. |
| 103 virtual bool AddMessageToConsole(content::WebContents* source, | 107 virtual bool AddMessageToConsole(content::WebContents* source, |
| 104 int32 level, | 108 int32 level, |
| 105 const base::string16& message, | 109 const base::string16& message, |
| 106 int32 line_no, | 110 int32 line_no, |
| 107 const base::string16& source_id) OVERRIDE; | 111 const base::string16& source_id) OVERRIDE; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 const content::OpenURLParams& params) OVERRIDE; | 153 const content::OpenURLParams& params) OVERRIDE; |
| 150 virtual void WebContentsCreated(content::WebContents* source_contents, | 154 virtual void WebContentsCreated(content::WebContents* source_contents, |
| 151 int opener_render_frame_id, | 155 int opener_render_frame_id, |
| 152 const base::string16& frame_name, | 156 const base::string16& frame_name, |
| 153 const GURL& target_url, | 157 const GURL& target_url, |
| 154 content::WebContents* new_contents) OVERRIDE; | 158 content::WebContents* new_contents) OVERRIDE; |
| 155 | 159 |
| 156 // BrowserPluginGuestDelegate implementation. | 160 // BrowserPluginGuestDelegate implementation. |
| 157 virtual content::WebContents* CreateNewGuestWindow( | 161 virtual content::WebContents* CreateNewGuestWindow( |
| 158 const content::WebContents::CreateParams& create_params) OVERRIDE; | 162 const content::WebContents::CreateParams& create_params) OVERRIDE; |
| 159 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) | |
| 160 OVERRIDE; | |
| 161 virtual void RequestPointerLockPermission( | 163 virtual void RequestPointerLockPermission( |
| 162 bool user_gesture, | 164 bool user_gesture, |
| 163 bool last_unlocked_by_target, | 165 bool last_unlocked_by_target, |
| 164 const base::Callback<void(bool)>& callback) OVERRIDE; | 166 const base::Callback<void(bool)>& callback) OVERRIDE; |
| 165 // NotificationObserver implementation. | 167 // NotificationObserver implementation. |
| 166 virtual void Observe(int type, | 168 virtual void Observe(int type, |
| 167 const content::NotificationSource& source, | 169 const content::NotificationSource& source, |
| 168 const content::NotificationDetails& details) OVERRIDE; | 170 const content::NotificationDetails& details) OVERRIDE; |
| 169 | 171 |
| 170 // Returns the current zoom factor. | 172 // Returns the current zoom factor. |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 const GURL& validated_url, | 270 const GURL& validated_url, |
| 269 bool is_error_page, | 271 bool is_error_page, |
| 270 bool is_iframe_srcdoc) OVERRIDE; | 272 bool is_iframe_srcdoc) OVERRIDE; |
| 271 virtual void DocumentLoadedInFrame( | 273 virtual void DocumentLoadedInFrame( |
| 272 content::RenderFrameHost* render_frame_host) OVERRIDE; | 274 content::RenderFrameHost* render_frame_host) OVERRIDE; |
| 273 virtual bool OnMessageReceived( | 275 virtual bool OnMessageReceived( |
| 274 const IPC::Message& message, | 276 const IPC::Message& message, |
| 275 content::RenderFrameHost* render_frame_host) OVERRIDE; | 277 content::RenderFrameHost* render_frame_host) OVERRIDE; |
| 276 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 278 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
| 277 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; | 279 virtual void UserAgentOverrideSet(const std::string& user_agent) OVERRIDE; |
| 278 virtual void RenderViewReady() OVERRIDE; | |
| 279 | 280 |
| 280 // Informs the embedder of a frame name change. | 281 // Informs the embedder of a frame name change. |
| 281 void ReportFrameNameChange(const std::string& name); | 282 void ReportFrameNameChange(const std::string& name); |
| 282 | 283 |
| 283 // Called after the load handler is called in the guest's main frame. | 284 // Called after the load handler is called in the guest's main frame. |
| 284 void LoadHandlerCalled(); | 285 void LoadHandlerCalled(); |
| 285 | 286 |
| 286 // Called when a redirect notification occurs. | 287 // Called when a redirect notification occurs. |
| 287 void LoadRedirect(const GURL& old_url, | 288 void LoadRedirect(const GURL& old_url, |
| 288 const GURL& new_url, | 289 const GURL& new_url, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 void OnUpdateFrameName(bool is_top_level, const std::string& name); | 328 void OnUpdateFrameName(bool is_top_level, const std::string& name); |
| 328 | 329 |
| 329 // Creates a new guest window owned by this WebViewGuest. | 330 // Creates a new guest window owned by this WebViewGuest. |
| 330 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); | 331 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); |
| 331 | 332 |
| 332 void NewGuestWebViewCallback(const content::OpenURLParams& params, | 333 void NewGuestWebViewCallback(const content::OpenURLParams& params, |
| 333 content::WebContents* guest_web_contents); | 334 content::WebContents* guest_web_contents); |
| 334 | 335 |
| 335 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); | 336 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); |
| 336 | 337 |
| 338 void SetupAutoSize(); |
| 339 |
| 337 ObserverList<extensions::TabHelper::ScriptExecutionObserver> | 340 ObserverList<extensions::TabHelper::ScriptExecutionObserver> |
| 338 script_observers_; | 341 script_observers_; |
| 339 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 342 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
| 340 | 343 |
| 341 content::NotificationRegistrar notification_registrar_; | 344 content::NotificationRegistrar notification_registrar_; |
| 342 | 345 |
| 343 // A counter to generate a unique request id for a context menu request. | 346 // A counter to generate a unique request id for a context menu request. |
| 344 // We only need the ids to be unique for a given WebViewGuest. | 347 // We only need the ids to be unique for a given WebViewGuest. |
| 345 int pending_context_menu_request_id_; | 348 int pending_context_menu_request_id_; |
| 346 | 349 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 changed(false) {} | 393 changed(false) {} |
| 391 }; | 394 }; |
| 392 | 395 |
| 393 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 396 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
| 394 PendingWindowMap pending_new_windows_; | 397 PendingWindowMap pending_new_windows_; |
| 395 | 398 |
| 396 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 399 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 397 }; | 400 }; |
| 398 | 401 |
| 399 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 402 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |