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_PANELS_PANEL_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
14 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_updater.h" |
15 #include "chrome/browser/command_updater_delegate.h" | 15 #include "chrome/browser/command_updater_delegate.h" |
16 #include "chrome/browser/ui/panels/panel_constants.h" | 16 #include "chrome/browser/ui/panels/panel_constants.h" |
17 #include "components/sessions/session_id.h" | 17 #include "components/sessions/session_id.h" |
18 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
19 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
20 #include "content/public/browser/web_contents_observer.h" | |
20 #include "extensions/browser/extension_registry_observer.h" | 21 #include "extensions/browser/extension_registry_observer.h" |
21 #include "ui/base/base_window.h" | 22 #include "ui/base/base_window.h" |
22 #include "ui/gfx/geometry/rect.h" | 23 #include "ui/gfx/geometry/rect.h" |
23 #include "ui/gfx/image/image.h" | 24 #include "ui/gfx/image/image.h" |
24 | 25 |
25 class GURL; | 26 class GURL; |
26 class NativePanel; | 27 class NativePanel; |
27 class PanelCollection; | 28 class PanelCollection; |
28 class PanelHost; | 29 class PanelHost; |
29 class PanelManager; | 30 class PanelManager; |
30 class Profile; | 31 class Profile; |
31 class StackedPanelCollection; | 32 class StackedPanelCollection; |
32 | 33 |
33 namespace content { | 34 namespace content { |
35 class RenderViewHost; | |
Avi (use Gerrit)
2015/05/11 19:05:00
If this is only used for the WCO override, can't y
lazyboy
2015/05/11 19:22:53
Yes, thanks.
Done.
| |
34 class WebContents; | 36 class WebContents; |
35 struct NativeWebKeyboardEvent; | 37 struct NativeWebKeyboardEvent; |
36 } | 38 } |
37 | 39 |
38 namespace extensions { | 40 namespace extensions { |
39 class Extension; | 41 class Extension; |
40 class ExtensionRegistry; | 42 class ExtensionRegistry; |
41 class WindowController; | 43 class WindowController; |
42 } | 44 } |
43 | 45 |
44 // A platform independent implementation of ui::BaseWindow for Panels. | 46 // A platform independent implementation of ui::BaseWindow for Panels. |
45 // This class gets the first crack at all the ui::BaseWindow calls for Panels | 47 // This class gets the first crack at all the ui::BaseWindow calls for Panels |
46 // and does one or more of the following: | 48 // and does one or more of the following: |
47 // - Do nothing. The function is not relevant to Panels. | 49 // - Do nothing. The function is not relevant to Panels. |
48 // - Do Panel specific platform independent processing and then invoke the | 50 // - Do Panel specific platform independent processing and then invoke the |
49 // function on the platform specific member. For example, restrict panel | 51 // function on the platform specific member. For example, restrict panel |
50 // size to certain limits. | 52 // size to certain limits. |
51 // - Invoke an appropriate PanelManager function to do stuff that might affect | 53 // - Invoke an appropriate PanelManager function to do stuff that might affect |
52 // other Panels. For example deleting a panel would rearrange other panels. | 54 // other Panels. For example deleting a panel would rearrange other panels. |
53 class Panel : public ui::BaseWindow, | 55 class Panel : public ui::BaseWindow, |
54 public CommandUpdaterDelegate, | 56 public CommandUpdaterDelegate, |
55 public content::NotificationObserver, | 57 public content::NotificationObserver, |
58 public content::WebContentsObserver, | |
56 public extensions::ExtensionRegistryObserver { | 59 public extensions::ExtensionRegistryObserver { |
57 public: | 60 public: |
58 enum ExpansionState { | 61 enum ExpansionState { |
59 // The panel is fully expanded with both title-bar and the client-area. | 62 // The panel is fully expanded with both title-bar and the client-area. |
60 EXPANDED, | 63 EXPANDED, |
61 // The panel is shown with the title-bar only. | 64 // The panel is shown with the title-bar only. |
62 TITLE_ONLY, | 65 TITLE_ONLY, |
63 // The panel is shown with 3-pixel line. | 66 // The panel is shown with 3-pixel line. |
64 MINIMIZED | 67 MINIMIZED |
65 }; | 68 }; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
140 | 143 |
141 // Overridden from CommandUpdaterDelegate: | 144 // Overridden from CommandUpdaterDelegate: |
142 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition disposition) | 145 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition disposition) |
143 override; | 146 override; |
144 | 147 |
145 // content::NotificationObserver overrides. | 148 // content::NotificationObserver overrides. |
146 void Observe(int type, | 149 void Observe(int type, |
147 const content::NotificationSource& source, | 150 const content::NotificationSource& source, |
148 const content::NotificationDetails& details) override; | 151 const content::NotificationDetails& details) override; |
149 | 152 |
153 // content::WebContentsObserver overrides. | |
154 void RenderViewHostChanged(content::RenderViewHost* old_host, | |
155 content::RenderViewHost* new_host) override; | |
156 | |
150 // extensions::ExtensionRegistryObserver. | 157 // extensions::ExtensionRegistryObserver. |
151 void OnExtensionUnloaded( | 158 void OnExtensionUnloaded( |
152 content::BrowserContext* browser_context, | 159 content::BrowserContext* browser_context, |
153 const extensions::Extension* extension, | 160 const extensions::Extension* extension, |
154 extensions::UnloadedExtensionInfo::Reason reason) override; | 161 extensions::UnloadedExtensionInfo::Reason reason) override; |
155 | 162 |
156 // Construct a native panel implementation. | 163 // Construct a native panel implementation. |
157 static NativePanel* CreateNativePanel(Panel* panel, | 164 static NativePanel* CreateNativePanel(Panel* panel, |
158 const gfx::Rect& bounds, | 165 const gfx::Rect& bounds, |
159 bool always_on_top); | 166 bool always_on_top); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
400 | 407 |
401 // Icon showed in the task bar. | 408 // Icon showed in the task bar. |
402 gfx::Image app_icon_; | 409 gfx::Image app_icon_; |
403 | 410 |
404 base::WeakPtrFactory<Panel> image_loader_ptr_factory_; | 411 base::WeakPtrFactory<Panel> image_loader_ptr_factory_; |
405 | 412 |
406 DISALLOW_COPY_AND_ASSIGN(Panel); | 413 DISALLOW_COPY_AND_ASSIGN(Panel); |
407 }; | 414 }; |
408 | 415 |
409 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 416 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
OLD | NEW |