| OLD | NEW |
| 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" | 8 #include "base/command_line.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 shell_(shell) { | 103 shell_(shell) { |
| 104 // TODO(beng): Come up with a better way of establishing a configuration for | 104 // TODO(beng): Come up with a better way of establishing a configuration for |
| 105 // what the active window manager is. | 105 // what the active window manager is. |
| 106 std::string window_manager_url = "mojo:mojo_window_manager"; | 106 std::string window_manager_url = "mojo:mojo_window_manager"; |
| 107 if (base::CommandLine::ForCurrentProcess()->HasSwitch("window-manager")) { | 107 if (base::CommandLine::ForCurrentProcess()->HasSwitch("window-manager")) { |
| 108 window_manager_url = | 108 window_manager_url = |
| 109 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 109 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 110 "window-manager"); | 110 "window-manager"); |
| 111 } | 111 } |
| 112 InterfacePtr<ServiceProvider> sp; | 112 InterfacePtr<ServiceProvider> sp; |
| 113 shell->ConnectToApplication(window_manager_url, Get(&sp)); | 113 shell->ConnectToApplication(window_manager_url, GetProxy(&sp)); |
| 114 ConnectToService(sp.get(), &window_manager_); | 114 ConnectToService(sp.get(), &window_manager_); |
| 115 window_manager_.set_client(this); | 115 window_manager_.set_client(this); |
| 116 } | 116 } |
| 117 | 117 |
| 118 ViewManagerClientImpl::~ViewManagerClientImpl() { | 118 ViewManagerClientImpl::~ViewManagerClientImpl() { |
| 119 std::vector<View*> non_owned; | 119 std::vector<View*> non_owned; |
| 120 while (!views_.empty()) { | 120 while (!views_.empty()) { |
| 121 IdToViewMap::iterator it = views_.begin(); | 121 IdToViewMap::iterator it = views_.begin(); |
| 122 if (OwnsView(it->second->id())) { | 122 if (OwnsView(it->second->id())) { |
| 123 it->second->Destroy(); | 123 it->second->Destroy(); |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 base::Unretained(this)); | 419 base::Unretained(this)); |
| 420 } | 420 } |
| 421 | 421 |
| 422 base::Callback<void(ErrorCode)> | 422 base::Callback<void(ErrorCode)> |
| 423 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { | 423 ViewManagerClientImpl::ActionCompletedCallbackWithErrorCode() { |
| 424 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, | 424 return base::Bind(&ViewManagerClientImpl::OnActionCompletedWithErrorCode, |
| 425 base::Unretained(this)); | 425 base::Unretained(this)); |
| 426 } | 426 } |
| 427 | 427 |
| 428 } // namespace mojo | 428 } // namespace mojo |
| OLD | NEW |