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> | 7 #include <utility> |
8 | 8 |
9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 image_count == 0 ? 255 : 0, | 111 image_count == 0 ? 255 : 0, |
112 image_count == 1 ? 255 : 0, | 112 image_count == 1 ? 255 : 0, |
113 image_count == 2 ? 255 : 0); | 113 image_count == 2 ? 255 : 0); |
114 image_count = (image_count + 1) % 3; | 114 image_count = (image_count + 1) % 3; |
115 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); | 115 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); |
116 | 116 |
117 model->Add(item); | 117 model->Add(item); |
118 | 118 |
119 ShelfItemDelegateManager* manager = | 119 ShelfItemDelegateManager* manager = |
120 Shell::GetInstance()->shelf_item_delegate_manager(); | 120 Shell::GetInstance()->shelf_item_delegate_manager(); |
121 scoped_ptr<ShelfItemDelegate> delegate( | 121 std::unique_ptr<ShelfItemDelegate> delegate( |
122 new WindowWatcherShelfItemDelegate(id, this)); | 122 new WindowWatcherShelfItemDelegate(id, this)); |
123 manager->SetShelfItemDelegate(id, std::move(delegate)); | 123 manager->SetShelfItemDelegate(id, std::move(delegate)); |
124 SetShelfIDForWindow(id, new_window); | 124 SetShelfIDForWindow(id, new_window); |
125 } | 125 } |
126 | 126 |
127 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { | 127 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { |
128 for (IDToWindow::iterator i = id_to_window_.begin(); | 128 for (IDToWindow::iterator i = id_to_window_.begin(); |
129 i != id_to_window_.end(); ++i) { | 129 i != id_to_window_.end(); ++i) { |
130 if (i->second == window) { | 130 if (i->second == window) { |
131 ShelfModel* model = Shell::GetInstance()->shelf_model(); | 131 ShelfModel* model = Shell::GetInstance()->shelf_model(); |
(...skipping 16 matching lines...) Expand all Loading... |
148 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 148 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
149 // 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 |
150 // remove observers. | 150 // remove observers. |
151 } | 151 } |
152 | 152 |
153 void WindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, uint32_t) { | 153 void WindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, uint32_t) { |
154 } | 154 } |
155 | 155 |
156 } // namespace shell | 156 } // namespace shell |
157 } // namespace ash | 157 } // namespace ash |
OLD | NEW |