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 14 matching lines...) Expand all Loading... |
25 #include "base/metrics/histogram_macros.h" | 25 #include "base/metrics/histogram_macros.h" |
26 #include "base/path_service.h" | 26 #include "base/path_service.h" |
27 #include "base/strings/string_number_conversions.h" | 27 #include "base/strings/string_number_conversions.h" |
28 #include "base/strings/stringprintf.h" | 28 #include "base/strings/stringprintf.h" |
29 #include "base/threading/worker_pool.h" | 29 #include "base/threading/worker_pool.h" |
30 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 31 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
32 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 32 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
33 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
34 #include "chrome/browser/sync/profile_sync_service_factory.h" | 34 #include "chrome/browser/sync/profile_sync_service_factory.h" |
| 35 #include "chrome/browser/ui/ash/ash_util.h" |
35 #include "chrome/common/chrome_paths.h" | 36 #include "chrome/common/chrome_paths.h" |
36 #include "chrome/common/pref_names.h" | 37 #include "chrome/common/pref_names.h" |
37 #include "chrome/grit/generated_resources.h" | 38 #include "chrome/grit/generated_resources.h" |
38 #include "chromeos/chromeos_switches.h" | 39 #include "chromeos/chromeos_switches.h" |
39 #include "components/browser_sync/browser/profile_sync_service.h" | 40 #include "components/browser_sync/browser/profile_sync_service.h" |
40 #include "components/prefs/pref_service.h" | 41 #include "components/prefs/pref_service.h" |
41 #include "components/user_manager/user.h" | 42 #include "components/user_manager/user.h" |
42 #include "components/user_manager/user_manager.h" | 43 #include "components/user_manager/user_manager.h" |
43 #include "components/wallpaper/wallpaper_layout.h" | 44 #include "components/wallpaper/wallpaper_layout.h" |
44 #include "content/public/browser/browser_thread.h" | 45 #include "content/public/browser/browser_thread.h" |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 | 163 |
163 DISALLOW_COPY_AND_ASSIGN(WindowStateManager); | 164 DISALLOW_COPY_AND_ASSIGN(WindowStateManager); |
164 }; | 165 }; |
165 | 166 |
166 // static | 167 // static |
167 WindowStateManager* g_window_state_manager = NULL; | 168 WindowStateManager* g_window_state_manager = NULL; |
168 | 169 |
169 // static | 170 // static |
170 void WindowStateManager::MinimizeInactiveWindows( | 171 void WindowStateManager::MinimizeInactiveWindows( |
171 const std::string& user_id_hash) { | 172 const std::string& user_id_hash) { |
| 173 if (chrome::IsRunningInMash()) { |
| 174 NOTIMPLEMENTED(); |
| 175 return; |
| 176 } |
| 177 |
172 if (!g_window_state_manager) | 178 if (!g_window_state_manager) |
173 g_window_state_manager = new WindowStateManager(); | 179 g_window_state_manager = new WindowStateManager(); |
174 g_window_state_manager->BuildWindowListAndMinimizeInactiveForUser( | 180 g_window_state_manager->BuildWindowListAndMinimizeInactiveForUser( |
175 user_id_hash, ash::wm::GetActiveWindow()); | 181 user_id_hash, ash::wm::GetActiveWindow()); |
176 } | 182 } |
177 | 183 |
178 // static | 184 // static |
179 void WindowStateManager::RestoreWindows(const std::string& user_id_hash) { | 185 void WindowStateManager::RestoreWindows(const std::string& user_id_hash) { |
| 186 if (chrome::IsRunningInMash()) { |
| 187 NOTIMPLEMENTED(); |
| 188 return; |
| 189 } |
| 190 |
180 if (!g_window_state_manager) { | 191 if (!g_window_state_manager) { |
181 DCHECK(false) << "This should only be called after calling " | 192 DCHECK(false) << "This should only be called after calling " |
182 << "MinimizeInactiveWindows."; | 193 << "MinimizeInactiveWindows."; |
183 return; | 194 return; |
184 } | 195 } |
185 | 196 |
186 g_window_state_manager->RestoreMinimizedWindows(user_id_hash); | 197 g_window_state_manager->RestoreMinimizedWindows(user_id_hash); |
187 if (g_window_state_manager->user_id_hash_window_list_map_.empty()) { | 198 if (g_window_state_manager->user_id_hash_window_list_map_.empty()) { |
188 delete g_window_state_manager; | 199 delete g_window_state_manager; |
189 g_window_state_manager = NULL; | 200 g_window_state_manager = NULL; |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { | 974 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { |
964 std::unique_ptr<record_wallpaper_uma::Params> params( | 975 std::unique_ptr<record_wallpaper_uma::Params> params( |
965 record_wallpaper_uma::Params::Create(*args_)); | 976 record_wallpaper_uma::Params::Create(*args_)); |
966 EXTENSION_FUNCTION_VALIDATE(params); | 977 EXTENSION_FUNCTION_VALIDATE(params); |
967 | 978 |
968 user_manager::User::WallpaperType source = getWallpaperType(params->source); | 979 user_manager::User::WallpaperType source = getWallpaperType(params->source); |
969 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, | 980 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, |
970 user_manager::User::WALLPAPER_TYPE_COUNT); | 981 user_manager::User::WALLPAPER_TYPE_COUNT); |
971 return true; | 982 return true; |
972 } | 983 } |
OLD | NEW |