| 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/string16.h" | 13 #include "base/string16.h" |
| 13 #include "chrome/browser/command_updater.h" | 14 #include "chrome/browser/command_updater.h" |
| 14 #include "chrome/browser/command_updater_delegate.h" | 15 #include "chrome/browser/command_updater_delegate.h" |
| 15 #include "chrome/browser/extensions/image_loading_tracker.h" | |
| 16 #include "chrome/browser/sessions/session_id.h" | 16 #include "chrome/browser/sessions/session_id.h" |
| 17 #include "chrome/browser/ui/base_window.h" | 17 #include "chrome/browser/ui/base_window.h" |
| 18 #include "chrome/browser/ui/panels/panel_constants.h" | 18 #include "chrome/browser/ui/panels/panel_constants.h" |
| 19 #include "content/public/browser/notification_observer.h" | 19 #include "content/public/browser/notification_observer.h" |
| 20 #include "content/public/browser/notification_registrar.h" | 20 #include "content/public/browser/notification_registrar.h" |
| 21 #include "ui/gfx/image/image.h" | 21 #include "ui/gfx/image/image.h" |
| 22 #include "ui/gfx/rect.h" | 22 #include "ui/gfx/rect.h" |
| 23 | 23 |
| 24 class GURL; | 24 class GURL; |
| 25 class NativePanel; | 25 class NativePanel; |
| (...skipping 17 matching lines...) Expand all Loading... |
| 43 // This class gets the first crack at all the BaseWindow calls for Panels and | 43 // This class gets the first crack at all the BaseWindow calls for Panels and |
| 44 // does one or more of the following: | 44 // does one or more of the following: |
| 45 // - Do nothing. The function is not relevant to Panels. | 45 // - Do nothing. The function is not relevant to Panels. |
| 46 // - Do Panel specific platform independent processing and then invoke the | 46 // - Do Panel specific platform independent processing and then invoke the |
| 47 // function on the platform specific member. For example, restrict panel | 47 // function on the platform specific member. For example, restrict panel |
| 48 // size to certain limits. | 48 // size to certain limits. |
| 49 // - Invoke an appropriate PanelManager function to do stuff that might affect | 49 // - Invoke an appropriate PanelManager function to do stuff that might affect |
| 50 // other Panels. For example deleting a panel would rearrange other panels. | 50 // other Panels. For example deleting a panel would rearrange other panels. |
| 51 class Panel : public BaseWindow, | 51 class Panel : public BaseWindow, |
| 52 public CommandUpdaterDelegate, | 52 public CommandUpdaterDelegate, |
| 53 public content::NotificationObserver, | 53 public content::NotificationObserver { |
| 54 public ImageLoadingTracker::Observer { | |
| 55 public: | 54 public: |
| 56 enum ExpansionState { | 55 enum ExpansionState { |
| 57 // The panel is fully expanded with both title-bar and the client-area. | 56 // The panel is fully expanded with both title-bar and the client-area. |
| 58 EXPANDED, | 57 EXPANDED, |
| 59 // The panel is shown with the title-bar only. | 58 // The panel is shown with the title-bar only. |
| 60 TITLE_ONLY, | 59 TITLE_ONLY, |
| 61 // The panel is shown with 3-pixel line. | 60 // The panel is shown with 3-pixel line. |
| 62 MINIMIZED | 61 MINIMIZED |
| 63 }; | 62 }; |
| 64 | 63 |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 friend class PanelManager; | 314 friend class PanelManager; |
| 316 friend class PanelBrowserTest; | 315 friend class PanelBrowserTest; |
| 317 | 316 |
| 318 enum MaxSizePolicy { | 317 enum MaxSizePolicy { |
| 319 // Default maximum size is proportional to the work area. | 318 // Default maximum size is proportional to the work area. |
| 320 DEFAULT_MAX_SIZE, | 319 DEFAULT_MAX_SIZE, |
| 321 // Custom maximum size is used when the panel is resized by the user. | 320 // Custom maximum size is used when the panel is resized by the user. |
| 322 CUSTOM_MAX_SIZE | 321 CUSTOM_MAX_SIZE |
| 323 }; | 322 }; |
| 324 | 323 |
| 325 // ImageLoadingTracker::Observer implementation. | 324 void OnImageLoaded(const gfx::Image& image); |
| 326 virtual void OnImageLoaded(const gfx::Image& image, | |
| 327 const std::string& extension_id, | |
| 328 int index) OVERRIDE; | |
| 329 | 325 |
| 330 // Initialize state for all supported commands. | 326 // Initialize state for all supported commands. |
| 331 void InitCommandState(); | 327 void InitCommandState(); |
| 332 | 328 |
| 333 // Configures the renderer for auto resize (if auto resize is enabled). | 329 // Configures the renderer for auto resize (if auto resize is enabled). |
| 334 void ConfigureAutoResize(content::WebContents* web_contents); | 330 void ConfigureAutoResize(content::WebContents* web_contents); |
| 335 | 331 |
| 336 // Load the app's image, firing a load state change when loaded. | 332 // Load the app's image, firing a load state change when loaded. |
| 337 void UpdateAppIcon(); | 333 void UpdateAppIcon(); |
| 338 | 334 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 ExpansionState expansion_state_; | 379 ExpansionState expansion_state_; |
| 384 | 380 |
| 385 // The CommandUpdater manages the window commands. | 381 // The CommandUpdater manages the window commands. |
| 386 CommandUpdater command_updater_; | 382 CommandUpdater command_updater_; |
| 387 | 383 |
| 388 content::NotificationRegistrar registrar_; | 384 content::NotificationRegistrar registrar_; |
| 389 const SessionID session_id_; | 385 const SessionID session_id_; |
| 390 scoped_ptr<extensions::WindowController> extension_window_controller_; | 386 scoped_ptr<extensions::WindowController> extension_window_controller_; |
| 391 scoped_ptr<PanelHost> panel_host_; | 387 scoped_ptr<PanelHost> panel_host_; |
| 392 | 388 |
| 393 // Used for loading app_icon_. | |
| 394 scoped_ptr<ImageLoadingTracker> app_icon_loader_; | |
| 395 | |
| 396 // Icon showed in the task bar. | 389 // Icon showed in the task bar. |
| 397 gfx::Image app_icon_; | 390 gfx::Image app_icon_; |
| 398 | 391 |
| 392 base::WeakPtrFactory<Panel> image_loader_ptr_factory_; |
| 393 |
| 399 DISALLOW_COPY_AND_ASSIGN(Panel); | 394 DISALLOW_COPY_AND_ASSIGN(Panel); |
| 400 }; | 395 }; |
| 401 | 396 |
| 402 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 397 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| OLD | NEW |