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/platform_app_host.h" |
10 #include "chrome/browser/sessions/session_id.h" | 11 #include "chrome/browser/sessions/session_id.h" |
11 #include "chrome/browser/extensions/extension_host.h" | |
12 #include "chrome/browser/ui/base_window.h" | 12 #include "chrome/browser/ui/base_window.h" |
13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
15 | 15 |
16 class Extension; | 16 class Extension; |
17 class ExtensionHost; | |
18 class ExtensionWindowController; | 17 class ExtensionWindowController; |
19 class GURL; | 18 class GURL; |
20 class Profile; | 19 class Profile; |
21 | 20 |
22 namespace content { | 21 namespace content { |
23 class WebContents; | 22 class WebContents; |
24 } | 23 } |
25 | 24 |
26 class ShellWindow : public content::NotificationObserver, | 25 class ShellWindow : public content::NotificationObserver, |
27 public BaseWindow { | 26 public BaseWindow { |
28 public: | 27 public: |
29 content::WebContents* web_contents() const { return host_->host_contents(); } | 28 content::WebContents* web_contents() const { return host_->host_contents(); } |
30 const SessionID& session_id() const { return session_id_; } | 29 const SessionID& session_id() const { return session_id_; } |
31 const ExtensionWindowController* extension_window_controller() const { | 30 const ExtensionWindowController* extension_window_controller() const { |
32 return extension_window_controller_.get(); | 31 return extension_window_controller_.get(); |
33 } | 32 } |
34 | 33 |
35 static ShellWindow* Create(Profile* profile, | 34 static ShellWindow* Create(Profile* profile, |
36 const Extension* extension, | 35 const Extension* extension, |
37 const GURL& url); | 36 const GURL& url); |
38 | 37 |
39 // content::NotificationObserver implementation. | 38 // content::NotificationObserver implementation. |
40 virtual void Observe(int type, | 39 virtual void Observe(int type, |
41 const content::NotificationSource& source, | 40 const content::NotificationSource& source, |
42 const content::NotificationDetails& details) OVERRIDE; | 41 const content::NotificationDetails& details) OVERRIDE; |
43 | 42 |
44 protected: | 43 protected: |
45 explicit ShellWindow(ExtensionHost* host_); | 44 explicit ShellWindow(PlatformAppHost* host_); |
46 virtual ~ShellWindow(); | 45 virtual ~ShellWindow(); |
47 | 46 |
48 // Instantiates a platform-specific ShellWindow subclass (one implementation | 47 // Instantiates a platform-specific ShellWindow subclass (one implementation |
49 // per platform). Public users of ShellWindow should use ShellWindow::Create. | 48 // per platform). Public users of ShellWindow should use ShellWindow::Create. |
50 static ShellWindow* CreateShellWindow(ExtensionHost* host); | 49 static ShellWindow* CreateShellWindow(PlatformAppHost* host); |
51 | 50 |
52 const SessionID session_id_; | 51 const SessionID session_id_; |
53 scoped_ptr<ExtensionHost> host_; | 52 scoped_ptr<PlatformAppHost> host_; |
54 content::NotificationRegistrar registrar_; | 53 content::NotificationRegistrar registrar_; |
55 scoped_ptr<ExtensionWindowController> extension_window_controller_; | 54 scoped_ptr<ExtensionWindowController> extension_window_controller_; |
56 | 55 |
57 private: | 56 private: |
58 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 57 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
59 }; | 58 }; |
60 | 59 |
61 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 60 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
OLD | NEW |