| 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/scoped_observer.h" |
| 13 #include "base/strings/string16.h" | 14 #include "base/strings/string16.h" |
| 14 #include "chrome/browser/command_updater.h" | 15 #include "chrome/browser/command_updater.h" |
| 15 #include "chrome/browser/command_updater_delegate.h" | 16 #include "chrome/browser/command_updater_delegate.h" |
| 16 #include "chrome/browser/sessions/session_id.h" | 17 #include "chrome/browser/sessions/session_id.h" |
| 17 #include "chrome/browser/ui/panels/panel_constants.h" | 18 #include "chrome/browser/ui/panels/panel_constants.h" |
| 18 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 19 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "extensions/browser/extension_registry_observer.h" |
| 20 #include "ui/base/base_window.h" | 22 #include "ui/base/base_window.h" |
| 21 #include "ui/gfx/image/image.h" | 23 #include "ui/gfx/image/image.h" |
| 22 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 23 | 25 |
| 24 class GURL; | 26 class GURL; |
| 25 class NativePanel; | 27 class NativePanel; |
| 26 class PanelCollection; | 28 class PanelCollection; |
| 27 class PanelHost; | 29 class PanelHost; |
| 28 class PanelManager; | 30 class PanelManager; |
| 29 class Profile; | 31 class Profile; |
| 30 class StackedPanelCollection; | 32 class StackedPanelCollection; |
| 31 | 33 |
| 32 namespace content { | 34 namespace content { |
| 33 class WebContents; | 35 class WebContents; |
| 34 struct NativeWebKeyboardEvent; | 36 struct NativeWebKeyboardEvent; |
| 35 } | 37 } |
| 36 | 38 |
| 37 namespace extensions { | 39 namespace extensions { |
| 38 class Extension; | 40 class Extension; |
| 41 class ExtensionRegistry; |
| 39 class WindowController; | 42 class WindowController; |
| 40 } | 43 } |
| 41 | 44 |
| 42 // A platform independent implementation of ui::BaseWindow for Panels. | 45 // A platform independent implementation of ui::BaseWindow for Panels. |
| 43 // This class gets the first crack at all the ui::BaseWindow calls for Panels | 46 // This class gets the first crack at all the ui::BaseWindow calls for Panels |
| 44 // and does one or more of the following: | 47 // and does one or more of the following: |
| 45 // - Do nothing. The function is not relevant to Panels. | 48 // - Do nothing. The function is not relevant to Panels. |
| 46 // - Do Panel specific platform independent processing and then invoke the | 49 // - Do Panel specific platform independent processing and then invoke the |
| 47 // function on the platform specific member. For example, restrict panel | 50 // function on the platform specific member. For example, restrict panel |
| 48 // size to certain limits. | 51 // size to certain limits. |
| 49 // - Invoke an appropriate PanelManager function to do stuff that might affect | 52 // - Invoke an appropriate PanelManager function to do stuff that might affect |
| 50 // other Panels. For example deleting a panel would rearrange other panels. | 53 // other Panels. For example deleting a panel would rearrange other panels. |
| 51 class Panel : public ui::BaseWindow, | 54 class Panel : public ui::BaseWindow, |
| 52 public CommandUpdaterDelegate, | 55 public CommandUpdaterDelegate, |
| 53 public content::NotificationObserver { | 56 public content::NotificationObserver, |
| 57 public extensions::ExtensionRegistryObserver { |
| 54 public: | 58 public: |
| 55 enum ExpansionState { | 59 enum ExpansionState { |
| 56 // The panel is fully expanded with both title-bar and the client-area. | 60 // The panel is fully expanded with both title-bar and the client-area. |
| 57 EXPANDED, | 61 EXPANDED, |
| 58 // The panel is shown with the title-bar only. | 62 // The panel is shown with the title-bar only. |
| 59 TITLE_ONLY, | 63 TITLE_ONLY, |
| 60 // The panel is shown with 3-pixel line. | 64 // The panel is shown with 3-pixel line. |
| 61 MINIMIZED | 65 MINIMIZED |
| 62 }; | 66 }; |
| 63 | 67 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 // Overridden from CommandUpdaterDelegate: | 142 // Overridden from CommandUpdaterDelegate: |
| 139 virtual void ExecuteCommandWithDisposition( | 143 virtual void ExecuteCommandWithDisposition( |
| 140 int id, | 144 int id, |
| 141 WindowOpenDisposition disposition) OVERRIDE; | 145 WindowOpenDisposition disposition) OVERRIDE; |
| 142 | 146 |
| 143 // content::NotificationObserver overrides. | 147 // content::NotificationObserver overrides. |
| 144 virtual void Observe(int type, | 148 virtual void Observe(int type, |
| 145 const content::NotificationSource& source, | 149 const content::NotificationSource& source, |
| 146 const content::NotificationDetails& details) OVERRIDE; | 150 const content::NotificationDetails& details) OVERRIDE; |
| 147 | 151 |
| 152 // extensions::ExtensionRegistryObserver implementation. |
| 153 virtual void OnExtensionUnloaded( |
| 154 content::BrowserContext* browser_context, |
| 155 const extensions::Extension* extension, |
| 156 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE; |
| 157 |
| 148 // Construct a native panel implementation. | 158 // Construct a native panel implementation. |
| 149 static NativePanel* CreateNativePanel(Panel* panel, | 159 static NativePanel* CreateNativePanel(Panel* panel, |
| 150 const gfx::Rect& bounds, | 160 const gfx::Rect& bounds, |
| 151 bool always_on_top); | 161 bool always_on_top); |
| 152 | 162 |
| 153 NativePanel* native_panel() const { return native_panel_; } | 163 NativePanel* native_panel() const { return native_panel_; } |
| 154 | 164 |
| 155 // Invoked when the native panel has detected a mouse click on the | 165 // Invoked when the native panel has detected a mouse click on the |
| 156 // panel's titlebar, minimize or restore buttons. Behavior of the | 166 // panel's titlebar, minimize or restore buttons. Behavior of the |
| 157 // click may be modified as indicated by |modifier|. | 167 // click may be modified as indicated by |modifier|. |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 ExpansionState expansion_state_; | 395 ExpansionState expansion_state_; |
| 386 | 396 |
| 387 // The CommandUpdater manages the window commands. | 397 // The CommandUpdater manages the window commands. |
| 388 CommandUpdater command_updater_; | 398 CommandUpdater command_updater_; |
| 389 | 399 |
| 390 content::NotificationRegistrar registrar_; | 400 content::NotificationRegistrar registrar_; |
| 391 const SessionID session_id_; | 401 const SessionID session_id_; |
| 392 scoped_ptr<extensions::WindowController> extension_window_controller_; | 402 scoped_ptr<extensions::WindowController> extension_window_controller_; |
| 393 scoped_ptr<PanelHost> panel_host_; | 403 scoped_ptr<PanelHost> panel_host_; |
| 394 | 404 |
| 405 // Listen to extension unloaded notification. |
| 406 ScopedObserver<extensions::ExtensionRegistry, |
| 407 extensions::ExtensionRegistryObserver> |
| 408 extension_registry_observer_; |
| 409 |
| 395 // Icon showed in the task bar. | 410 // Icon showed in the task bar. |
| 396 gfx::Image app_icon_; | 411 gfx::Image app_icon_; |
| 397 | 412 |
| 398 base::WeakPtrFactory<Panel> image_loader_ptr_factory_; | 413 base::WeakPtrFactory<Panel> image_loader_ptr_factory_; |
| 399 | 414 |
| 400 DISALLOW_COPY_AND_ASSIGN(Panel); | 415 DISALLOW_COPY_AND_ASSIGN(Panel); |
| 401 }; | 416 }; |
| 402 | 417 |
| 403 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 418 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| OLD | NEW |