| 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 "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/shelf/shelf_constants.h" | 8 #include "ash/shelf/shelf_constants.h" |
| 9 #include "ash/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 84 |
| 85 void ShelfWindowWatcher::AddLauncherItem(aura::Window* window) { | 85 void ShelfWindowWatcher::AddLauncherItem(aura::Window* window) { |
| 86 const LauncherItemDetails* item_details = | 86 const LauncherItemDetails* item_details = |
| 87 GetLauncherItemDetailsForWindow(window); | 87 GetLauncherItemDetailsForWindow(window); |
| 88 LauncherItem item; | 88 LauncherItem item; |
| 89 LauncherID id = model_->next_id(); | 89 LauncherID id = model_->next_id(); |
| 90 item.status = ash::wm::IsActiveWindow(window) ? STATUS_ACTIVE: STATUS_RUNNING; | 90 item.status = ash::wm::IsActiveWindow(window) ? STATUS_ACTIVE: STATUS_RUNNING; |
| 91 SetShelfItemDetailsForLauncherItem(&item, *item_details); | 91 SetShelfItemDetailsForLauncherItem(&item, *item_details); |
| 92 SetLauncherIDForWindow(id, window); | 92 SetLauncherIDForWindow(id, window); |
| 93 scoped_ptr<ShelfItemDelegate> item_delegate( | 93 scoped_ptr<ShelfItemDelegate> item_delegate( |
| 94 new ShelfWindowWatcherItemDelegate(window)); | 94 new ShelfWindowWatcherItemDelegate(window, model_)); |
| 95 // |item_delegate| is owned by |item_delegate_manager_|. | 95 // |item_delegate| is owned by |item_delegate_manager_|. |
| 96 item_delegate_manager_->SetShelfItemDelegate(id, item_delegate.Pass()); | 96 item_delegate_manager_->SetShelfItemDelegate(id, item_delegate.Pass()); |
| 97 model_->Add(item); | 97 model_->Add(item); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void ShelfWindowWatcher::RemoveLauncherItem(aura::Window* window) { | 100 void ShelfWindowWatcher::RemoveLauncherItem(aura::Window* window) { |
| 101 model_->RemoveItemAt(model_->ItemIndexByID(GetLauncherIDForWindow(window))); | 101 model_->RemoveItemAt(model_->ItemIndexByID(GetLauncherIDForWindow(window))); |
| 102 SetLauncherIDForWindow(kInvalidShelfID, window); | 102 SetLauncherIDForWindow(kInvalidShelfID, window); |
| 103 } | 103 } |
| 104 | 104 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 216 |
| 217 void ShelfWindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 217 void ShelfWindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
| 218 // When this is called, RootWindow of |old_display| is already removed. | 218 // When this is called, RootWindow of |old_display| is already removed. |
| 219 // Instead, we remove an observer from RootWindow and ActivationClient in the | 219 // Instead, we remove an observer from RootWindow and ActivationClient in the |
| 220 // OnRootWindowDestroyed(). | 220 // OnRootWindowDestroyed(). |
| 221 // Do nothing here. | 221 // Do nothing here. |
| 222 } | 222 } |
| 223 | 223 |
| 224 } // namespace internal | 224 } // namespace internal |
| 225 } // namespace ash | 225 } // namespace ash |
| OLD | NEW |