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_GUEST_VIEW_BASE_H_ | 5 #ifndef CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 6 #define CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 | 9 |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 return opener_.get(); | 144 return opener_.get(); |
145 } | 145 } |
146 | 146 |
147 void SetOpener(GuestViewBase* opener); | 147 void SetOpener(GuestViewBase* opener); |
148 | 148 |
149 // BrowserPluginGuestDelegate implementation. | 149 // BrowserPluginGuestDelegate implementation. |
150 virtual void Destroy() OVERRIDE FINAL; | 150 virtual void Destroy() OVERRIDE FINAL; |
151 virtual void RegisterDestructionCallback( | 151 virtual void RegisterDestructionCallback( |
152 const DestructionCallback& callback) OVERRIDE FINAL; | 152 const DestructionCallback& callback) OVERRIDE FINAL; |
153 | 153 |
| 154 // Dispatches an event |event_name| to the embedder with the |event| fields. |
| 155 // Change this function as a public function because WebViewGuest will use it |
| 156 // to dispatch permission request event. |
| 157 void DispatchEvent(Event* event); |
| 158 |
154 protected: | 159 protected: |
155 GuestViewBase(int guest_instance_id, | 160 GuestViewBase(int guest_instance_id, |
156 content::WebContents* guest_web_contents, | 161 content::WebContents* guest_web_contents, |
157 const std::string& embedder_extension_id); | 162 const std::string& embedder_extension_id); |
158 virtual ~GuestViewBase(); | 163 virtual ~GuestViewBase(); |
159 | 164 |
160 // Dispatches an event |event_name| to the embedder with the |event| fields. | |
161 void DispatchEvent(Event* event); | |
162 | |
163 private: | 165 private: |
164 class EmbedderWebContentsObserver; | 166 class EmbedderWebContentsObserver; |
165 | 167 |
166 void SendQueuedEvents(); | 168 void SendQueuedEvents(); |
167 | 169 |
168 // WebContentsObserver implementation. | 170 // WebContentsObserver implementation. |
169 virtual void DidStopLoading( | 171 virtual void DidStopLoading( |
170 content::RenderViewHost* render_view_host) OVERRIDE FINAL; | 172 content::RenderViewHost* render_view_host) OVERRIDE FINAL; |
171 virtual void WebContentsDestroyed() OVERRIDE FINAL; | 173 virtual void WebContentsDestroyed() OVERRIDE FINAL; |
172 | 174 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; | 207 scoped_ptr<EmbedderWebContentsObserver> embedder_web_contents_observer_; |
206 | 208 |
207 // This is used to ensure pending tasks will not fire after this object is | 209 // This is used to ensure pending tasks will not fire after this object is |
208 // destroyed. | 210 // destroyed. |
209 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; | 211 base::WeakPtrFactory<GuestViewBase> weak_ptr_factory_; |
210 | 212 |
211 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); | 213 DISALLOW_COPY_AND_ASSIGN(GuestViewBase); |
212 }; | 214 }; |
213 | 215 |
214 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ | 216 #endif // CHROME_BROWSER_GUEST_VIEW_GUEST_VIEW_BASE_H_ |
OLD | NEW |