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 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/extensions/extension_function_dispatcher.h" | 9 #include "chrome/browser/extensions/extension_function_dispatcher.h" |
10 #include "chrome/browser/sessions/session_id.h" | 10 #include "chrome/browser/sessions/session_id.h" |
11 #include "chrome/browser/ui/base_window.h" | 11 #include "chrome/browser/ui/base_window.h" |
12 #include "content/public/browser/notification_observer.h" | 12 #include "content/public/browser/notification_observer.h" |
13 #include "content/public/browser/notification_registrar.h" | 13 #include "content/public/browser/notification_registrar.h" |
14 #include "content/public/browser/web_contents_delegate.h" | 14 #include "content/public/browser/web_contents_delegate.h" |
15 #include "content/public/browser/web_contents_observer.h" | 15 #include "content/public/browser/web_contents_observer.h" |
16 #include "content/public/common/console_message_level.h" | 16 #include "content/public/common/console_message_level.h" |
17 #include "ui/gfx/rect.h" | 17 #include "ui/gfx/rect.h" |
18 | 18 |
19 class GURL; | 19 class GURL; |
20 class Profile; | 20 class Profile; |
21 class TabContents; | 21 class TabContents; |
22 | 22 |
23 namespace content { | 23 namespace content { |
24 class WebContents; | 24 class WebContents; |
25 } | 25 } |
26 | 26 |
27 namespace extensions { | 27 namespace extensions { |
28 class Extension; | 28 class Extension; |
29 class WindowController; | 29 class WindowController; |
| 30 class PlatformAppBrowserTest; |
30 } | 31 } |
31 | 32 |
32 // ShellWindow is the type of window used by platform apps. Shell windows | 33 // ShellWindow is the type of window used by platform apps. Shell windows |
33 // have a WebContents but none of the chrome of normal browser windows. | 34 // have a WebContents but none of the chrome of normal browser windows. |
34 class ShellWindow : public content::NotificationObserver, | 35 class ShellWindow : public content::NotificationObserver, |
35 public content::WebContentsDelegate, | 36 public content::WebContentsDelegate, |
36 public content::WebContentsObserver, | 37 public content::WebContentsObserver, |
37 public ExtensionFunctionDispatcher::Delegate, | 38 public ExtensionFunctionDispatcher::Delegate, |
38 public BaseWindow { | 39 public BaseWindow { |
39 public: | 40 public: |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 78 |
78 virtual void SetFullscreen(bool fullscreen) {} | 79 virtual void SetFullscreen(bool fullscreen) {} |
79 virtual bool IsFullscreenOrPending() const; | 80 virtual bool IsFullscreenOrPending() const; |
80 | 81 |
81 // Call to notify ShellRegistry and delete the window. Subclasses should | 82 // Call to notify ShellRegistry and delete the window. Subclasses should |
82 // invoke this method instead of using "delete this". | 83 // invoke this method instead of using "delete this". |
83 void OnNativeClose(); | 84 void OnNativeClose(); |
84 | 85 |
85 private: | 86 private: |
86 // PlatformAppBrowserTest needs access to web_contents() | 87 // PlatformAppBrowserTest needs access to web_contents() |
87 friend class PlatformAppBrowserTest; | 88 friend class extensions::PlatformAppBrowserTest; |
88 | 89 |
89 // Instantiates a platform-specific ShellWindow subclass (one implementation | 90 // Instantiates a platform-specific ShellWindow subclass (one implementation |
90 // per platform). Public users of ShellWindow should use ShellWindow::Create. | 91 // per platform). Public users of ShellWindow should use ShellWindow::Create. |
91 static ShellWindow* CreateImpl(Profile* profile, | 92 static ShellWindow* CreateImpl(Profile* profile, |
92 const extensions::Extension* extension, | 93 const extensions::Extension* extension, |
93 const GURL& url, | 94 const GURL& url, |
94 const CreateParams& params); | 95 const CreateParams& params); |
95 | 96 |
96 // content::WebContentsObserver implementation. | 97 // content::WebContentsObserver implementation. |
97 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 98 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 scoped_ptr<TabContents> contents_; | 153 scoped_ptr<TabContents> contents_; |
153 // web_contents_ is owned by contents_. | 154 // web_contents_ is owned by contents_. |
154 content::WebContents* web_contents_; | 155 content::WebContents* web_contents_; |
155 content::NotificationRegistrar registrar_; | 156 content::NotificationRegistrar registrar_; |
156 ExtensionFunctionDispatcher extension_function_dispatcher_; | 157 ExtensionFunctionDispatcher extension_function_dispatcher_; |
157 | 158 |
158 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 159 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
159 }; | 160 }; |
160 | 161 |
161 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 162 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
OLD | NEW |