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 PlatformAppBrowserTest; |
29 class WindowController; | 30 class WindowController; |
| 31 |
30 struct DraggableRegion; | 32 struct DraggableRegion; |
31 } | 33 } |
32 | 34 |
33 // ShellWindow is the type of window used by platform apps. Shell windows | 35 // ShellWindow is the type of window used by platform apps. Shell windows |
34 // have a WebContents but none of the chrome of normal browser windows. | 36 // have a WebContents but none of the chrome of normal browser windows. |
35 class ShellWindow : public content::NotificationObserver, | 37 class ShellWindow : public content::NotificationObserver, |
36 public content::WebContentsDelegate, | 38 public content::WebContentsDelegate, |
37 public content::WebContentsObserver, | 39 public content::WebContentsObserver, |
38 public ExtensionFunctionDispatcher::Delegate, | 40 public ExtensionFunctionDispatcher::Delegate, |
39 public BaseWindow { | 41 public BaseWindow { |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // Called when the draggable regions are changed. | 84 // Called when the draggable regions are changed. |
83 virtual void UpdateDraggableRegions( | 85 virtual void UpdateDraggableRegions( |
84 const std::vector<extensions::DraggableRegion>& regions) {} | 86 const std::vector<extensions::DraggableRegion>& regions) {} |
85 | 87 |
86 // Call to notify ShellRegistry and delete the window. Subclasses should | 88 // Call to notify ShellRegistry and delete the window. Subclasses should |
87 // invoke this method instead of using "delete this". | 89 // invoke this method instead of using "delete this". |
88 void OnNativeClose(); | 90 void OnNativeClose(); |
89 | 91 |
90 private: | 92 private: |
91 // PlatformAppBrowserTest needs access to web_contents() | 93 // PlatformAppBrowserTest needs access to web_contents() |
92 friend class PlatformAppBrowserTest; | 94 friend class extensions::PlatformAppBrowserTest; |
93 | 95 |
94 // Instantiates a platform-specific ShellWindow subclass (one implementation | 96 // Instantiates a platform-specific ShellWindow subclass (one implementation |
95 // per platform). Public users of ShellWindow should use ShellWindow::Create. | 97 // per platform). Public users of ShellWindow should use ShellWindow::Create. |
96 static ShellWindow* CreateImpl(Profile* profile, | 98 static ShellWindow* CreateImpl(Profile* profile, |
97 const extensions::Extension* extension, | 99 const extensions::Extension* extension, |
98 const GURL& url, | 100 const GURL& url, |
99 const CreateParams& params); | 101 const CreateParams& params); |
100 | 102 |
101 // content::WebContentsObserver implementation. | 103 // content::WebContentsObserver implementation. |
102 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 104 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 scoped_ptr<TabContents> contents_; | 159 scoped_ptr<TabContents> contents_; |
158 // web_contents_ is owned by contents_. | 160 // web_contents_ is owned by contents_. |
159 content::WebContents* web_contents_; | 161 content::WebContents* web_contents_; |
160 content::NotificationRegistrar registrar_; | 162 content::NotificationRegistrar registrar_; |
161 ExtensionFunctionDispatcher extension_function_dispatcher_; | 163 ExtensionFunctionDispatcher extension_function_dispatcher_; |
162 | 164 |
163 DISALLOW_COPY_AND_ASSIGN(ShellWindow); | 165 DISALLOW_COPY_AND_ASSIGN(ShellWindow); |
164 }; | 166 }; |
165 | 167 |
166 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ | 168 #endif // CHROME_BROWSER_UI_EXTENSIONS_SHELL_WINDOW_H_ |
OLD | NEW |