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/public/cpp/shelf_item.h" | 9 #include "ash/public/cpp/shelf_item.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0, | 110 icon_bitmap.eraseARGB(255, image_count == 0 ? 255 : 0, |
111 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0); | 111 image_count == 1 ? 255 : 0, image_count == 2 ? 255 : 0); |
112 image_count = (image_count + 1) % 3; | 112 image_count = (image_count + 1) % 3; |
113 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); | 113 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, 1.0f)); |
114 item.title = new_window->GetTitle(); | 114 item.title = new_window->GetTitle(); |
115 | 115 |
116 model->Add(item); | 116 model->Add(item); |
117 | 117 |
118 model->SetShelfItemDelegate( | 118 model->SetShelfItemDelegate( |
119 item.id, base::MakeUnique<WindowWatcherShelfItemDelegate>(item.id, this)); | 119 item.id, base::MakeUnique<WindowWatcherShelfItemDelegate>(item.id, this)); |
120 new_window->SetProperty(kShelfIDKey, new ShelfID(item.id)); | 120 new_window->SetProperty(kShelfIDKey, new std::string(item.id.Serialize())); |
121 } | 121 } |
122 | 122 |
123 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { | 123 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { |
124 for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end(); | 124 for (IDToWindow::iterator i = id_to_window_.begin(); i != id_to_window_.end(); |
125 ++i) { | 125 ++i) { |
126 if (i->second == window) { | 126 if (i->second == window) { |
127 ShelfModel* model = Shell::Get()->shelf_model(); | 127 ShelfModel* model = Shell::Get()->shelf_model(); |
128 int index = model->ItemIndexByID(i->first); | 128 int index = model->ItemIndexByID(i->first); |
129 DCHECK_NE(-1, index); | 129 DCHECK_NE(-1, index); |
130 model->RemoveItemAt(index); | 130 model->RemoveItemAt(index); |
(...skipping 12 matching lines...) Expand all Loading... |
143 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 143 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |
144 // All windows in the display has already been removed, so no need to | 144 // All windows in the display has already been removed, so no need to |
145 // remove observers. | 145 // remove observers. |
146 } | 146 } |
147 | 147 |
148 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { | 148 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { |
149 } | 149 } |
150 | 150 |
151 } // namespace shell | 151 } // namespace shell |
152 } // namespace ash | 152 } // namespace ash |
OLD | NEW |