OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_UI_EXTENSIONS_SHELL_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 6 #define CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "chrome/browser/extensions/extension_host.h" | 10 #include "chrome/browser/extensions/extension_host.h" |
11 #include "content/public/browser/notification_observer.h" | 11 #include "content/public/browser/notification_observer.h" |
12 #include "content/public/browser/notification_registrar.h" | 12 #include "content/public/browser/notification_registrar.h" |
13 #include "content/public/browser/web_contents_observer.h" | |
14 | 13 |
15 class GURL; | 14 class GURL; |
16 class Extension; | 15 class Extension; |
17 class ExtensionHost; | 16 class ExtensionHost; |
18 class Profile; | 17 class Profile; |
19 | 18 |
20 namespace content { | 19 namespace content { |
21 class WebContents; | 20 class WebContents; |
22 class RenderProcessHost; | |
23 } | 21 } |
24 | 22 |
25 class ShellWindow : public content::NotificationObserver, | 23 class ShellWindow : public content::NotificationObserver { |
26 public content::WebContentsObserver { | |
27 public: | 24 public: |
28 content::WebContents* web_contents() const { return host_->host_contents(); } | 25 content::WebContents* web_contents() const { return host_->host_contents(); } |
29 | 26 |
30 static ShellWindow* Create(Profile* profile, | 27 static ShellWindow* Create(Profile* profile, |
31 const Extension* extension, | 28 const Extension* extension, |
32 const GURL& url); | 29 const GURL& url); |
33 | 30 |
34 // Closes the displayed window and invokes the destructor. | 31 // Closes the displayed window and invokes the destructor. |
35 virtual void Close() = 0; | 32 virtual void Close() = 0; |
36 | 33 |
37 // content::NotificationObserver implementation. | 34 // content::NotificationObserver implementation. |
38 virtual void Observe(int type, | 35 virtual void Observe(int type, |
39 const content::NotificationSource& source, | 36 const content::NotificationSource& source, |
40 const content::NotificationDetails& details) OVERRIDE; | 37 const content::NotificationDetails& details) OVERRIDE; |
41 | 38 |
42 // content::WebContentsObserver | |
43 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | |
44 | |
45 protected: | 39 protected: |
46 explicit ShellWindow(ExtensionHost* host_); | 40 explicit ShellWindow(ExtensionHost* host_); |
47 virtual ~ShellWindow(); | 41 virtual ~ShellWindow(); |
48 | 42 |
49 // Instantiates a platform-specific ShellWindow subclass (one implementation | 43 // Instantiates a platform-specific ShellWindow subclass (one implementation |
50 // per platform). Public users of ShellWindow should use ShellWindow::Create. | 44 // per platform). Public users of ShellWindow should use ShellWindow::Create. |
51 static ShellWindow* CreateShellWindow(ExtensionHost* host); | 45 static ShellWindow* CreateShellWindow(ExtensionHost* host); |
52 | 46 |
53 scoped_ptr<ExtensionHost> host_; | 47 scoped_ptr<ExtensionHost> host_; |
54 | 48 |
55 content::NotificationRegistrar registrar_; | 49 content::NotificationRegistrar registrar_; |
56 | 50 |
57 private: | 51 private: |
58 // Disable NPAPI plugins for this shell window. | |
59 void DisableNPAPIPlugins(); | |
60 | |
61 // Clear information about disabled NPAPI plugins for this shell window. | |
62 void ClearDisabledNPAPIPlugins(); | |
63 | |
64 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 52 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
65 }; | 53 }; |
66 | 54 |
67 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 55 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
OLD | NEW |