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