| 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" |
| 11 #include "ui/aura/window_tree_host_observer.h" | 11 #include "ui/aura/window_tree_host_observer.h" |
| 12 #include "ui/gfx/geometry/size.h" | 12 #include "ui/gfx/geometry/size.h" |
| 13 | 13 |
| 14 #if defined(OS_CHROMEOS) | 14 #if defined(OS_CHROMEOS) |
| 15 #include "ui/display/chromeos/output_configurator.h" | 15 #include "ui/display/chromeos/display_configurator.h" |
| 16 #endif | 16 #endif |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 class TestScreen; | 19 class TestScreen; |
| 20 class WindowTreeHost; | 20 class WindowTreeHost; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace content { | 23 namespace content { |
| 24 class BrowserContext; | 24 class BrowserContext; |
| 25 } | 25 } |
| 26 | 26 |
| 27 namespace wm { | 27 namespace wm { |
| 28 class WMTestHelper; | 28 class WMTestHelper; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace apps { | 31 namespace apps { |
| 32 | 32 |
| 33 class ShellAppWindow; | 33 class ShellAppWindow; |
| 34 | 34 |
| 35 // Handles desktop-related tasks for app_shell. | 35 // Handles desktop-related tasks for app_shell. |
| 36 class ShellDesktopController | 36 class ShellDesktopController |
| 37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
| 38 : public ui::OutputConfigurator::Observer | 38 : public ui::DisplayConfigurator::Observer |
| 39 #endif | 39 #endif |
| 40 { | 40 { |
| 41 public: | 41 public: |
| 42 ShellDesktopController(); | 42 ShellDesktopController(); |
| 43 virtual ~ShellDesktopController(); | 43 virtual ~ShellDesktopController(); |
| 44 | 44 |
| 45 // Returns the single instance of the desktop. (Stateless functions like | 45 // Returns the single instance of the desktop. (Stateless functions like |
| 46 // ShellAppWindowCreateFunction need to be able to access the desktop, so | 46 // ShellAppWindowCreateFunction need to be able to access the desktop, so |
| 47 // we need a singleton somewhere). | 47 // we need a singleton somewhere). |
| 48 static ShellDesktopController* instance(); | 48 static ShellDesktopController* instance(); |
| 49 | 49 |
| 50 // Creates a new app window and adds it to the desktop. The desktop maintains | 50 // Creates a new app window and adds it to the desktop. The desktop maintains |
| 51 // ownership of the window. | 51 // ownership of the window. |
| 52 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); | 52 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); |
| 53 | 53 |
| 54 // Closes and destroys the app window. | 54 // Closes and destroys the app window. |
| 55 void CloseAppWindow(); | 55 void CloseAppWindow(); |
| 56 | 56 |
| 57 // Returns the host for the Aura window tree. | 57 // Returns the host for the Aura window tree. |
| 58 aura::WindowTreeHost* GetWindowTreeHost(); | 58 aura::WindowTreeHost* GetWindowTreeHost(); |
| 59 | 59 |
| 60 #if defined(OS_CHROMEOS) | 60 #if defined(OS_CHROMEOS) |
| 61 // ui::OutputConfigurator::Observer overrides. | 61 // ui::DisplayConfigurator::Observer overrides. |
| 62 virtual void OnDisplayModeChanged( | 62 virtual void OnDisplayModeChanged(const std::vector< |
| 63 const std::vector<ui::OutputConfigurator::DisplayState>& outputs) | 63 ui::DisplayConfigurator::DisplayState>& outputs) OVERRIDE; |
| 64 OVERRIDE; | |
| 65 #endif | 64 #endif |
| 66 | 65 |
| 67 private: | 66 private: |
| 68 // Creates the window that hosts the app. | 67 // Creates the window that hosts the app. |
| 69 void CreateRootWindow(); | 68 void CreateRootWindow(); |
| 70 | 69 |
| 71 // Closes and destroys the root window hosting the app. | 70 // Closes and destroys the root window hosting the app. |
| 72 void DestroyRootWindow(); | 71 void DestroyRootWindow(); |
| 73 | 72 |
| 74 // Returns the dimensions (in pixels) of the primary display, or an empty size | 73 // Returns the dimensions (in pixels) of the primary display, or an empty size |
| 75 // if the dimensions can't be determined or no display is connected. | 74 // if the dimensions can't be determined or no display is connected. |
| 76 gfx::Size GetPrimaryDisplaySize(); | 75 gfx::Size GetPrimaryDisplaySize(); |
| 77 | 76 |
| 78 #if defined(OS_CHROMEOS) | 77 #if defined(OS_CHROMEOS) |
| 79 scoped_ptr<ui::OutputConfigurator> output_configurator_; | 78 scoped_ptr<ui::DisplayConfigurator> display_configurator_; |
| 80 #endif | 79 #endif |
| 81 | 80 |
| 82 // Enable a minimal set of views::corewm to be initialized. | 81 // Enable a minimal set of views::corewm to be initialized. |
| 83 scoped_ptr<wm::WMTestHelper> wm_test_helper_; | 82 scoped_ptr<wm::WMTestHelper> wm_test_helper_; |
| 84 | 83 |
| 85 scoped_ptr<aura::TestScreen> test_screen_; | 84 scoped_ptr<aura::TestScreen> test_screen_; |
| 86 | 85 |
| 87 // The desktop supports a single app window. | 86 // The desktop supports a single app window. |
| 88 scoped_ptr<ShellAppWindow> app_window_; | 87 scoped_ptr<ShellAppWindow> app_window_; |
| 89 | 88 |
| 90 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); | 89 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); |
| 91 }; | 90 }; |
| 92 | 91 |
| 93 } // namespace apps | 92 } // namespace apps |
| 94 | 93 |
| 95 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ | 94 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ |
| OLD | NEW |