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 virtual ~WebViewGuest(); |
| 21 |
| 22 static WebViewGuest* From(void* profile, int instance_id); |
| 23 |
| 24 content::WebContents* embedder_web_contents() const { |
| 25 return embedder_web_contents_; |
| 26 } |
| 27 |
| 28 content::WebContents* web_contents() const { |
| 29 return WebContentsObserver::web_contents(); |
| 30 } |
| 31 private: |
| 32 virtual void WebContentsDestroyed( |
| 33 content::WebContents* web_contents) OVERRIDE; |
| 34 |
| 35 content::WebContents* embedder_web_contents_; |
| 36 std::string extension_id_; |
| 37 int embedder_render_process_id_; |
| 38 // Profile and instance ID are cached here because |web_contents()| is |
| 39 // null on destruction. |
| 40 void* profile_; |
| 41 int instance_id_; |
| 42 }; |
| 43 |
| 44 } // namespace chrome |
| 45 |
| 46 #endif // CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ |
OLD | NEW |