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

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: fix 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 #include "ui/gfx/geometry/size.h"
oshima 2014/05/30 16:22:51 nit: this can be forward decl, i thin.
Jun Mukai 2014/05/30 19:57:47 Done.
13 14
14 #if defined(OS_CHROMEOS) 15 #if defined(OS_CHROMEOS)
15 #include "ui/display/chromeos/display_configurator.h" 16 #include "ui/display/chromeos/display_configurator.h"
16 #endif 17 #endif
17 18
18 namespace aura { 19 namespace aura {
19 class TestScreen; 20 class TestScreen;
21 class Window;
20 class WindowTreeHost; 22 class WindowTreeHost;
23 namespace client {
24 class DefaultCaptureClient;
25 class FocusClient;
26 }
21 } 27 }
22 28
23 namespace content { 29 namespace content {
24 class BrowserContext; 30 class BrowserContext;
25 } 31 }
26 32
27 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
28 namespace ui { 34 namespace ui {
29 class UserActivityPowerManagerNotifier; 35 class UserActivityPowerManagerNotifier;
30 } 36 }
31 #endif 37 #endif
32 38
33 namespace wm { 39 namespace wm {
34 class CursorManager; 40 class CursorManager;
41 class CompoundEventFilter;
James Cook 2014/05/30 17:30:18 nit: alphabetize
Jun Mukai 2014/05/30 19:57:47 Done.
42 class InputMethodEventFilter;
35 class UserActivityDetector; 43 class UserActivityDetector;
36 class WMTestHelper;
37 } 44 }
38 45
39 namespace apps { 46 namespace apps {
40 47
41 class ShellAppWindow; 48 class ShellAppWindow;
42 49
43 // Handles desktop-related tasks for app_shell. 50 // Handles desktop-related tasks for app_shell.
44 class ShellDesktopController 51 class ShellDesktopController : public aura::client::WindowTreeClient,
45 #if defined(OS_CHROMEOS) 52 #if defined(OS_CHROMEOS)
46 : public ui::DisplayConfigurator::Observer 53 public ui::DisplayConfigurator::Observer,
47 #endif 54 #endif
48 { 55 public aura::WindowTreeHostObserver {
oshima 2014/05/30 16:22:51 nit: move WTHO before ui::DisplayConfigurator::Obs
Jun Mukai 2014/05/30 19:57:47 Done.
49 public: 56 public:
50 ShellDesktopController(); 57 ShellDesktopController();
51 virtual ~ShellDesktopController(); 58 virtual ~ShellDesktopController();
52 59
53 // Returns the single instance of the desktop. (Stateless functions like 60 // Returns the single instance of the desktop. (Stateless functions like
54 // ShellAppWindowCreateFunction need to be able to access the desktop, so 61 // ShellAppWindowCreateFunction need to be able to access the desktop, so
55 // we need a singleton somewhere). 62 // we need a singleton somewhere).
56 static ShellDesktopController* instance(); 63 static ShellDesktopController* instance();
57 64
65 // Creates the window that hosts the app.
66 void CreateRootWindow();
67
58 // Creates a new app window and adds it to the desktop. The desktop maintains 68 // Creates a new app window and adds it to the desktop. The desktop maintains
59 // ownership of the window. 69 // ownership of the window.
60 ShellAppWindow* CreateAppWindow(content::BrowserContext* context); 70 ShellAppWindow* CreateAppWindow(content::BrowserContext* context);
61 71
62 // Closes and destroys the app window. 72 // Closes and destroys the app window.
63 void CloseAppWindow(); 73 void CloseAppWindow();
64 74
65 // Returns the host for the Aura window tree. 75 // Overridden from aura::client::WindowTreeClient:
66 aura::WindowTreeHost* GetWindowTreeHost(); 76 virtual aura::Window* GetDefaultParent(aura::Window* context,
77 aura::Window* window,
78 const gfx::Rect& bounds) OVERRIDE;
67 79
68 #if defined(OS_CHROMEOS) 80 #if defined(OS_CHROMEOS)
69 // ui::DisplayConfigurator::Observer overrides. 81 // ui::DisplayConfigurator::Observer overrides.
70 virtual void OnDisplayModeChanged(const std::vector< 82 virtual void OnDisplayModeChanged(const std::vector<
71 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE; 83 ui::DisplayConfigurator::DisplayState>& displays) OVERRIDE;
72 #endif 84 #endif
73 85
86 // aura::WindowTreeHostObserver overrides:
87 virtual void OnHostCloseRequested(const aura::WindowTreeHost* host) OVERRIDE;
88
89 aura::WindowTreeHost* host() {
James Cook 2014/05/30 17:30:18 optional nit: move up near instance() because it i
Jun Mukai 2014/05/30 19:57:47 Done.
90 return host_.get();
91 };
92
93 protected:
94 // Creates and sets the aura clients and window manager stuffs. Subclass may
James Cook 2014/05/30 17:30:18 nit: stuffs -> stuff
Jun Mukai 2014/05/30 19:57:47 Done.
95 // initialize different sets of the clients.
96 virtual void InitWindowManager();
97
74 private: 98 private:
75 // Creates the window that hosts the app.
76 void CreateRootWindow();
77
78 // Closes and destroys the root window hosting the app. 99 // Closes and destroys the root window hosting the app.
79 void DestroyRootWindow(); 100 void DestroyRootWindow();
80 101
81 // Returns the dimensions (in pixels) of the primary display, or an empty size 102 // 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. 103 // if the dimensions can't be determined or no display is connected.
83 gfx::Size GetPrimaryDisplaySize(); 104 gfx::Size GetPrimaryDisplaySize();
84 105
85 #if defined(OS_CHROMEOS) 106 #if defined(OS_CHROMEOS)
86 scoped_ptr<ui::DisplayConfigurator> display_configurator_; 107 scoped_ptr<ui::DisplayConfigurator> display_configurator_;
87 #endif 108 #endif
88 109
89 // Enable a minimal set of views::corewm to be initialized. 110 scoped_ptr<aura::TestScreen> test_screen_;
90 scoped_ptr<wm::WMTestHelper> wm_test_helper_;
91 111
92 scoped_ptr<aura::TestScreen> test_screen_; 112 scoped_ptr<aura::WindowTreeHost> host_;
113
114 scoped_ptr<wm::CompoundEventFilter> root_window_event_filter_;
115
116 scoped_ptr<aura::client::DefaultCaptureClient> capture_client_;
117
118 scoped_ptr<wm::InputMethodEventFilter> input_method_filter_;
119
120 scoped_ptr<aura::client::FocusClient> focus_client_;
93 121
94 scoped_ptr<wm::CursorManager> cursor_manager_; 122 scoped_ptr<wm::CursorManager> cursor_manager_;
95 123
96 scoped_ptr<wm::UserActivityDetector> user_activity_detector_; 124 scoped_ptr<wm::UserActivityDetector> user_activity_detector_;
97 #if defined(OS_CHROMEOS) 125 #if defined(OS_CHROMEOS)
98 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_; 126 scoped_ptr<ui::UserActivityPowerManagerNotifier> user_activity_notifier_;
99 #endif 127 #endif
100 128
101 // The desktop supports a single app window. 129 // The desktop supports a single app window.
102 scoped_ptr<ShellAppWindow> app_window_; 130 scoped_ptr<ShellAppWindow> app_window_;
103 131
104 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController); 132 DISALLOW_COPY_AND_ASSIGN(ShellDesktopController);
105 }; 133 };
106 134
107 } // namespace apps 135 } // namespace apps
108 136
109 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_ 137 #endif // APPS_SHELL_BROWSER_SHELL_DESKTOP_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698