| OLD | NEW |
| 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_window_tree_factory_set.h" | 5 #include "components/mus/ws/window_manager_window_tree_factory_set.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_window_tree_factory.h" | 8 #include "components/mus/ws/window_manager_window_tree_factory.h" |
| 9 #include "components/mus/ws/window_manager_window_tree_factory_set_observer.h" | 9 #include "components/mus/ws/window_manager_window_tree_factory_set_observer.h" |
| 10 #include "components/mus/ws/window_server.h" | 10 #include "components/mus/ws/window_server.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 return nullptr; | 32 return nullptr; |
| 33 } | 33 } |
| 34 | 34 |
| 35 std::unique_ptr<WindowManagerWindowTreeFactory> factory_ptr( | 35 std::unique_ptr<WindowManagerWindowTreeFactory> factory_ptr( |
| 36 new WindowManagerWindowTreeFactory(this, user_id, std::move(request))); | 36 new WindowManagerWindowTreeFactory(this, user_id, std::move(request))); |
| 37 WindowManagerWindowTreeFactory* factory = factory_ptr.get(); | 37 WindowManagerWindowTreeFactory* factory = factory_ptr.get(); |
| 38 factories_[user_id] = std::move(factory_ptr); | 38 factories_[user_id] = std::move(factory_ptr); |
| 39 return factory; | 39 return factory; |
| 40 } | 40 } |
| 41 | 41 |
| 42 GlobalWindowManagerState* | 42 WindowManagerState* |
| 43 WindowManagerWindowTreeFactorySet::GetGlobalWindowManagerStateForUser( | 43 WindowManagerWindowTreeFactorySet::GetWindowManagerStateForUser( |
| 44 const UserId& user_id) { | 44 const UserId& user_id) { |
| 45 auto it = factories_.find(user_id); | 45 auto it = factories_.find(user_id); |
| 46 return it == factories_.end() | 46 if (it == factories_.end()) |
| 47 ? nullptr | 47 return nullptr; |
| 48 : it->second->window_tree()->global_window_manager_state(); | 48 return it->second->window_tree() |
| 49 ? it->second->window_tree()->window_manager_state() |
| 50 : nullptr; |
| 49 } | 51 } |
| 50 | 52 |
| 51 void WindowManagerWindowTreeFactorySet::DeleteFactoryAssociatedWithTree( | 53 void WindowManagerWindowTreeFactorySet::DeleteFactoryAssociatedWithTree( |
| 52 WindowTree* window_tree) { | 54 WindowTree* window_tree) { |
| 53 for (auto it = factories_.begin(); it != factories_.end(); ++it) { | 55 for (auto it = factories_.begin(); it != factories_.end(); ++it) { |
| 54 if (it->second->window_tree() == window_tree) { | 56 if (it->second->window_tree() == window_tree) { |
| 55 factories_.erase(it); | 57 factories_.erase(it); |
| 56 return; | 58 return; |
| 57 } | 59 } |
| 58 } | 60 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 82 got_valid_factory_ = true; | 84 got_valid_factory_ = true; |
| 83 FOR_EACH_OBSERVER(WindowManagerWindowTreeFactorySetObserver, observers_, | 85 FOR_EACH_OBSERVER(WindowManagerWindowTreeFactorySetObserver, observers_, |
| 84 OnWindowManagerWindowTreeFactoryReady(factory)); | 86 OnWindowManagerWindowTreeFactoryReady(factory)); |
| 85 | 87 |
| 86 // Notify after other observers as WindowServer triggers other | 88 // Notify after other observers as WindowServer triggers other |
| 87 // observers being added, which will have already processed the add. | 89 // observers being added, which will have already processed the add. |
| 88 if (is_first_valid_factory) | 90 if (is_first_valid_factory) |
| 89 window_server_->OnFirstWindowManagerWindowTreeFactoryReady(); | 91 window_server_->OnFirstWindowManagerWindowTreeFactoryReady(); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void WindowManagerWindowTreeFactorySet::OnActiveUserIdChanged( | |
| 93 const UserId& previously_active_id, | |
| 94 const UserId& active_id) {} | |
| 95 | |
| 96 void WindowManagerWindowTreeFactorySet::OnUserIdAdded(const UserId& id) {} | |
| 97 | |
| 98 void WindowManagerWindowTreeFactorySet::OnUserIdRemoved(const UserId& id) { | 94 void WindowManagerWindowTreeFactorySet::OnUserIdRemoved(const UserId& id) { |
| 99 factories_.erase(id); | 95 factories_.erase(id); |
| 100 } | 96 } |
| 101 | 97 |
| 102 } // namespace ws | 98 } // namespace ws |
| 103 } // namespace mus | 99 } // namespace mus |
| OLD | NEW |