Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_private_api.cc

Issue 1984433002: Hook up Chrome's wallpaper picker for mash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add explicit WallpaperLayout enum conversion functions. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 15 matching lines...) Expand all
26 #include "base/metrics/histogram_macros.h" 26 #include "base/metrics/histogram_macros.h"
27 #include "base/path_service.h" 27 #include "base/path_service.h"
28 #include "base/strings/string_number_conversions.h" 28 #include "base/strings/string_number_conversions.h"
29 #include "base/strings/stringprintf.h" 29 #include "base/strings/stringprintf.h"
30 #include "base/threading/worker_pool.h" 30 #include "base/threading/worker_pool.h"
31 #include "chrome/browser/browser_process.h" 31 #include "chrome/browser/browser_process.h"
32 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 32 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
33 #include "chrome/browser/chromeos/profiles/profile_helper.h" 33 #include "chrome/browser/chromeos/profiles/profile_helper.h"
34 #include "chrome/browser/profiles/profile.h" 34 #include "chrome/browser/profiles/profile.h"
35 #include "chrome/browser/sync/profile_sync_service_factory.h" 35 #include "chrome/browser/sync/profile_sync_service_factory.h"
36 #include "chrome/browser/ui/ash/ash_util.h"
36 #include "chrome/common/chrome_paths.h" 37 #include "chrome/common/chrome_paths.h"
37 #include "chrome/common/pref_names.h" 38 #include "chrome/common/pref_names.h"
38 #include "chrome/grit/generated_resources.h" 39 #include "chrome/grit/generated_resources.h"
39 #include "chromeos/chromeos_switches.h" 40 #include "chromeos/chromeos_switches.h"
40 #include "components/browser_sync/browser/profile_sync_service.h" 41 #include "components/browser_sync/browser/profile_sync_service.h"
41 #include "components/prefs/pref_service.h" 42 #include "components/prefs/pref_service.h"
42 #include "components/user_manager/user.h" 43 #include "components/user_manager/user.h"
43 #include "components/user_manager/user_manager.h" 44 #include "components/user_manager/user_manager.h"
44 #include "components/wallpaper/wallpaper_layout.h" 45 #include "components/wallpaper/wallpaper_layout.h"
45 #include "content/public/browser/browser_thread.h" 46 #include "content/public/browser/browser_thread.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 164
164 DISALLOW_COPY_AND_ASSIGN(WindowStateManager); 165 DISALLOW_COPY_AND_ASSIGN(WindowStateManager);
165 }; 166 };
166 167
167 // static 168 // static
168 WindowStateManager* g_window_state_manager = NULL; 169 WindowStateManager* g_window_state_manager = NULL;
169 170
170 // static 171 // static
171 void WindowStateManager::MinimizeInactiveWindows( 172 void WindowStateManager::MinimizeInactiveWindows(
172 const std::string& user_id_hash) { 173 const std::string& user_id_hash) {
174 if (chrome::IsRunningInMash()) {
175 NOTIMPLEMENTED();
176 return;
177 }
178
173 if (!g_window_state_manager) 179 if (!g_window_state_manager)
174 g_window_state_manager = new WindowStateManager(); 180 g_window_state_manager = new WindowStateManager();
175 g_window_state_manager->BuildWindowListAndMinimizeInactiveForUser( 181 g_window_state_manager->BuildWindowListAndMinimizeInactiveForUser(
176 user_id_hash, ash::wm::GetActiveWindow()); 182 user_id_hash, ash::wm::GetActiveWindow());
177 } 183 }
178 184
179 // static 185 // static
180 void WindowStateManager::RestoreWindows(const std::string& user_id_hash) { 186 void WindowStateManager::RestoreWindows(const std::string& user_id_hash) {
187 if (chrome::IsRunningInMash()) {
188 NOTIMPLEMENTED();
189 return;
190 }
191
181 if (!g_window_state_manager) { 192 if (!g_window_state_manager) {
182 DCHECK(false) << "This should only be called after calling " 193 DCHECK(false) << "This should only be called after calling "
183 << "MinimizeInactiveWindows."; 194 << "MinimizeInactiveWindows.";
184 return; 195 return;
185 } 196 }
186 197
187 g_window_state_manager->RestoreMinimizedWindows(user_id_hash); 198 g_window_state_manager->RestoreMinimizedWindows(user_id_hash);
188 if (g_window_state_manager->user_id_hash_window_list_map_.empty()) { 199 if (g_window_state_manager->user_id_hash_window_list_map_.empty()) {
189 delete g_window_state_manager; 200 delete g_window_state_manager;
190 g_window_state_manager = NULL; 201 g_window_state_manager = NULL;
(...skipping 774 matching lines...) Expand 10 before | Expand all | Expand 10 after
965 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() { 976 bool WallpaperPrivateRecordWallpaperUMAFunction::RunSync() {
966 std::unique_ptr<record_wallpaper_uma::Params> params( 977 std::unique_ptr<record_wallpaper_uma::Params> params(
967 record_wallpaper_uma::Params::Create(*args_)); 978 record_wallpaper_uma::Params::Create(*args_));
968 EXTENSION_FUNCTION_VALIDATE(params); 979 EXTENSION_FUNCTION_VALIDATE(params);
969 980
970 user_manager::User::WallpaperType source = getWallpaperType(params->source); 981 user_manager::User::WallpaperType source = getWallpaperType(params->source);
971 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source, 982 UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Source", source,
972 user_manager::User::WALLPAPER_TYPE_COUNT); 983 user_manager::User::WALLPAPER_TYPE_COUNT);
973 return true; 984 return true;
974 } 985 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698