OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ |
| 6 #define CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ |
| 7 |
| 8 #include "content/public/browser/web_contents_observer.h" |
| 9 |
| 10 namespace chrome { |
| 11 |
| 12 // A WebViewGuest is a WebContentsObserver on the guest WebContents of a |
| 13 // <webview> tag. It provides the browser-side implementation of the <webview> |
| 14 // API and manages the lifetime of <webview> extension events. |
| 15 class WebViewGuest : public content::WebContentsObserver { |
| 16 public: |
| 17 WebViewGuest(content::WebContents* guest_web_contents, |
| 18 content::WebContents* embedder_web_contents, |
| 19 const std::string& extension_id); |
| 20 |
| 21 static WebViewGuest* From(void* profile, int instance_id); |
| 22 |
| 23 content::WebContents* embedder_web_contents() const { |
| 24 return embedder_web_contents_; |
| 25 } |
| 26 |
| 27 content::WebContents* web_contents() const { |
| 28 return WebContentsObserver::web_contents(); |
| 29 } |
| 30 |
| 31 private: |
| 32 virtual ~WebViewGuest(); |
| 33 virtual void WebContentsDestroyed( |
| 34 content::WebContents* web_contents) OVERRIDE; |
| 35 |
| 36 content::WebContents* embedder_web_contents_; |
| 37 const std::string extension_id_; |
| 38 const int embedder_render_process_id_; |
| 39 // Profile and instance ID are cached here because |web_contents()| is |
| 40 // null on destruction. |
| 41 void* profile_; |
| 42 const int instance_id_; |
| 43 |
| 44 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); |
| 45 }; |
| 46 |
| 47 } // namespace chrome |
| 48 |
| 49 #endif // CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ |
OLD | NEW |