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 "ash/launcher/launcher.h" | 7 #include "ash/launcher/launcher.h" |
8 #include "ash/launcher/launcher_model.h" | 8 #include "ash/launcher/launcher_model.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 | 84 |
85 SkBitmap icon_bitmap; | 85 SkBitmap icon_bitmap; |
86 icon_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); | 86 icon_bitmap.setConfig(SkBitmap::kARGB_8888_Config, 16, 16); |
87 icon_bitmap.allocPixels(); | 87 icon_bitmap.allocPixels(); |
88 icon_bitmap.eraseARGB(255, | 88 icon_bitmap.eraseARGB(255, |
89 image_count == 0 ? 255 : 0, | 89 image_count == 0 ? 255 : 0, |
90 image_count == 1 ? 255 : 0, | 90 image_count == 1 ? 255 : 0, |
91 image_count == 2 ? 255 : 0); | 91 image_count == 2 ? 255 : 0); |
92 image_count = (image_count + 1) % 3; | 92 image_count = (image_count + 1) % 3; |
93 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, | 93 item.image = gfx::ImageSkia(gfx::ImageSkiaRep(icon_bitmap, |
94 ui::SCALE_FACTOR_NONE)); | 94 ui::SCALE_FACTOR_100P)); |
95 | 95 |
96 model->Add(item); | 96 model->Add(item); |
97 } | 97 } |
98 | 98 |
99 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { | 99 void WindowWatcher::OnWillRemoveWindow(aura::Window* window) { |
100 for (IDToWindow::iterator i = id_to_window_.begin(); | 100 for (IDToWindow::iterator i = id_to_window_.begin(); |
101 i != id_to_window_.end(); ++i) { | 101 i != id_to_window_.end(); ++i) { |
102 if (i->second == window) { | 102 if (i->second == window) { |
103 ash::LauncherModel* model = Launcher::ForPrimaryDisplay()->model(); | 103 ash::LauncherModel* model = Launcher::ForPrimaryDisplay()->model(); |
104 int index = model->ItemIndexByID(i->first); | 104 int index = model->ItemIndexByID(i->first); |
105 DCHECK_NE(-1, index); | 105 DCHECK_NE(-1, index); |
106 model->RemoveItemAt(index); | 106 model->RemoveItemAt(index); |
107 id_to_window_.erase(i); | 107 id_to_window_.erase(i); |
108 break; | 108 break; |
109 } | 109 } |
110 } | 110 } |
111 } | 111 } |
112 | 112 |
113 } // namespace shell | 113 } // namespace shell |
114 } // namespace ash | 114 } // namespace ash |
OLD | NEW |