| 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 <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "ash/public/cpp/config.h" | 10 #include "ash/public/cpp/config.h" |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 // ShelfWindowWatcher[ItemDelegate] doesn't support multiple windows per item, | 190 // ShelfWindowWatcher[ItemDelegate] doesn't support multiple windows per item, |
| 191 // but this can happen in Mash (eg. when multiple browser windows are open). | 191 // but this can happen in Mash (eg. when multiple browser windows are open). |
| 192 // Assign a unique launch id in this case to avoid crashing on DCHECKs. | 192 // Assign a unique launch id in this case to avoid crashing on DCHECKs. |
| 193 // TODO(msw): Remove Mash duplicate ShelfID handling. crbug.com/722496 | 193 // TODO(msw): Remove Mash duplicate ShelfID handling. crbug.com/722496 |
| 194 if (Shell::GetAshConfig() == Config::MASH && | 194 if (Shell::GetAshConfig() == Config::MASH && |
| 195 model_->ItemIndexByID(item.id) > 0) { | 195 model_->ItemIndexByID(item.id) > 0) { |
| 196 static int id = 0; | 196 static int id = 0; |
| 197 item.id.launch_id = base::IntToString(id++); | 197 item.id.launch_id = base::IntToString(id++); |
| 198 } | 198 } |
| 199 | 199 |
| 200 model_->SetShelfItemDelegate(item.id, | 200 model_->SetShelfItemDelegate( |
| 201 base::MakeUnique<ShelfWindowWatcherItemDelegate>( | 201 item.id, |
| 202 item.id, WmWindow::Get(window))); | 202 base::MakeUnique<ShelfWindowWatcherItemDelegate>(item.id, window)); |
| 203 // Panels are inserted on the left so as not to push all existing panels over. | 203 // Panels are inserted on the left so as not to push all existing panels over. |
| 204 model_->AddAt(item.type == TYPE_APP_PANEL ? 0 : model_->item_count(), item); | 204 model_->AddAt(item.type == TYPE_APP_PANEL ? 0 : model_->item_count(), item); |
| 205 } | 205 } |
| 206 | 206 |
| 207 void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) { | 207 void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) { |
| 208 user_windows_with_items_.erase(window); | 208 user_windows_with_items_.erase(window); |
| 209 const ShelfID shelf_id = GetShelfID(window); | 209 const ShelfID shelf_id = GetShelfID(window); |
| 210 DCHECK(!shelf_id.IsNull()); | 210 DCHECK(!shelf_id.IsNull()); |
| 211 const int index = model_->ItemIndexByID(shelf_id); | 211 const int index = model_->ItemIndexByID(shelf_id); |
| 212 DCHECK_GE(index, 0); | 212 DCHECK_GE(index, 0); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 298 void ShelfWindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |
| 299 } | 299 } |
| 300 | 300 |
| 301 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, | 301 void ShelfWindowWatcher::OnDisplayMetricsChanged(const display::Display&, |
| 302 uint32_t) {} | 302 uint32_t) {} |
| 303 | 303 |
| 304 } // namespace ash | 304 } // namespace ash |
| OLD | NEW |