OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ash/shelf/shelf_window_watcher.h" | 5 #include "ash/shelf/shelf_window_watcher.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
8 #include "ash/shelf/shelf_constants.h" | 10 #include "ash/shelf/shelf_constants.h" |
9 #include "ash/shelf/shelf_item_delegate_manager.h" | 11 #include "ash/shelf/shelf_item_delegate_manager.h" |
10 #include "ash/shelf/shelf_model.h" | 12 #include "ash/shelf/shelf_model.h" |
11 #include "ash/shelf/shelf_util.h" | 13 #include "ash/shelf/shelf_util.h" |
12 #include "ash/shelf/shelf_window_watcher_item_delegate.h" | 14 #include "ash/shelf/shelf_window_watcher_item_delegate.h" |
13 #include "ash/shell.h" | 15 #include "ash/shell.h" |
14 #include "ash/shell_window_ids.h" | 16 #include "ash/shell_window_ids.h" |
15 #include "ash/wm/window_state.h" | 17 #include "ash/wm/window_state.h" |
16 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 const ShelfItemDetails* item_details = | 131 const ShelfItemDetails* item_details = |
130 GetShelfItemDetailsForWindow(window); | 132 GetShelfItemDetailsForWindow(window); |
131 ShelfItem item; | 133 ShelfItem item; |
132 ShelfID id = model_->next_id(); | 134 ShelfID id = model_->next_id(); |
133 item.status = wm::IsActiveWindow(window) ? STATUS_ACTIVE: STATUS_RUNNING; | 135 item.status = wm::IsActiveWindow(window) ? STATUS_ACTIVE: STATUS_RUNNING; |
134 SetShelfItemDetailsForShelfItem(&item, *item_details); | 136 SetShelfItemDetailsForShelfItem(&item, *item_details); |
135 SetShelfIDForWindow(id, window); | 137 SetShelfIDForWindow(id, window); |
136 scoped_ptr<ShelfItemDelegate> item_delegate( | 138 scoped_ptr<ShelfItemDelegate> item_delegate( |
137 new ShelfWindowWatcherItemDelegate(window, model_)); | 139 new ShelfWindowWatcherItemDelegate(window, model_)); |
138 // |item_delegate| is owned by |item_delegate_manager_|. | 140 // |item_delegate| is owned by |item_delegate_manager_|. |
139 item_delegate_manager_->SetShelfItemDelegate(id, item_delegate.Pass()); | 141 item_delegate_manager_->SetShelfItemDelegate(id, std::move(item_delegate)); |
140 model_->Add(item); | 142 model_->Add(item); |
141 } | 143 } |
142 | 144 |
143 void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) { | 145 void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) { |
144 model_->RemoveItemAt(model_->ItemIndexByID(GetShelfIDForWindow(window))); | 146 model_->RemoveItemAt(model_->ItemIndexByID(GetShelfIDForWindow(window))); |
145 SetShelfIDForWindow(kInvalidShelfID, window); | 147 SetShelfIDForWindow(kInvalidShelfID, window); |
146 } | 148 } |
147 | 149 |
148 void ShelfWindowWatcher::OnRootWindowAdded(aura::Window* root_window) { | 150 void ShelfWindowWatcher::OnRootWindowAdded(aura::Window* root_window) { |
149 // |observed_activation_clients_| can have the same ActivationClient multiple | 151 // |observed_activation_clients_| can have the same ActivationClient multiple |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 // Instead, we remove an observer from RootWindow and ActivationClient in the | 285 // Instead, we remove an observer from RootWindow and ActivationClient in the |
284 // OnRootWindowDestroyed(). | 286 // OnRootWindowDestroyed(). |
285 // Do nothing here. | 287 // Do nothing here. |
286 } | 288 } |
287 | 289 |
288 void ShelfWindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, | 290 void ShelfWindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, |
289 uint32_t) { | 291 uint32_t) { |
290 } | 292 } |
291 | 293 |
292 } // namespace ash | 294 } // namespace ash |
OLD | NEW |