| 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/common/shelf/shelf_window_watcher.h" | 5 #include "ash/common/shelf/shelf_window_watcher.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/common/shelf/shelf_constants.h" | 10 #include "ash/common/shelf/shelf_constants.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 window->SetProperty(kShelfIDKey, id); | 165 window->SetProperty(kShelfIDKey, id); |
| 166 model_->SetShelfItemDelegate(id, | 166 model_->SetShelfItemDelegate(id, |
| 167 base::MakeUnique<ShelfWindowWatcherItemDelegate>( | 167 base::MakeUnique<ShelfWindowWatcherItemDelegate>( |
| 168 id, WmWindow::Get(window))); | 168 id, WmWindow::Get(window))); |
| 169 // Panels are inserted on the left so as not to push all existing panels over. | 169 // Panels are inserted on the left so as not to push all existing panels over. |
| 170 model_->AddAt(item.type == TYPE_APP_PANEL ? 0 : model_->item_count(), item); | 170 model_->AddAt(item.type == TYPE_APP_PANEL ? 0 : model_->item_count(), item); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) { | 173 void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) { |
| 174 user_windows_with_items_.erase(window); | 174 user_windows_with_items_.erase(window); |
| 175 int shelf_id = window->GetProperty(kShelfIDKey); | 175 ShelfID shelf_id = window->GetProperty(kShelfIDKey); |
| 176 DCHECK_NE(shelf_id, kInvalidShelfID); | 176 DCHECK_NE(shelf_id, kInvalidShelfID); |
| 177 int index = model_->ItemIndexByID(shelf_id); | 177 int index = model_->ItemIndexByID(shelf_id); |
| 178 DCHECK_GE(index, 0); | 178 DCHECK_GE(index, 0); |
| 179 model_->RemoveItemAt(index); | 179 model_->RemoveItemAt(index); |
| 180 window->SetProperty(kShelfIDKey, kInvalidShelfID); | 180 window->SetProperty(kShelfIDKey, kInvalidShelfID); |
| 181 } | 181 } |
| 182 | 182 |
| 183 void ShelfWindowWatcher::OnContainerWindowDestroying(aura::Window* container) { | 183 void ShelfWindowWatcher::OnContainerWindowDestroying(aura::Window* container) { |
| 184 observed_container_windows_.Remove(container); | 184 observed_container_windows_.Remove(container); |
| 185 } | 185 } |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 } | 260 } |
| 261 } | 261 } |
| 262 | 262 |
| 263 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 263 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |
| 264 } | 264 } |
| 265 | 265 |
| 266 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, | 266 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, |
| 267 uint32_t) {} | 267 uint32_t) {} |
| 268 | 268 |
| 269 } // namespace ash | 269 } // namespace ash |
| OLD | NEW |