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 |extra_params|. |
| 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 base::DictionaryValue* extra_params, |
| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 virtual content::WebContents* OpenURLFromTab( | 132 virtual content::WebContents* OpenURLFromTab( |
124 content::WebContents* source, | 133 content::WebContents* source, |
125 const content::OpenURLParams& params) OVERRIDE; | 134 const content::OpenURLParams& params) OVERRIDE; |
126 virtual void WebContentsCreated(content::WebContents* source_contents, | 135 virtual void WebContentsCreated(content::WebContents* source_contents, |
127 int opener_render_frame_id, | 136 int opener_render_frame_id, |
128 const base::string16& frame_name, | 137 const base::string16& frame_name, |
129 const GURL& target_url, | 138 const GURL& target_url, |
130 content::WebContents* new_contents) OVERRIDE; | 139 content::WebContents* new_contents) OVERRIDE; |
131 | 140 |
132 // BrowserPluginGuestDelegate implementation. | 141 // BrowserPluginGuestDelegate implementation. |
133 virtual void DidAttach() OVERRIDE; | 142 virtual void DidAttach(const base::DictionaryValue& extra_params) OVERRIDE; |
134 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) | 143 virtual void SizeChanged(const gfx::Size& old_size, const gfx::Size& new_size) |
135 OVERRIDE; | 144 OVERRIDE; |
136 virtual void RequestPointerLockPermission( | 145 virtual void RequestPointerLockPermission( |
137 bool user_gesture, | 146 bool user_gesture, |
138 bool last_unlocked_by_target, | 147 bool last_unlocked_by_target, |
139 const base::Callback<void(bool)>& callback) OVERRIDE; | 148 const base::Callback<void(bool)>& callback) OVERRIDE; |
140 virtual void NavigateGuest(const std::string& src) OVERRIDE; | |
141 | 149 |
142 // NotificationObserver implementation. | 150 // NotificationObserver implementation. |
143 virtual void Observe(int type, | 151 virtual void Observe(int type, |
144 const content::NotificationSource& source, | 152 const content::NotificationSource& source, |
145 const content::NotificationDetails& details) OVERRIDE; | 153 const content::NotificationDetails& details) OVERRIDE; |
146 | 154 |
147 // Returns the current zoom factor. | 155 // Returns the current zoom factor. |
148 double GetZoom(); | 156 double GetZoom(); |
149 | 157 |
150 // Begin or continue a find request. | 158 // Begin or continue a find request. |
(...skipping 278 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 |