| 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/property_bag.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/sessions/session_id.h" | 15 #include "chrome/browser/sessions/session_id.h" |
| 15 #include "chrome/browser/ui/base_window.h" | 16 #include "chrome/browser/ui/base_window.h" |
| 16 #include "chrome/browser/ui/panels/panel_constants.h" | 17 #include "chrome/browser/ui/panels/panel_constants.h" |
| 17 #include "content/public/browser/notification_observer.h" | 18 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 19 #include "content/public/browser/notification_registrar.h" |
| 19 #include "ui/gfx/rect.h" | 20 #include "ui/gfx/rect.h" |
| 20 | 21 |
| 21 class Browser; | 22 class Browser; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 // differently to attract the user's attention. This is the default mode. | 63 // differently to attract the user's attention. This is the default mode. |
| 63 USE_PANEL_ATTENTION = 0x01, | 64 USE_PANEL_ATTENTION = 0x01, |
| 64 // Uses the system attention. On Windows or Linux (depending on Window | 65 // Uses the system attention. On Windows or Linux (depending on Window |
| 65 // Manager), the app icon on taskbar will be flashed. On MacOS, the dock | 66 // Manager), the app icon on taskbar will be flashed. On MacOS, the dock |
| 66 // icon will jump once. | 67 // icon will jump once. |
| 67 USE_SYSTEM_ATTENTION = 0x02 | 68 USE_SYSTEM_ATTENTION = 0x02 |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 virtual ~Panel(); | 71 virtual ~Panel(); |
| 71 | 72 |
| 73 // Helper to retrieve the existing instance that owns a given WebContents. |
| 74 // Returns NULL if there is no such existing instance. |
| 75 // NOTE: This is not intended for general use. It is intended for situations |
| 76 // like callbacks from content, where only a WebContents is available. In the |
| 77 // general case, please do NOT use this; plumb Panels through the chrome/ |
| 78 // code instead of WebContents. |
| 79 static Panel* FromWebContents(content::WebContents* contents); |
| 80 |
| 72 // Returns the PanelManager associated with this panel. | 81 // Returns the PanelManager associated with this panel. |
| 73 PanelManager* manager() const; | 82 PanelManager* manager() const; |
| 74 | 83 |
| 75 const std::string& app_name() const { return app_name_; } | 84 const std::string& app_name() const { return app_name_; } |
| 76 const SessionID& session_id() const { return session_id_; } | 85 const SessionID& session_id() const { return session_id_; } |
| 77 ExtensionWindowController* extension_window_controller() const { | 86 ExtensionWindowController* extension_window_controller() const { |
| 78 return extension_window_controller_.get(); | 87 return extension_window_controller_.get(); |
| 79 } | 88 } |
| 80 const std::string extension_id() const; | 89 const std::string extension_id() const; |
| 81 | 90 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 // provide a title. For extensions, this is usually the application name | 312 // provide a title. For extensions, this is usually the application name |
| 304 // generated from the extension id. | 313 // generated from the extension id. |
| 305 Panel(const std::string& app_name, | 314 Panel(const std::string& app_name, |
| 306 const gfx::Size& min_size, const gfx::Size& max_size); | 315 const gfx::Size& min_size, const gfx::Size& max_size); |
| 307 | 316 |
| 308 private: | 317 private: |
| 309 friend class PanelManager; | 318 friend class PanelManager; |
| 310 friend class PanelBrowserTest; | 319 friend class PanelBrowserTest; |
| 311 friend class OldPanelBrowserTest; | 320 friend class OldPanelBrowserTest; |
| 312 | 321 |
| 322 // Used to retrieve this object from the web_contents, which is placed in |
| 323 // the web contents property bag to avoid adding additional interfaces. |
| 324 static base::PropertyAccessor<Panel*>* property_accessor(); |
| 325 |
| 313 enum MaxSizePolicy { | 326 enum MaxSizePolicy { |
| 314 // Default maximum size is proportional to the work area. | 327 // Default maximum size is proportional to the work area. |
| 315 DEFAULT_MAX_SIZE, | 328 DEFAULT_MAX_SIZE, |
| 316 // Custom maximum size is used when the panel is resized by the user. | 329 // Custom maximum size is used when the panel is resized by the user. |
| 317 CUSTOM_MAX_SIZE | 330 CUSTOM_MAX_SIZE |
| 318 }; | 331 }; |
| 319 | 332 |
| 320 // Initialize state for all supported commands. | 333 // Initialize state for all supported commands. |
| 321 void InitCommandState(); | 334 void InitCommandState(); |
| 322 | 335 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 | 388 |
| 376 content::NotificationRegistrar registrar_; | 389 content::NotificationRegistrar registrar_; |
| 377 const SessionID session_id_; | 390 const SessionID session_id_; |
| 378 scoped_ptr<ExtensionWindowController> extension_window_controller_; | 391 scoped_ptr<ExtensionWindowController> extension_window_controller_; |
| 379 scoped_ptr<PanelHost> panel_host_; | 392 scoped_ptr<PanelHost> panel_host_; |
| 380 | 393 |
| 381 DISALLOW_COPY_AND_ASSIGN(Panel); | 394 DISALLOW_COPY_AND_ASSIGN(Panel); |
| 382 }; | 395 }; |
| 383 | 396 |
| 384 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ | 397 #endif // CHROME_BROWSER_UI_PANELS_PANEL_H_ |
| OLD | NEW |