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

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

Issue 2712203002: c++ / mojo changes for 'external window mode'
Patch Set: addressing fwang/sky feedback Created 3 years, 10 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 88d9f369d5ac6519abd23501199b31ea94d09761..e0afb28e8e1d86cd99a9aaaa7ffd9116cf86cc72 100644
--- a/services/ui/demo/mus_demo_external.cc
+++ b/services/ui/demo/mus_demo_external.cc
@@ -20,13 +20,10 @@ 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));
+ window_tree_client->CreateHost(MakeRequest(&host_));
}
private:
@@ -52,16 +49,11 @@ 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() {
- // 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
@@ -76,13 +68,8 @@ 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_)));
}

Powered by Google App Engine
This is Rietveld 408576698