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

Side by Side Diff: components/mus/ws/window_manager_factory_registry.cc

Issue 1906623003: Convert //components/mus from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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 #include "components/mus/ws/window_manager_factory_registry.h" 5 #include "components/mus/ws/window_manager_factory_registry.h"
6 6
7 #include "components/mus/ws/user_id_tracker_observer.h" 7 #include "components/mus/ws/user_id_tracker_observer.h"
8 #include "components/mus/ws/window_manager_factory_registry_observer.h" 8 #include "components/mus/ws/window_manager_factory_registry_observer.h"
9 #include "components/mus/ws/window_manager_factory_service.h" 9 #include "components/mus/ws/window_manager_factory_service.h"
10 #include "components/mus/ws/window_server.h" 10 #include "components/mus/ws/window_server.h"
(...skipping 11 matching lines...) Expand all
22 WindowManagerFactoryRegistry::~WindowManagerFactoryRegistry() { 22 WindowManagerFactoryRegistry::~WindowManagerFactoryRegistry() {
23 id_tracker_->RemoveObserver(this); 23 id_tracker_->RemoveObserver(this);
24 } 24 }
25 25
26 void WindowManagerFactoryRegistry::Register( 26 void WindowManagerFactoryRegistry::Register(
27 const UserId& user_id, 27 const UserId& user_id,
28 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) { 28 mojo::InterfaceRequest<mojom::WindowManagerFactoryService> request) {
29 if (ContainsServiceForUser(user_id)) 29 if (ContainsServiceForUser(user_id))
30 return; 30 return;
31 31
32 scoped_ptr<WindowManagerFactoryService> service( 32 std::unique_ptr<WindowManagerFactoryService> service(
33 new WindowManagerFactoryService(this, user_id, std::move(request))); 33 new WindowManagerFactoryService(this, user_id, std::move(request)));
34 AddServiceImpl(std::move(service)); 34 AddServiceImpl(std::move(service));
35 } 35 }
36 36
37 std::vector<WindowManagerFactoryService*> 37 std::vector<WindowManagerFactoryService*>
38 WindowManagerFactoryRegistry::GetServices() { 38 WindowManagerFactoryRegistry::GetServices() {
39 std::vector<WindowManagerFactoryService*> result; 39 std::vector<WindowManagerFactoryService*> result;
40 for (auto& service_ptr : services_) 40 for (auto& service_ptr : services_)
41 result.push_back(service_ptr.get()); 41 result.push_back(service_ptr.get());
42 return result; 42 return result;
43 } 43 }
44 44
45 void WindowManagerFactoryRegistry::AddObserver( 45 void WindowManagerFactoryRegistry::AddObserver(
46 WindowManagerFactoryRegistryObserver* observer) { 46 WindowManagerFactoryRegistryObserver* observer) {
47 observers_.AddObserver(observer); 47 observers_.AddObserver(observer);
48 } 48 }
49 49
50 void WindowManagerFactoryRegistry::RemoveObserver( 50 void WindowManagerFactoryRegistry::RemoveObserver(
51 WindowManagerFactoryRegistryObserver* observer) { 51 WindowManagerFactoryRegistryObserver* observer) {
52 observers_.RemoveObserver(observer); 52 observers_.RemoveObserver(observer);
53 } 53 }
54 54
55 void WindowManagerFactoryRegistry::AddServiceImpl( 55 void WindowManagerFactoryRegistry::AddServiceImpl(
56 scoped_ptr<WindowManagerFactoryService> service) { 56 std::unique_ptr<WindowManagerFactoryService> service) {
57 services_.push_back(std::move(service)); 57 services_.push_back(std::move(service));
58 } 58 }
59 59
60 bool WindowManagerFactoryRegistry::ContainsServiceForUser( 60 bool WindowManagerFactoryRegistry::ContainsServiceForUser(
61 const UserId& user_id) const { 61 const UserId& user_id) const {
62 for (auto& service_ptr : services_) { 62 for (auto& service_ptr : services_) {
63 if (service_ptr->user_id() == user_id) { 63 if (service_ptr->user_id() == user_id) {
64 LOG(ERROR) << "WindowManagerFactoryService already registered for " 64 LOG(ERROR) << "WindowManagerFactoryService already registered for "
65 << user_id; 65 << user_id;
66 return true; 66 return true;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 for (auto iter = services_.begin(); iter != services_.end(); ++iter) { 103 for (auto iter = services_.begin(); iter != services_.end(); ++iter) {
104 if ((*iter)->user_id() == id) { 104 if ((*iter)->user_id() == id) {
105 services_.erase(iter); 105 services_.erase(iter);
106 return; 106 return;
107 } 107 }
108 } 108 }
109 } 109 }
110 110
111 } // namespace ws 111 } // namespace ws
112 } // namespace mus 112 } // namespace mus
OLDNEW
« no previous file with comments | « components/mus/ws/window_manager_factory_registry.h ('k') | components/mus/ws/window_manager_state.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698