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