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