| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/shell/window_watcher.h" | 5 #include "ash/shell/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.h" | 10 #include "ash/shelf/shelf.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_widget.h" | 14 #include "ash/shelf/shelf_widget.h" |
| 13 #include "ash/shell.h" | 15 #include "ash/shell.h" |
| 14 #include "ash/shell/window_watcher_shelf_item_delegate.h" | 16 #include "ash/shell/window_watcher_shelf_item_delegate.h" |
| 15 #include "ash/shell_window_ids.h" | 17 #include "ash/shell_window_ids.h" |
| 16 #include "ash/wm/window_util.h" | 18 #include "ash/wm/window_util.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 image_count == 2 ? 255 : 0); | 113 image_count == 2 ? 255 : 0); |
| 112 image_count = (image_count + 1) % 3; | 114 image_count = (image_count + 1) % 3; |
| 113 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); | 115 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); |
| 114 | 116 |
| 115 model->Add(item); | 117 model->Add(item); |
| 116 | 118 |
| 117 ShelfItemDelegateManager* manager = | 119 ShelfItemDelegateManager* manager = |
| 118 Shell::GetInstance()->shelf_item_delegate_manager(); | 120 Shell::GetInstance()->shelf_item_delegate_manager(); |
| 119 scoped_ptr<ShelfItemDelegate> delegate( | 121 scoped_ptr<ShelfItemDelegate> delegate( |
| 120 new WindowWatcherShelfItemDelegate(id, this)); | 122 new WindowWatcherShelfItemDelegate(id, this)); |
| 121 manager->SetShelfItemDelegate(id, delegate.Pass()); | 123 manager->SetShelfItemDelegate(id, std::move(delegate)); |
| 122 SetShelfIDForWindow(id, new_window); | 124 SetShelfIDForWindow(id, new_window); |
| 123 } | 125 } |
| 124 | 126 |
| 125 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { | 127 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { |
| 126 for (IDToWindow::iterator i = id_to_window_.begin(); | 128 for (IDToWindow::iterator i = id_to_window_.begin(); |
| 127 i != id_to_window_.end(); ++i) { | 129 i != id_to_window_.end(); ++i) { |
| 128 if (i->second == window) { | 130 if (i->second == window) { |
| 129 ShelfModel* model = Shell::GetInstance()->shelf_model(); | 131 ShelfModel* model = Shell::GetInstance()->shelf_model(); |
| 130 int index = model->ItemIndexByID(i->first); | 132 int index = model->ItemIndexByID(i->first); |
| 131 DCHECK_NE(-1, index); | 133 DCHECK_NE(-1, index); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 146 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 148 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
| 147 // All windows in the display has already been removed, so no need to | 149 // All windows in the display has already been removed, so no need to |
| 148 // remove observers. | 150 // remove observers. |
| 149 } | 151 } |
| 150 | 152 |
| 151 void WindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, uint32_t) { | 153 void WindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, uint32_t) { |
| 152 } | 154 } |
| 153 | 155 |
| 154 } // namespace shell | 156 } // namespace shell |
| 155 } // namespace ash | 157 } // namespace ash |
| OLD | NEW |