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 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
59 std::string* partition_domain, | 59 std::string* partition_domain, |
60 std::string* partition_name, | 60 std::string* partition_name, |
61 bool* in_memory); | 61 bool* in_memory); |
62 | 62 |
63 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a | 63 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a |
64 // WebViewGuest. | 64 // WebViewGuest. |
65 static int GetViewInstanceId(content::WebContents* contents); | 65 static int GetViewInstanceId(content::WebContents* contents); |
66 | 66 |
67 static const char Type[]; | 67 static const char Type[]; |
68 | 68 |
69 void SetAutoSize(bool enabled, | |
70 const gfx::Size& min_size, | |
71 const gfx::Size& max_size); | |
72 | |
69 // Request navigating the guest to the provided |src| URL. | 73 // Request navigating the guest to the provided |src| URL. |
70 void NavigateGuest(const std::string& src); | 74 void NavigateGuest(const std::string& src); |
71 | 75 |
72 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; | 76 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; |
73 // Shows the context menu for the guest. | 77 // Shows the context menu for the guest. |
74 // |items| acts as a filter. This restricts the current context's default | 78 // |items| acts as a filter. This restricts the current context's default |
75 // menu items to contain only the items from |items|. | 79 // menu items to contain only the items from |items|. |
76 // |items| == NULL means no filtering will be applied. | 80 // |items| == NULL means no filtering will be applied. |
77 void ShowContextMenu(int request_id, const MenuItemVector* items); | 81 void ShowContextMenu(int request_id, const MenuItemVector* items); |
78 | 82 |
(...skipping 70 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) | 163 virtual void GuestSizeChanged(const gfx::Size& old_size, |
160 OVERRIDE; | 164 const gfx::Size& new_size) OVERRIDE; |
165 virtual void ElementSizeChanged(const gfx::Size& old_size, | |
166 const gfx::Size& new_size) OVERRIDE; | |
161 virtual void RequestPointerLockPermission( | 167 virtual void RequestPointerLockPermission( |
162 bool user_gesture, | 168 bool user_gesture, |
163 bool last_unlocked_by_target, | 169 bool last_unlocked_by_target, |
164 const base::Callback<void(bool)>& callback) OVERRIDE; | 170 const base::Callback<void(bool)>& callback) OVERRIDE; |
165 // NotificationObserver implementation. | 171 // NotificationObserver implementation. |
166 virtual void Observe(int type, | 172 virtual void Observe(int type, |
167 const content::NotificationSource& source, | 173 const content::NotificationSource& source, |
168 const content::NotificationDetails& details) OVERRIDE; | 174 const content::NotificationDetails& details) OVERRIDE; |
169 | 175 |
170 // Returns the current zoom factor. | 176 // Returns the current zoom factor. |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
327 void OnUpdateFrameName(bool is_top_level, const std::string& name); | 333 void OnUpdateFrameName(bool is_top_level, const std::string& name); |
328 | 334 |
329 // Creates a new guest window owned by this WebViewGuest. | 335 // Creates a new guest window owned by this WebViewGuest. |
330 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); | 336 void CreateNewGuestWebViewWindow(const content::OpenURLParams& params); |
331 | 337 |
332 void NewGuestWebViewCallback(const content::OpenURLParams& params, | 338 void NewGuestWebViewCallback(const content::OpenURLParams& params, |
333 content::WebContents* guest_web_contents); | 339 content::WebContents* guest_web_contents); |
334 | 340 |
335 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); | 341 bool HandleKeyboardShortcuts(const content::NativeWebKeyboardEvent& event); |
336 | 342 |
343 void DispatchSizeChangedEvent(const gfx::Size& old_size, | |
344 const gfx::Size& new_size); | |
345 | |
337 ObserverList<extensions::TabHelper::ScriptExecutionObserver> | 346 ObserverList<extensions::TabHelper::ScriptExecutionObserver> |
338 script_observers_; | 347 script_observers_; |
339 scoped_ptr<extensions::ScriptExecutor> script_executor_; | 348 scoped_ptr<extensions::ScriptExecutor> script_executor_; |
340 | 349 |
341 content::NotificationRegistrar notification_registrar_; | 350 content::NotificationRegistrar notification_registrar_; |
342 | 351 |
343 // A counter to generate a unique request id for a context menu request. | 352 // 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. | 353 // We only need the ids to be unique for a given WebViewGuest. |
345 int pending_context_menu_request_id_; | 354 int pending_context_menu_request_id_; |
346 | 355 |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
386 bool changed; | 395 bool changed; |
387 NewWindowInfo(const GURL& url, const std::string& name) : | 396 NewWindowInfo(const GURL& url, const std::string& name) : |
388 url(url), | 397 url(url), |
389 name(name), | 398 name(name), |
390 changed(false) {} | 399 changed(false) {} |
391 }; | 400 }; |
392 | 401 |
393 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 402 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
394 PendingWindowMap pending_new_windows_; | 403 PendingWindowMap pending_new_windows_; |
395 | 404 |
405 gfx::Size element_size_; | |
lazyboy
2014/07/31 04:24:22
add description of these two gfx::Size members.
Fady Samuel
2014/08/01 18:12:52
Done.
| |
406 gfx::Size guest_size_; | |
407 bool auto_size_enabled_; | |
408 bool auto_size_disabling_; | |
lazyboy
2014/07/31 04:24:22
Add description
Fady Samuel
2014/08/01 18:12:52
Looks like this is unnecessary. Removed.
| |
409 gfx::Size max_auto_size_; | |
410 gfx::Size min_auto_size_; | |
411 | |
396 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 412 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
397 }; | 413 }; |
398 | 414 |
399 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 415 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
OLD | NEW |