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/aura/wm_window_aura.h" | 9 #include "ash/aura/wm_window_aura.h" |
10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 : ash::TYPE_APP; | 103 : ash::TYPE_APP; |
104 ash::ShelfID id = model->next_id(); | 104 ash::ShelfID id = model->next_id(); |
105 id_to_window_[id] = new_window; | 105 id_to_window_[id] = new_window; |
106 | 106 |
107 SkBitmap icon_bitmap; | 107 SkBitmap icon_bitmap; |
108 icon_bitmap.allocN32Pixels(16, 16); | 108 icon_bitmap.allocN32Pixels(16, 16); |
109 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0, | 109 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0, |
110 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0); | 110 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0); |
111 image_count = (image_count + 1) % 3; | 111 image_count = (image_count + 1) % 3; |
112 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); | 112 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); |
| 113 item.title = new_window->GetTitle(); |
113 | 114 |
114 model->Add(item); | 115 model->Add(item); |
115 | 116 |
116 std::unique_ptr<ShelfItemDelegate> delegate( | 117 std::unique_ptr<ShelfItemDelegate> delegate( |
117 new WindowWatcherShelfItemDelegate(id, this)); | 118 new WindowWatcherShelfItemDelegate(id, this)); |
118 model->SetShelfItemDelegate(id, std::move(delegate)); | 119 model->SetShelfItemDelegate(id, std::move(delegate)); |
119 WmWindowAura::Get(new_window)->SetIntProperty(WmWindowProperty::SHELF_ID, id); | 120 WmWindowAura::Get(new_window)->SetIntProperty(WmWindowProperty::SHELF_ID, id); |
120 } | 121 } |
121 | 122 |
122 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { | 123 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { |
(...skipping 20 matching lines...) Expand all Loading... |
143 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 144 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |
144 // All windows in the display has already been removed, so no need to | 145 // All windows in the display has already been removed, so no need to |
145 // remove observers. | 146 // remove observers. |
146 } | 147 } |
147 | 148 |
148 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { | 149 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { |
149 } | 150 } |
150 | 151 |
151 } // namespace shell | 152 } // namespace shell |
152 } // namespace ash | 153 } // namespace ash |
OLD | NEW |