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 class Profile; | |
11 | |
12 namespace chrome { | |
13 | |
14 // A WebViewGuest is a WebContentsObserver on the guest WebContents of a | |
15 // <webview> tag. It provides the browser-side implementation of the <webview> | |
16 // API and manages the lifetime of <webview> extension events. | |
17 class WebViewGuest : public content::WebContentsObserver { | |
18 public: | |
19 WebViewGuest(content::WebContents* guest_web_contents, | |
20 content::WebContents* embedder_web_contents, | |
21 const std::string& extension_id); | |
22 | |
23 static WebViewGuest* From(Profile* profile, int instance_id); | |
24 | |
25 content::WebContents* embedder_web_contents() const { | |
26 return embedder_web_contents_; | |
27 } | |
28 | |
29 content::WebContents* web_contents() const { | |
30 return WebContentsObserver::web_contents(); | |
31 } | |
32 | |
33 private: | |
34 virtual ~WebViewGuest(); | |
35 virtual void WebContentsDestroyed( | |
36 content::WebContents* web_contents) OVERRIDE; | |
37 | |
38 content::WebContents* embedder_web_contents_; | |
39 std::string extension_id_; | |
40 int embedder_render_process_id_; | |
41 // Profile and instance ID are cached here because |web_contents()| is | |
42 // null on destruction. | |
43 Profile* profile_; | |
44 int instance_id_; | |
sky
2013/05/23 15:41:11
const here and 39/40 too.
Fady Samuel
2013/05/24 03:13:47
Done.
| |
45 | |
46 DISALLOW_COPY_AND_ASSIGN(WebViewGuest); | |
47 }; | |
48 | |
49 } // namespace chrome | |
50 | |
51 #endif // CHROME_BROWSER_WEBVIEW_WEBVIEW_GUEST_H_ | |
OLD | NEW |