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

Side by Side Diff: mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.cc

Issue 658503003: Enables specifying mojo url mapping on command line (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 2 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 | « mojo/mojo.gyp ('k') | mojo/shell/BUILD.gn » ('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 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 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h" 5 #include "mojo/services/public/cpp/view_manager/lib/view_manager_client_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h"
9 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 9 #include "base/stl_util.h"
11 #include "mojo/public/cpp/application/application_impl.h" 10 #include "mojo/public/cpp/application/application_impl.h"
12 #include "mojo/public/cpp/application/connect.h" 11 #include "mojo/public/cpp/application/connect.h"
13 #include "mojo/public/cpp/application/service_provider_impl.h" 12 #include "mojo/public/cpp/application/service_provider_impl.h"
14 #include "mojo/public/interfaces/application/service_provider.mojom.h" 13 #include "mojo/public/interfaces/application/service_provider.mojom.h"
15 #include "mojo/public/interfaces/application/shell.mojom.h" 14 #include "mojo/public/interfaces/application/shell.mojom.h"
16 #include "mojo/services/public/cpp/view_manager/lib/view_private.h" 15 #include "mojo/services/public/cpp/view_manager/lib/view_private.h"
17 #include "mojo/services/public/cpp/view_manager/util.h" 16 #include "mojo/services/public/cpp/view_manager/util.h"
18 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h" 17 #include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 } 85 }
87 86
88 View* root_; 87 View* root_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(RootObserver); 89 DISALLOW_COPY_AND_ASSIGN(RootObserver);
91 }; 90 };
92 91
93 ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate, 92 ViewManagerClientImpl::ViewManagerClientImpl(ViewManagerDelegate* delegate,
94 Shell* shell) 93 Shell* shell)
95 : connected_(false), connection_id_(0), next_id_(1), delegate_(delegate) { 94 : connected_(false), connection_id_(0), next_id_(1), delegate_(delegate) {
96 // TODO(beng): Come up with a better way of establishing a configuration for
97 // what the active window manager is.
98 std::string window_manager_url = "mojo:mojo_window_manager";
99 if (base::CommandLine::ForCurrentProcess()->HasSwitch("window-manager")) {
100 window_manager_url =
101 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
102 "window-manager");
103 }
104 InterfacePtr<ServiceProvider> sp; 95 InterfacePtr<ServiceProvider> sp;
105 shell->ConnectToApplication(window_manager_url, GetProxy(&sp)); 96 shell->ConnectToApplication("mojo:mojo_window_manager", GetProxy(&sp));
106 ConnectToService(sp.get(), &window_manager_); 97 ConnectToService(sp.get(), &window_manager_);
107 window_manager_.set_client(this); 98 window_manager_.set_client(this);
108 } 99 }
109 100
110 ViewManagerClientImpl::~ViewManagerClientImpl() { 101 ViewManagerClientImpl::~ViewManagerClientImpl() {
111 std::vector<View*> non_owned; 102 std::vector<View*> non_owned;
112 while (!views_.empty()) { 103 while (!views_.empty()) {
113 IdToViewMap::iterator it = views_.begin(); 104 IdToViewMap::iterator it = views_.begin();
114 if (OwnsView(it->second->id())) { 105 if (OwnsView(it->second->id())) {
115 it->second->Destroy(); 106 it->second->Destroy();
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 base::Unretained(this)); 378 base::Unretained(this));
388 } 379 }
389 380
390 base::Callback<void(ErrorCode)> 381 base::Callback<void(ErrorCode)>
391 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { 382 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() {
392 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, 383 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode,
393 base::Unretained(this)); 384 base::Unretained(this));
394 } 385 }
395 386
396 } // namespace mojo 387 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/mojo.gyp ('k') | mojo/shell/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698