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 27 matching lines...) Expand all Loading... |
38 | 38 |
39 // A WebViewGuest provides the browser-side implementation of the <webview> API | 39 // A WebViewGuest provides the browser-side implementation of the <webview> API |
40 // and manages the dispatch of <webview> extension events. WebViewGuest is | 40 // and manages the dispatch of <webview> extension events. WebViewGuest is |
41 // created on attachment. That is, when a guest WebContents is associated with | 41 // created on attachment. That is, when a guest WebContents is associated with |
42 // a particular embedder WebContents. This happens on either initial navigation | 42 // a particular embedder WebContents. This happens on either initial navigation |
43 // or through the use of the New Window API, when a new window is attached to | 43 // or through the use of the New Window API, when a new window is attached to |
44 // a particular <webview>. | 44 // a particular <webview>. |
45 class WebViewGuest : public GuestView<WebViewGuest>, | 45 class WebViewGuest : public GuestView<WebViewGuest>, |
46 public content::NotificationObserver { | 46 public content::NotificationObserver { |
47 public: | 47 public: |
48 WebViewGuest(content::BrowserContext* browser_context, | 48 static GuestViewBase* Create(content::BrowserContext* browser_context, |
49 int guest_instance_id); | 49 int guest_instance_id); |
50 | 50 |
51 // For WebViewGuest, we create special guest processes, which host the | 51 // For WebViewGuest, we create special guest processes, which host the |
52 // tag content separately from the main application that embeds the tag. | 52 // tag content separately from the main application that embeds the tag. |
53 // A <webview> can specify both the partition name and whether the storage | 53 // A <webview> can specify both the partition name and whether the storage |
54 // for that partition should be persisted. Each tag gets a SiteInstance with | 54 // for that partition should be persisted. Each tag gets a SiteInstance with |
55 // a specially formatted URL, based on the application it is hosted by and | 55 // a specially formatted URL, based on the application it is hosted by and |
56 // the partition requested by it. The format for that URL is: | 56 // the partition requested by it. The format for that URL is: |
57 // chrome-guest://partition_domain/persist?partition_name | 57 // chrome-guest://partition_domain/persist?partition_name |
58 static bool GetGuestPartitionConfigForSite(const GURL& site, | 58 static bool GetGuestPartitionConfigForSite(const GURL& site, |
59 std::string* partition_domain, | 59 std::string* partition_domain, |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 bool ClearData(const base::Time remove_since, | 231 bool ClearData(const base::Time remove_since, |
232 uint32 removal_mask, | 232 uint32 removal_mask, |
233 const base::Closure& callback); | 233 const base::Closure& callback); |
234 | 234 |
235 extensions::ScriptExecutor* script_executor() { | 235 extensions::ScriptExecutor* script_executor() { |
236 return script_executor_.get(); | 236 return script_executor_.get(); |
237 } | 237 } |
238 | 238 |
239 private: | 239 private: |
240 friend class WebViewPermissionHelper; | 240 friend class WebViewPermissionHelper; |
| 241 WebViewGuest(content::BrowserContext* browser_context, |
| 242 int guest_instance_id); |
| 243 |
241 virtual ~WebViewGuest(); | 244 virtual ~WebViewGuest(); |
242 | 245 |
243 // Returns the top level items (ignoring submenus) as Value. | 246 // Returns the top level items (ignoring submenus) as Value. |
244 static scoped_ptr<base::ListValue> MenuModelToValue( | 247 static scoped_ptr<base::ListValue> MenuModelToValue( |
245 const ui::SimpleMenuModel& menu_model); | 248 const ui::SimpleMenuModel& menu_model); |
246 | 249 |
247 void AttachWebViewHelpers(content::WebContents* contents); | 250 void AttachWebViewHelpers(content::WebContents* contents); |
248 | 251 |
249 void OnWebViewNewWindowResponse(int new_window_instance_id, | 252 void OnWebViewNewWindowResponse(int new_window_instance_id, |
250 bool allow, | 253 bool allow, |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 changed(false) {} | 390 changed(false) {} |
388 }; | 391 }; |
389 | 392 |
390 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; | 393 typedef std::map<WebViewGuest*, NewWindowInfo> PendingWindowMap; |
391 PendingWindowMap pending_new_windows_; | 394 PendingWindowMap pending_new_windows_; |
392 | 395 |
393 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 396 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
394 }; | 397 }; |
395 | 398 |
396 #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 |