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; |
(...skipping 16 matching lines...) Expand all Loading... |
46 // and does one or more of the following: | 47 // and does one or more of the following: |
47 // - Do nothing. The function is not relevant to Panels. | 48 // - Do nothing. The function is not relevant to Panels. |
48 // - Do Panel specific platform independent processing and then invoke the | 49 // - Do Panel specific platform independent processing and then invoke the |
49 // function on the platform specific member. For example, restrict panel | 50 // function on the platform specific member. For example, restrict panel |
50 // size to certain limits. | 51 // size to certain limits. |
51 // - Invoke an appropriate PanelManager function to do stuff that might affect | 52 // - Invoke an appropriate PanelManager function to do stuff that might affect |
52 // other Panels. For example deleting a panel would rearrange other panels. | 53 // other Panels. For example deleting a panel would rearrange other panels. |
53 class Panel : public ui::BaseWindow, | 54 class Panel : public ui::BaseWindow, |
54 public CommandUpdaterDelegate, | 55 public CommandUpdaterDelegate, |
55 public content::NotificationObserver, | 56 public content::NotificationObserver, |
| 57 public content::WebContentsObserver, |
56 public extensions::ExtensionRegistryObserver { | 58 public extensions::ExtensionRegistryObserver { |
57 public: | 59 public: |
58 enum ExpansionState { | 60 enum ExpansionState { |
59 // The panel is fully expanded with both title-bar and the client-area. | 61 // The panel is fully expanded with both title-bar and the client-area. |
60 EXPANDED, | 62 EXPANDED, |
61 // The panel is shown with the title-bar only. | 63 // The panel is shown with the title-bar only. |
62 TITLE_ONLY, | 64 TITLE_ONLY, |
63 // The panel is shown with 3-pixel line. | 65 // The panel is shown with 3-pixel line. |
64 MINIMIZED | 66 MINIMIZED |
65 }; | 67 }; |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 | 142 |
141 // Overridden from CommandUpdaterDelegate: | 143 // Overridden from CommandUpdaterDelegate: |
142 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition disposition) | 144 void ExecuteCommandWithDisposition(int id, WindowOpenDisposition disposition) |
143 override; | 145 override; |
144 | 146 |
145 // content::NotificationObserver overrides. | 147 // content::NotificationObserver overrides. |
146 void Observe(int type, | 148 void Observe(int type, |
147 const content::NotificationSource& source, | 149 const content::NotificationSource& source, |
148 const content::NotificationDetails& details) override; | 150 const content::NotificationDetails& details) override; |
149 | 151 |
| 152 // content::WebContentsObserver overrides. |
| 153 void RenderViewHostChanged(content::RenderViewHost* old_host, |
| 154 content::RenderViewHost* new_host) override; |
| 155 |
150 // extensions::ExtensionRegistryObserver. | 156 // extensions::ExtensionRegistryObserver. |
151 void OnExtensionUnloaded( | 157 void OnExtensionUnloaded( |
152 content::BrowserContext* browser_context, | 158 content::BrowserContext* browser_context, |
153 const extensions::Extension* extension, | 159 const extensions::Extension* extension, |
154 extensions::UnloadedExtensionInfo::Reason reason) override; | 160 extensions::UnloadedExtensionInfo::Reason reason) override; |
155 | 161 |
156 // Construct a native panel implementation. | 162 // Construct a native panel implementation. |
157 static NativePanel* CreateNativePanel(Panel* panel, | 163 static NativePanel* CreateNativePanel(Panel* panel, |
158 const gfx::Rect& bounds, | 164 const gfx::Rect& bounds, |
159 bool always_on_top); | 165 bool always_on_top); |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
400 | 406 |
401 // Icon showed in the task bar. | 407 // Icon showed in the task bar. |
402 gfx::Image app_icon_; | 408 gfx::Image app_icon_; |
403 | 409 |
404 base::WeakPtrFactory<Panel> image_loader_ptr_factory_; | 410 base::WeakPtrFactory<Panel> image_loader_ptr_factory_; |
405 | 411 |
406 DISALLOW_COPY_AND_ASSIGN(Panel); | 412 DISALLOW_COPY_AND_ASSIGN(Panel); |
407 }; | 413 }; |
408 | 414 |
409 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 415 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
OLD | NEW |