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

Side by Side Diff: ui/views/mus/mus_client.h

Issue 2759463002: aura-mus: create an interactive ui test for drag and drop. (Closed)
Patch Set: Merge with master Created 3 years, 9 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
« no previous file with comments | « ui/views/mus/interactive_ui_tests_manifest.json ('k') | ui/views/mus/mus_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 UI_VIEWS_MUS_MUS_CLIENT_H_ 5 #ifndef UI_VIEWS_MUS_MUS_CLIENT_H_
6 #define UI_VIEWS_MUS_MUS_CLIENT_H_ 6 #define UI_VIEWS_MUS_MUS_CLIENT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "services/service_manager/public/cpp/identity.h" 15 #include "services/service_manager/public/cpp/identity.h"
16 #include "services/ui/public/interfaces/window_server_test.mojom.h"
16 #include "ui/aura/client/capture_client.h" 17 #include "ui/aura/client/capture_client.h"
17 #include "ui/aura/mus/window_tree_client_delegate.h" 18 #include "ui/aura/mus/window_tree_client_delegate.h"
18 #include "ui/views/mus/mus_export.h" 19 #include "ui/views/mus/mus_export.h"
19 #include "ui/views/mus/screen_mus_delegate.h" 20 #include "ui/views/mus/screen_mus_delegate.h"
20 #include "ui/views/widget/widget.h" 21 #include "ui/views/widget/widget.h"
21 22
22 namespace aura { 23 namespace aura {
23 class PropertyConverter; 24 class PropertyConverter;
24 class Window; 25 class Window;
25 class WindowTreeClient; 26 class WindowTreeClient;
(...skipping 21 matching lines...) Expand all
47 class ScreenMus; 48 class ScreenMus;
48 49
49 namespace internal { 50 namespace internal {
50 class NativeWidgetDelegate; 51 class NativeWidgetDelegate;
51 } 52 }
52 53
53 namespace test { 54 namespace test {
54 class MusClientTestApi; 55 class MusClientTestApi;
55 } 56 }
56 57
58 enum MusClientTestingState { NO_TESTING, CREATE_TESTING_STATE };
59
57 // MusClient establishes a connection to mus and sets up necessary state so that 60 // MusClient establishes a connection to mus and sets up necessary state so that
58 // aura and views target mus. This class is useful for typical clients, not the 61 // aura and views target mus. This class is useful for typical clients, not the
59 // WindowManager. Most clients don't create this directly, rather use AuraInit. 62 // WindowManager. Most clients don't create this directly, rather use AuraInit.
60 class VIEWS_MUS_EXPORT MusClient : public aura::WindowTreeClientDelegate, 63 class VIEWS_MUS_EXPORT MusClient : public aura::WindowTreeClientDelegate,
61 public ScreenMusDelegate { 64 public ScreenMusDelegate {
62 public: 65 public:
63 // Most clients should use AuraInit, which creates a MusClient. 66 // Most clients should use AuraInit, which creates a MusClient.
64 // |create_wm_state| indicates whether MusClient should create a wm::WMState. 67 // |create_wm_state| indicates whether MusClient should create a wm::WMState.
65 MusClient( 68 MusClient(
66 service_manager::Connector* connector, 69 service_manager::Connector* connector,
67 const service_manager::Identity& identity, 70 const service_manager::Identity& identity,
68 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr, 71 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner = nullptr,
69 bool create_wm_state = true); 72 bool create_wm_state = true,
73 MusClientTestingState testing_state = MusClientTestingState::NO_TESTING);
70 ~MusClient() override; 74 ~MusClient() override;
71 75
72 static MusClient* Get() { return instance_; } 76 static MusClient* Get() { return instance_; }
73 static bool Exists() { return instance_ != nullptr; } 77 static bool Exists() { return instance_ != nullptr; }
74 78
75 // Returns true if a DesktopNativeWidgetAura should be created given the 79 // Returns true if a DesktopNativeWidgetAura should be created given the
76 // specified params. If this returns false a NativeWidgetAura should be 80 // specified params. If this returns false a NativeWidgetAura should be
77 // created. 81 // created.
78 static bool ShouldCreateDesktopNativeWidgetAura( 82 static bool ShouldCreateDesktopNativeWidgetAura(
79 const Widget::InitParams& init_params); 83 const Widget::InitParams& init_params);
(...skipping 24 matching lines...) Expand all
104 void OnCaptureClientUnset(aura::client::CaptureClient* capture_client); 108 void OnCaptureClientUnset(aura::client::CaptureClient* capture_client);
105 109
106 void AddObserver(MusClientObserver* observer); 110 void AddObserver(MusClientObserver* observer);
107 void RemoveObserver(MusClientObserver* observer); 111 void RemoveObserver(MusClientObserver* observer);
108 112
109 void SetMusPropertyMirror(std::unique_ptr<MusPropertyMirror> mirror); 113 void SetMusPropertyMirror(std::unique_ptr<MusPropertyMirror> mirror);
110 MusPropertyMirror* mus_property_mirror() { 114 MusPropertyMirror* mus_property_mirror() {
111 return mus_property_mirror_.get(); 115 return mus_property_mirror_.get();
112 } 116 }
113 117
118 // Returns an interface to directly control mus. Only available when created
119 // with MusClientTestingState::CREATE_TESTING_STATE.
120 ui::mojom::WindowServerTest* GetTestingInterface() const;
121
114 private: 122 private:
115 friend class AuraInit; 123 friend class AuraInit;
116 friend class test::MusClientTestApi; 124 friend class test::MusClientTestApi;
117 125
118 // Creates a DesktopWindowTreeHostMus. This is set as the factory function 126 // Creates a DesktopWindowTreeHostMus. This is set as the factory function
119 // ViewsDelegate such that if DesktopNativeWidgetAura is created without a 127 // ViewsDelegate such that if DesktopNativeWidgetAura is created without a
120 // DesktopWindowTreeHost this is created. 128 // DesktopWindowTreeHost this is created.
121 std::unique_ptr<DesktopWindowTreeHost> CreateDesktopWindowTreeHost( 129 std::unique_ptr<DesktopWindowTreeHost> CreateDesktopWindowTreeHost(
122 const Widget::InitParams& init_params, 130 const Widget::InitParams& init_params,
123 internal::NativeWidgetDelegate* delegate, 131 internal::NativeWidgetDelegate* delegate,
(...skipping 26 matching lines...) Expand all
150 158
151 std::unique_ptr<ScreenMus> screen_; 159 std::unique_ptr<ScreenMus> screen_;
152 160
153 std::unique_ptr<aura::PropertyConverter> property_converter_; 161 std::unique_ptr<aura::PropertyConverter> property_converter_;
154 std::unique_ptr<MusPropertyMirror> mus_property_mirror_; 162 std::unique_ptr<MusPropertyMirror> mus_property_mirror_;
155 163
156 std::unique_ptr<aura::WindowTreeClient> window_tree_client_; 164 std::unique_ptr<aura::WindowTreeClient> window_tree_client_;
157 165
158 std::unique_ptr<PointerWatcherEventRouter> pointer_watcher_event_router_; 166 std::unique_ptr<PointerWatcherEventRouter> pointer_watcher_event_router_;
159 167
168 ui::mojom::WindowServerTestPtr server_test_ptr_;
169
160 DISALLOW_COPY_AND_ASSIGN(MusClient); 170 DISALLOW_COPY_AND_ASSIGN(MusClient);
161 }; 171 };
162 172
163 } // namespace views 173 } // namespace views
164 174
165 #endif // UI_VIEWS_MUS_MUS_CLIENT_H_ 175 #endif // UI_VIEWS_MUS_MUS_CLIENT_H_
OLDNEW
« no previous file with comments | « ui/views/mus/interactive_ui_tests_manifest.json ('k') | ui/views/mus/mus_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698