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 EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 5 #ifndef EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
6 #define EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 6 #define EXTENSIONS_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 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // A WebViewGuest provides the browser-side implementation of the <webview> API | 30 // A WebViewGuest provides the browser-side implementation of the <webview> API |
31 // and manages the dispatch of <webview> extension events. WebViewGuest is | 31 // and manages the dispatch of <webview> extension events. WebViewGuest is |
32 // created on attachment. That is, when a guest WebContents is associated with | 32 // created on attachment. That is, when a guest WebContents is associated with |
33 // a particular embedder WebContents. This happens on either initial navigation | 33 // a particular embedder WebContents. This happens on either initial navigation |
34 // or through the use of the New Window API, when a new window is attached to | 34 // or through the use of the New Window API, when a new window is attached to |
35 // a particular <webview>. | 35 // a particular <webview>. |
36 class WebViewGuest : public guest_view::GuestView<WebViewGuest>, | 36 class WebViewGuest : public guest_view::GuestView<WebViewGuest>, |
37 public content::NotificationObserver { | 37 public content::NotificationObserver { |
38 public: | 38 public: |
| 39 // Clean up state when this GuestView is being destroyed. See |
| 40 // GuestViewBase::CleanUp(). |
| 41 static void CleanUp(int embedder_process_id, int view_instance_id); |
| 42 |
39 static GuestViewBase* Create(content::WebContents* owner_web_contents); | 43 static GuestViewBase* Create(content::WebContents* owner_web_contents); |
40 | 44 |
41 // For WebViewGuest, we create special guest processes, which host the | 45 // For WebViewGuest, we create special guest processes, which host the |
42 // tag content separately from the main application that embeds the tag. | 46 // tag content separately from the main application that embeds the tag. |
43 // A <webview> can specify both the partition name and whether the storage | 47 // A <webview> can specify both the partition name and whether the storage |
44 // for that partition should be persisted. Each tag gets a SiteInstance with | 48 // for that partition should be persisted. Each tag gets a SiteInstance with |
45 // a specially formatted URL, based on the application it is hosted by and | 49 // a specially formatted URL, based on the application it is hosted by and |
46 // the partition requested by it. The format for that URL is: | 50 // the partition requested by it. The format for that URL is: |
47 // chrome-guest://partition_domain/persist?partition_name | 51 // chrome-guest://partition_domain/persist?partition_name |
48 static bool GetGuestPartitionConfigForSite(const GURL& site, | 52 static bool GetGuestPartitionConfigForSite(const GURL& site, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 | 107 |
104 // GuestViewBase implementation. | 108 // GuestViewBase implementation. |
105 bool CanRunInDetachedState() const override; | 109 bool CanRunInDetachedState() const override; |
106 void CreateWebContents(const base::DictionaryValue& create_params, | 110 void CreateWebContents(const base::DictionaryValue& create_params, |
107 const WebContentsCreatedCallback& callback) override; | 111 const WebContentsCreatedCallback& callback) override; |
108 void DidAttachToEmbedder() override; | 112 void DidAttachToEmbedder() override; |
109 void DidDropLink(const GURL& url) override; | 113 void DidDropLink(const GURL& url) override; |
110 void DidInitialize(const base::DictionaryValue& create_params) override; | 114 void DidInitialize(const base::DictionaryValue& create_params) override; |
111 void GuestViewDidStopLoading() override; | 115 void GuestViewDidStopLoading() override; |
112 void EmbedderFullscreenToggled(bool entered_fullscreen) override; | 116 void EmbedderFullscreenToggled(bool entered_fullscreen) override; |
113 void EmbedderWillBeDestroyed() override; | |
114 const char* GetAPINamespace() const override; | 117 const char* GetAPINamespace() const override; |
115 int GetTaskPrefix() const override; | 118 int GetTaskPrefix() const override; |
116 void GuestDestroyed() override; | 119 void GuestDestroyed() override; |
117 void GuestReady() override; | 120 void GuestReady() override; |
118 void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, | 121 void GuestSizeChangedDueToAutoSize(const gfx::Size& old_size, |
119 const gfx::Size& new_size) override; | 122 const gfx::Size& new_size) override; |
120 void GuestZoomChanged(double old_zoom_level, double new_zoom_level) override; | 123 void GuestZoomChanged(double old_zoom_level, double new_zoom_level) override; |
121 bool IsAutoSizeSupported() const override; | 124 bool IsAutoSizeSupported() const override; |
122 bool IsDragAndDropEnabled() const override; | 125 bool IsDragAndDropEnabled() const override; |
123 void SignalWhenReady(const base::Closure& callback) override; | 126 void SignalWhenReady(const base::Closure& callback) override; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 // This is used to ensure pending tasks will not fire after this object is | 409 // This is used to ensure pending tasks will not fire after this object is |
407 // destroyed. | 410 // destroyed. |
408 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; | 411 base::WeakPtrFactory<WebViewGuest> weak_ptr_factory_; |
409 | 412 |
410 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | 413 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
411 }; | 414 }; |
412 | 415 |
413 } // namespace extensions | 416 } // namespace extensions |
414 | 417 |
415 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ | 418 #endif // EXTENSIONS_BROWSER_GUEST_VIEW_WEB_VIEW_WEB_VIEW_GUEST_H_ |
OLD | NEW |