OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ | 5 #ifndef APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ |
6 #define APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ | 6 #define APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 namespace wm { | 42 namespace wm { |
43 class CompoundEventFilter; | 43 class CompoundEventFilter; |
44 class CursorManager; | 44 class CursorManager; |
45 class InputMethodEventFilter; | 45 class InputMethodEventFilter; |
46 class UserActivityDetector; | 46 class UserActivityDetector; |
47 } | 47 } |
48 | 48 |
49 namespace apps { | 49 namespace apps { |
50 | 50 |
51 class ShellAppWindow; | 51 class ShellAppWindow; |
| 52 class ShellAppWindowController; |
52 | 53 |
53 // Handles desktop-related tasks for app_shell. | 54 // Handles desktop-related tasks for app_shell. |
54 class ShellDesktopController : public aura::client::WindowTreeClient, | 55 class ShellDesktopController : public aura::client::WindowTreeClient, |
55 public aura::WindowTreeHostObserver | 56 public aura::WindowTreeHostObserver |
56 #if defined(OS_CHROMEOS) | 57 #if defined(OS_CHROMEOS) |
57 , | 58 , |
58 public ui::DisplayConfigurator::Observer | 59 public ui::DisplayConfigurator::Observer |
59 #endif | 60 #endif |
60 { | 61 { |
61 public: | 62 public: |
62 ShellDesktopController(); | 63 ShellDesktopController(); |
63 virtual ~ShellDesktopController(); | 64 virtual ~ShellDesktopController(); |
64 | 65 |
65 // Returns the single instance of the desktop. (Stateless functions like | 66 // Returns the single instance of the desktop. (Stateless functions like |
66 // ShellAppWindowCreateFunction need to be able to access the desktop, so | 67 // ShellAppWindowCreateFunction need to be able to access the desktop, so |
67 // we need a singleton somewhere). | 68 // we need a singleton somewhere). |
68 static ShellDesktopController* instance(); | 69 static ShellDesktopController* instance(); |
69 | 70 |
70 aura::WindowTreeHost* host() { return host_.get(); } | 71 aura::WindowTreeHost* host() { return host_.get(); } |
71 | 72 |
72 // Creates the window that hosts the app. | 73 // Creates the window that hosts the app. |
73 void CreateRootWindow(); | 74 void CreateRootWindow(); |
74 | 75 |
| 76 // Sets the controller to create/close the app windows. Takes the ownership of |
| 77 // |app_window_controller|. |
| 78 void SetAppWindowController(ShellAppWindowController* app_window_controller); |
| 79 |
75 // Creates a new app window and adds it to the desktop. The desktop maintains | 80 // Creates a new app window and adds it to the desktop. The desktop maintains |
76 // ownership of the window. | 81 // ownership of the window. |
77 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); | 82 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); |
78 | 83 |
79 // Closes and destroys the app window. | 84 // Closes and destroys the app windows. |
80 void CloseAppWindow(); | 85 void CloseAppWindows(); |
81 | 86 |
82 // Overridden from aura::client::WindowTreeClient: | 87 // Overridden from aura::client::WindowTreeClient: |
83 virtual aura::Window* GetDefaultParent(aura::Window* context, | 88 virtual aura::Window* GetDefaultParent(aura::Window* context, |
84 aura::Window* window, | 89 aura::Window* window, |
85 const gfx::Rect& bounds) OVERRIDE; | 90 const gfx::Rect& bounds) OVERRIDE; |
86 | 91 |
87 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
88 // ui::DisplayConfigurator::Observer overrides. | 93 // ui::DisplayConfigurator::Observer overrides. |
89 virtual void OnDisplayModeChanged(const std::vector< | 94 virtual void OnDisplayModeChanged(const std::vector< |
90 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE; | 95 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 scoped_ptr<aura::client::FocusClient> focus_client_; | 128 scoped_ptr<aura::client::FocusClient> focus_client_; |
124 | 129 |
125 scoped_ptr<wm::CursorManager> cursor_manager_; | 130 scoped_ptr<wm::CursorManager> cursor_manager_; |
126 | 131 |
127 scoped_ptr<wm::UserActivityDetector> user_activity_detector_; | 132 scoped_ptr<wm::UserActivityDetector> user_activity_detector_; |
128 #if defined(OS_CHROMEOS) | 133 #if defined(OS_CHROMEOS) |
129 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; | 134 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; |
130 #endif | 135 #endif |
131 | 136 |
132 // The desktop supports a single app window. | 137 // The desktop supports a single app window. |
133 scoped_ptr<ShellAppWindow> app_window_; | 138 scoped_ptr<ShellAppWindowController> app_window_controller_; |
134 | 139 |
135 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); | 140 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); |
136 }; | 141 }; |
137 | 142 |
138 } // namespace apps | 143 } // namespace apps |
139 | 144 |
140 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ | 145 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ |
OLD | NEW |