| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 class WebViewGuest : public GuestView<WebViewGuest>, | 44 class WebViewGuest : public GuestView<WebViewGuest>, |
| 45 public content::NotificationObserver { | 45 public content::NotificationObserver { |
| 46 public: | 46 public: |
| 47 WebViewGuest(int guest_instance_id, | 47 WebViewGuest(int guest_instance_id, |
| 48 content::WebContents* guest_web_contents, | 48 content::WebContents* guest_web_contents, |
| 49 const std::string& embedder_extension_id); | 49 const std::string& embedder_extension_id); |
| 50 | 50 |
| 51 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a | 51 // Returns guestview::kInstanceIDNone if |contents| does not correspond to a |
| 52 // WebViewGuest. | 52 // WebViewGuest. |
| 53 static int GetViewInstanceId(content::WebContents* contents); | 53 static int GetViewInstanceId(content::WebContents* contents); |
| 54 // Parses partition related parameters from |partition_str|. |
| 55 // |storage_partition_id| is the parsed partition ID and |persist_storage| |
| 56 // specifies whether or not the partition is in memory. |
| 57 static void ParsePartitionParam(const std::string& partition_str, |
| 58 std::string* storage_partition_id, |
| 59 bool* persist_storage); |
| 54 static const char Type[]; | 60 static const char Type[]; |
| 55 | 61 |
| 62 // Request navigating the guest to the provided |src| URL. |
| 63 void NavigateGuest(const std::string& src); |
| 64 |
| 56 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; | 65 typedef std::vector<linked_ptr<webview_api::ContextMenuItem> > MenuItemVector; |
| 57 // Shows the context menu for the guest. | 66 // Shows the context menu for the guest. |
| 58 // |items| acts as a filter. This restricts the current context's default | 67 // |items| acts as a filter. This restricts the current context's default |
| 59 // menu items to contain only the items from |items|. | 68 // menu items to contain only the items from |items|. |
| 60 // |items| == NULL means no filtering will be applied. | 69 // |items| == NULL means no filtering will be applied. |
| 61 void ShowContextMenu(int request_id, const MenuItemVector* items); | 70 void ShowContextMenu(int request_id, const MenuItemVector* items); |
| 62 | 71 |
| 63 // Sets the frame name of the guest. | 72 // Sets the frame name of the guest. |
| 64 void SetName(const std::string& name); | 73 void SetName(const std::string& name); |
| 65 | 74 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 virtual content::WebContents* OpenURLFromTab( | 130 virtual content::WebContents* OpenURLFromTab( |
| 122 content::WebContents* source, | 131 content::WebContents* source, |
| 123 const content::OpenURLParams& params) OVERRIDE; | 132 const content::OpenURLParams& params) OVERRIDE; |
| 124 virtual void WebContentsCreated(content::WebContents* source_contents, | 133 virtual void WebContentsCreated(content::WebContents* source_contents, |
| 125 int opener_render_frame_id, | 134 int opener_render_frame_id, |
| 126 const base::string16& frame_name, | 135 const base::string16& frame_name, |
| 127 const GURL& target_url, | 136 const GURL& target_url, |
| 128 content::WebContents* new_contents) OVERRIDE; | 137 content::WebContents* new_contents) OVERRIDE; |
| 129 | 138 |
| 130 // BrowserPluginGuestDelegate implementation. | 139 // BrowserPluginGuestDelegate implementation. |
| 131 virtual void DidAttach() OVERRIDE; | 140 virtual void DidAttach(const base::DictionaryValue& extra_params) OVERRIDE; |
| 132 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) | 141 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) |
| 133 OVERRIDE; | 142 OVERRIDE; |
| 134 virtual void RequestPointerLockPermission( | 143 virtual void RequestPointerLockPermission( |
| 135 bool user_gesture, | 144 bool user_gesture, |
| 136 bool last_unlocked_by_target, | 145 bool last_unlocked_by_target, |
| 137 const base::Callback<void(bool)>& callback) OVERRIDE; | 146 const base::Callback<void(bool)>& callback) OVERRIDE; |
| 138 virtual void NavigateGuest(const std::string& src) OVERRIDE; | |
| 139 virtual void Destroy() OVERRIDE; | 147 virtual void Destroy() OVERRIDE; |
| 140 | 148 |
| 141 // NotificationObserver implementation. | 149 // NotificationObserver implementation. |
| 142 virtual void Observe(int type, | 150 virtual void Observe(int type, |
| 143 const content::NotificationSource& source, | 151 const content::NotificationSource& source, |
| 144 const content::NotificationDetails& details) OVERRIDE; | 152 const content::NotificationDetails& details) OVERRIDE; |
| 145 | 153 |
| 146 // Returns the current zoom factor. | 154 // Returns the current zoom factor. |
| 147 double GetZoom(); | 155 double GetZoom(); |
| 148 | 156 |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 name(name) {} | 437 name(name) {} |
| 430 }; | 438 }; |
| 431 | 439 |
| 432 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 440 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
| 433 PendingWindowMap pending_new_windows_; | 441 PendingWindowMap pending_new_windows_; |
| 434 | 442 |
| 435 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 443 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 436 }; | 444 }; |
| 437 | 445 |
| 438 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 446 #endif // CHROME_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
| OLD | NEW |