OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/browser/chromeos/extensions/wallpaper_private_api.h" | 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <memory> | 8 #include <memory> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(WindowStateManager); | 163 DISALLOW_COPY_AND_ASSIGN(WindowStateManager); |
164 }; | 164 }; |
165 | 165 |
166 // static | 166 // static |
167 WindowStateManager* g_window_state_manager = NULL; | 167 WindowStateManager* g_window_state_manager = NULL; |
168 | 168 |
169 // static | 169 // static |
170 void WindowStateManager::MinimizeInactiveWindows( | 170 void WindowStateManager::MinimizeInactiveWindows( |
171 const std::string& user_id_hash) { | 171 const std::string& user_id_hash) { |
172 if (!ash::Shell::HasInstance() || ash::Shell::GetInstance()->in_mus()) { | |
sadrul
2016/05/19 19:45:22
If there's a Shell instance, it should never have
msw
2016/05/19 20:22:17
Done.
| |
173 NOTIMPLEMENTED(); | |
174 return; | |
175 } | |
176 | |
172 if (!g_window_state_manager) | 177 if (!g_window_state_manager) |
173 g_window_state_manager = new WindowStateManager(); | 178 g_window_state_manager = new WindowStateManager(); |
174 g_window_state_manager->BuildWindowListAndMinimizeInactiveForUser( | 179 g_window_state_manager->BuildWindowListAndMinimizeInactiveForUser( |
175 user_id_hash, ash::wm::GetActiveWindow()); | 180 user_id_hash, ash::wm::GetActiveWindow()); |
176 } | 181 } |
177 | 182 |
178 // static | 183 // static |
179 void WindowStateManager::RestoreWindows(const std::string& user_id_hash) { | 184 void WindowStateManager::RestoreWindows(const std::string& user_id_hash) { |
185 if (!ash::Shell::HasInstance() || ash::Shell::GetInstance()->in_mus()) { | |
186 NOTIMPLEMENTED(); | |
187 return; | |
188 } | |
189 | |
180 if (!g_window_state_manager) { | 190 if (!g_window_state_manager) { |
181 DCHECK(false) << "This should only be called after calling " | 191 DCHECK(false) << "This should only be called after calling " |
182 << "MinimizeInactiveWindows."; | 192 << "MinimizeInactiveWindows."; |
183 return; | 193 return; |
184 } | 194 } |
185 | 195 |
186 g_window_state_manager->RestoreMinimizedWindows(user_id_hash); | 196 g_window_state_manager->RestoreMinimizedWindows(user_id_hash); |
187 if (g_window_state_manager->user_id_hash_window_list_map_.empty()) { | 197 if (g_window_state_manager->user_id_hash_window_list_map_.empty()) { |
188 delete g_window_state_manager; | 198 delete g_window_state_manager; |
189 g_window_state_manager = NULL; | 199 g_window_state_manager = NULL; |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
963 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { | 973 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { |
964 std::unique_ptr<record_wallpaper_uma::Params> params( | 974 std::unique_ptr<record_wallpaper_uma::Params> params( |
965 record_wallpaper_uma::Params::Create(*args_)); | 975 record_wallpaper_uma::Params::Create(*args_)); |
966 EXTENSION_FUNCTION_VALIDATE(params); | 976 EXTENSION_FUNCTION_VALIDATE(params); |
967 | 977 |
968 user_manager::User::WallpaperType source = getWallpaperType(params->source); | 978 user_manager::User::WallpaperType source = getWallpaperType(params->source); |
969 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, | 979 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, |
970 user_manager::User::WALLPAPER_TYPE_COUNT); | 980 user_manager::User::WALLPAPER_TYPE_COUNT); |
971 return true; | 981 return true; |
972 } | 982 } |
OLD | NEW |