| 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 ASH_SHELL_H_ | 5 #ifndef ASH_SHELL_H_ |
| 6 #define ASH_SHELL_H_ | 6 #define ASH_SHELL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Shell is a singleton object that presents the Shell API and implements the | 60 // Shell is a singleton object that presents the Shell API and implements the |
| 61 // RootWindow's delegate interface. | 61 // RootWindow's delegate interface. |
| 62 // | 62 // |
| 63 // Upon creation, the Shell sets itself as the RootWindow's delegate, which | 63 // Upon creation, the Shell sets itself as the RootWindow's delegate, which |
| 64 // takes ownership of the Shell. | 64 // takes ownership of the Shell. |
| 65 class ASH_EXPORT Shell { | 65 class ASH_EXPORT Shell { |
| 66 public: | 66 public: |
| 67 // In compact window mode we fill the screen with a single maximized window, | 67 // In compact window mode we fill the screen with a single maximized window, |
| 68 // similar to ChromeOS R17 and earlier. In normal mode we have draggable | 68 // similar to ChromeOS R17 and earlier. In overlapping mode we have draggable |
| 69 // windows. | 69 // windows. In managed mode the workspace arranges windows for the user. |
| 70 enum WindowMode { | 70 enum WindowMode { |
| 71 NORMAL_MODE, | 71 MODE_COMPACT, |
| 72 COMPACT_MODE | 72 MODE_MANAGED, |
| 73 MODE_OVERLAPPING, |
| 73 }; | 74 }; |
| 74 | 75 |
| 75 // A shell must be explicitly created so that it can call |Init()| with the | 76 // A shell must be explicitly created so that it can call |Init()| with the |
| 76 // delegate set. |delegate| can be NULL (if not required for initialization). | 77 // delegate set. |delegate| can be NULL (if not required for initialization). |
| 77 static Shell* CreateInstance(ShellDelegate* delegate); | 78 static Shell* CreateInstance(ShellDelegate* delegate); |
| 78 | 79 |
| 79 // Should never be called before |CreateInstance()|. | 80 // Should never be called before |CreateInstance()|. |
| 80 static Shell* GetInstance(); | 81 static Shell* GetInstance(); |
| 81 | 82 |
| 82 static void DeleteInstance(); | 83 static void DeleteInstance(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 100 // installed or removed. | 101 // installed or removed. |
| 101 void ChangeWindowMode(WindowMode mode); | 102 void ChangeWindowMode(WindowMode mode); |
| 102 | 103 |
| 103 // Returns true if the screen is locked. | 104 // Returns true if the screen is locked. |
| 104 bool IsScreenLocked() const; | 105 bool IsScreenLocked() const; |
| 105 | 106 |
| 106 // Returns true if a modal dialog window is currently open. | 107 // Returns true if a modal dialog window is currently open. |
| 107 bool IsModalWindowOpen() const; | 108 bool IsModalWindowOpen() const; |
| 108 | 109 |
| 109 // See enum WindowMode for details. | 110 // See enum WindowMode for details. |
| 110 bool IsWindowModeCompact() const { return window_mode_ == COMPACT_MODE; } | 111 bool IsWindowModeCompact() const { return window_mode_ == MODE_COMPACT; } |
| 111 | 112 |
| 112 // Creates a default views::NonClientFrameView for use by windows in the | 113 // Creates a default views::NonClientFrameView for use by windows in the |
| 113 // Ash environment. | 114 // Ash environment. |
| 114 views::NonClientFrameView* CreateDefaultNonClientFrameView( | 115 views::NonClientFrameView* CreateDefaultNonClientFrameView( |
| 115 views::Widget* widget); | 116 views::Widget* widget); |
| 116 | 117 |
| 117 AcceleratorController* accelerator_controller() { | 118 AcceleratorController* accelerator_controller() { |
| 118 return accelerator_controller_.get(); | 119 return accelerator_controller_.get(); |
| 119 } | 120 } |
| 120 internal::TooltipController* tooltip_controller() { | 121 internal::TooltipController* tooltip_controller() { |
| (...skipping 30 matching lines...) Expand all Loading... |
| 151 void Init(); | 152 void Init(); |
| 152 | 153 |
| 153 // Returns the appropriate window mode to use based on the primary monitor's | 154 // Returns the appropriate window mode to use based on the primary monitor's |
| 154 // |monitor_size| and the user's |command_line|. | 155 // |monitor_size| and the user's |command_line|. |
| 155 WindowMode ComputeWindowMode(const gfx::Size& monitor_size, | 156 WindowMode ComputeWindowMode(const gfx::Size& monitor_size, |
| 156 CommandLine* command_line) const; | 157 CommandLine* command_line) const; |
| 157 | 158 |
| 158 // Initializes or re-initializes the layout managers and event filters needed | 159 // Initializes or re-initializes the layout managers and event filters needed |
| 159 // to support a given window mode and cleans up the unneeded ones. | 160 // to support a given window mode and cleans up the unneeded ones. |
| 160 void SetupCompactWindowMode(); | 161 void SetupCompactWindowMode(); |
| 161 void SetupNormalWindowMode(); | 162 void SetupNonCompactWindowMode(); |
| 162 | 163 |
| 163 // Sets the LayoutManager of the container with the specified id to NULL. This | 164 // Sets the LayoutManager of the container with the specified id to NULL. This |
| 164 // has the effect of deleting the current LayoutManager. | 165 // has the effect of deleting the current LayoutManager. |
| 165 void ResetLayoutManager(int container_id); | 166 void ResetLayoutManager(int container_id); |
| 166 | 167 |
| 167 static Shell* instance_; | 168 static Shell* instance_; |
| 168 | 169 |
| 169 std::vector<WindowAndBoundsPair> to_restore_; | 170 std::vector<WindowAndBoundsPair> to_restore_; |
| 170 | 171 |
| 171 base::WeakPtrFactory<Shell> method_factory_; | 172 base::WeakPtrFactory<Shell> method_factory_; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 | 204 |
| 204 // Status area with clock, Wi-Fi signal, etc. | 205 // Status area with clock, Wi-Fi signal, etc. |
| 205 views::Widget* status_widget_; | 206 views::Widget* status_widget_; |
| 206 | 207 |
| 207 DISALLOW_COPY_AND_ASSIGN(Shell); | 208 DISALLOW_COPY_AND_ASSIGN(Shell); |
| 208 }; | 209 }; |
| 209 | 210 |
| 210 } // namespace ash | 211 } // namespace ash |
| 211 | 212 |
| 212 #endif // ASH_SHELL_H_ | 213 #endif // ASH_SHELL_H_ |
| OLD | NEW |