Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(178)

Side by Side Diff: apps/shell/browser/shell_desktop_controller.h

Issue 308783002: Removes the dependency to WMTestHelper from app shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/client/window_tree_client.h"
11 #include "ui/aura/window_tree_host_observer.h" 12 #include "ui/aura/window_tree_host_observer.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/display_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 Window;
20 class WindowTreeHost; 21 class WindowTreeHost;
22 namespace client {
23 class DefaultCaptureClient;
24 class FocusClient;
25 }
21 } 26 }
22 27
23 namespace content { 28 namespace content {
24 class BrowserContext; 29 class BrowserContext;
25 } 30 }
26 31
32 namespace gfx {
33 class Size;
34 }
35
27 #if defined(OS_CHROMEOS) 36 #if defined(OS_CHROMEOS)
28 namespace ui { 37 namespace ui {
29 class UserActivityPowerManagerNotifier; 38 class UserActivityPowerManagerNotifier;
30 } 39 }
31 #endif 40 #endif
32 41
33 namespace wm { 42 namespace wm {
43 class CompoundEventFilter;
34 class CursorManager; 44 class CursorManager;
45 class InputMethodEventFilter;
35 class UserActivityDetector; 46 class UserActivityDetector;
36 class WMTestHelper;
37 } 47 }
38 48
39 namespace apps { 49 namespace apps {
40 50
41 class ShellAppWindow; 51 class ShellAppWindow;
42 52
43 // Handles desktop-related tasks for app_shell. 53 // Handles desktop-related tasks for app_shell.
44 class ShellDesktopController 54 class ShellDesktopController : public aura::client::WindowTreeClient,
55 public aura::WindowTreeHostObserver
45 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
46 : public ui::DisplayConfigurator::Observer 57 ,
58 public ui::DisplayConfigurator::Observer
47 #endif 59 #endif
48 { 60 {
49 public: 61 public:
50 ShellDesktopController(); 62 ShellDesktopController();
51 virtual ~ShellDesktopController(); 63 virtual ~ShellDesktopController();
52 64
53 // Returns the single instance of the desktop. (Stateless functions like 65 // Returns the single instance of the desktop. (Stateless functions like
54 // ShellAppWindowCreateFunction need to be able to access the desktop, so 66 // ShellAppWindowCreateFunction need to be able to access the desktop, so
55 // we need a singleton somewhere). 67 // we need a singleton somewhere).
56 static ShellDesktopController* instance(); 68 static ShellDesktopController* instance();
57 69
70 aura::WindowTreeHost* host() { return host_.get(); }
71
72 // Creates the window that hosts the app.
73 void CreateRootWindow();
74
58 // Creates a new app window and adds it to the desktop. The desktop maintains 75 // Creates a new app window and adds it to the desktop. The desktop maintains
59 // ownership of the window. 76 // ownership of the window.
60 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); 77 ShellAppWindow* CreateAppWindow(content::BrowserContext* context);
61 78
62 // Closes and destroys the app window. 79 // Closes and destroys the app window.
63 void CloseAppWindow(); 80 void CloseAppWindow();
64 81
65 // Returns the host for the Aura window tree. 82 // Overridden from aura::client::WindowTreeClient:
66 aura::WindowTreeHost* GetWindowTreeHost(); 83 virtual aura::Window* GetDefaultParent(aura::Window* context,
84 aura::Window* window,
85 const gfx::Rect& bounds) OVERRIDE;
67 86
68 #if defined(OS_CHROMEOS) 87 #if defined(OS_CHROMEOS)
69 // ui::DisplayConfigurator::Observer overrides. 88 // ui::DisplayConfigurator::Observer overrides.
70 virtual void OnDisplayModeChanged(const std::vector< 89 virtual void OnDisplayModeChanged(const std::vector<
71 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE; 90 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE;
72 #endif 91 #endif
73 92
93 // aura::WindowTreeHostObserver overrides:
94 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE;
95
96 protected:
97 // Creates and sets the aura clients and window manager stuff. Subclass may
98 // initialize different sets of the clients.
99 virtual void InitWindowManager();
100
74 private: 101 private:
75 // Creates the window that hosts the app.
76 void CreateRootWindow();
77
78 // Closes and destroys the root window hosting the app. 102 // Closes and destroys the root window hosting the app.
79 void DestroyRootWindow(); 103 void DestroyRootWindow();
80 104
81 // Returns the dimensions (in pixels) of the primary display, or an empty size 105 // Returns the dimensions (in pixels) of the primary display, or an empty size
82 // if the dimensions can't be determined or no display is connected. 106 // if the dimensions can't be determined or no display is connected.
83 gfx::Size GetPrimaryDisplaySize(); 107 gfx::Size GetPrimaryDisplaySize();
84 108
85 #if defined(OS_CHROMEOS) 109 #if defined(OS_CHROMEOS)
86 scoped_ptr<ui::DisplayConfigurator> display_configurator_; 110 scoped_ptr<ui::DisplayConfigurator> display_configurator_;
87 #endif 111 #endif
88 112
89 // Enable a minimal set of views::corewm to be initialized. 113 scoped_ptr<aura::TestScreen> test_screen_;
90 scoped_ptr<wm::WMTestHelper> wm_test_helper_;
91 114
92 scoped_ptr<aura::TestScreen> test_screen_; 115 scoped_ptr<aura::WindowTreeHost> host_;
116
117 scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
118
119 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
120
121 scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
122
123 scoped_ptr<aura::client::FocusClient> focus_client_;
93 124
94 scoped_ptr<wm::CursorManager> cursor_manager_; 125 scoped_ptr<wm::CursorManager> cursor_manager_;
95 126
96 scoped_ptr<wm::UserActivityDetector> user_activity_detector_; 127 scoped_ptr<wm::UserActivityDetector> user_activity_detector_;
97 #if defined(OS_CHROMEOS) 128 #if defined(OS_CHROMEOS)
98 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; 129 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
99 #endif 130 #endif
100 131
101 // The desktop supports a single app window. 132 // The desktop supports a single app window.
102 scoped_ptr<ShellAppWindow> app_window_; 133 scoped_ptr<ShellAppWindow> app_window_;
103 134
104 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); 135 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController);
105 }; 136 };
106 137
107 } // namespace apps 138 } // namespace apps
108 139
109 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ 140 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
OLDNEW
« no previous file with comments | « apps/shell/browser/shell_browser_main_parts.cc ('k') | apps/shell/browser/shell_desktop_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698