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

Unified Diff: services/ui/demo/mus_demo_external.cc

Issue 2712203002: c++ / mojo changes for 'external window mode'
Patch Set: addressed sky/fwang feedback (take 5), simpler mus_demo changes / passing unittests 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 side-by-side diff with in-line comments
Download patch
Index: services/ui/demo/mus_demo_external.cc
diff --git a/services/ui/demo/mus_demo_external.cc b/services/ui/demo/mus_demo_external.cc
index 468506a978cbcba623afa4743c63ea8d6ae30612..6ef4d9dae911dc78af06df33f5e6b0544c4c3636 100644
--- a/services/ui/demo/mus_demo_external.cc
+++ b/services/ui/demo/mus_demo_external.cc
@@ -22,19 +22,13 @@ namespace {
class WindowTreeDataExternal : public WindowTreeData {
public:
// Creates a new window tree host associated to the WindowTreeData.
- WindowTreeDataExternal(mojom::WindowTreeHostFactory* factory,
- mojom::WindowTreeClientPtr tree_client,
+ WindowTreeDataExternal(aura::WindowTreeClient* window_tree_client,
int square_size)
: WindowTreeData(square_size) {
- // TODO(tonikitoo,fwang): Extend the API to allow creating WindowTreeHost
- // using the WindowTreeClient.
- factory->CreateWindowTreeHost(MakeRequest(&host_), std::move(tree_client));
+ SetWindowTreeHost(
+ base::MakeUnique<aura::WindowTreeHostMus>(window_tree_client));
}
- private:
- // Holds the Mojo pointer to the window tree host.
- mojom::WindowTreeHostPtr host_;
-
DISALLOW_COPY_AND_ASSIGN(WindowTreeDataExternal);
};
@@ -50,9 +44,7 @@ MusDemoExternal::~MusDemoExternal() {}
std::unique_ptr<aura::WindowTreeClient>
MusDemoExternal::CreateWindowTreeClient() {
- return base::MakeUnique<aura::WindowTreeClient>(
- context()->connector(), this, nullptr,
- MakeRequest(&window_tree_client_mojo_));
+ return base::MakeUnique<aura::WindowTreeClient>(context()->connector(), this);
}
void MusDemoExternal::OnStartImpl() {
@@ -67,10 +59,7 @@ void MusDemoExternal::OnStartImpl() {
}
}
- // TODO(tonikitoo,fwang): Extend the WindowTreeClient API to allow connection
- // to the window tree host factory using window_tree_client().
- context()->connector()->BindInterface(ui::mojom::kServiceName,
- &window_tree_host_factory_);
+ window_tree_client()->ConnectViaWindowTreeHostFactory();
// TODO(tonikitoo,fwang): Implement management of displays in external mode.
// For now, a fake display is created in order to work around an assertion in
@@ -86,19 +75,15 @@ void MusDemoExternal::OnStartImpl() {
}
void MusDemoExternal::OpenNewWindow() {
- // TODO(tonikitoo,fwang): Extend the WindowTreeClient API to allow creation
- // of window tree host. Then pass window_tree_client() here and remove
- // window_tree_host_factory_ and window_tree_client_mojo_. Currently
- // window_tree_client_mojo_ is only initialized once so this is incorrect when
- // kNumberOfWindows > 1.
AppendWindowTreeData(base::MakeUnique<WindowTreeDataExternal>(
- window_tree_host_factory_.get(), std::move(window_tree_client_mojo_),
+ window_tree_client(),
GetSquareSizeForWindow(initialized_windows_count_)));
}
void MusDemoExternal::OnEmbed(
std::unique_ptr<aura::WindowTreeHostMus> window_tree_host) {
- InitWindowTreeData(std::move(window_tree_host));
+ DCHECK(!window_tree_host);
+ InitWindowTreeData(nullptr);
initialized_windows_count_++;
// Open the next window until the requested number of windows is reached.

Powered by Google App Engine
This is Rietveld 408576698