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

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

Issue 676403002: Sync wallpaper based on sync themes setting (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 <vector> 7 #include <vector>
8 8
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/desktop_background/desktop_background_controller.h" 10 #include "ash/desktop_background/desktop_background_controller.h"
11 #include "ash/shell.h" 11 #include "ash/shell.h"
12 #include "ash/wm/mru_window_tracker.h" 12 #include "ash/wm/mru_window_tracker.h"
13 #include "ash/wm/window_state.h" 13 #include "ash/wm/window_state.h"
14 #include "ash/wm/window_util.h" 14 #include "ash/wm/window_util.h"
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/files/file_enumerator.h" 16 #include "base/files/file_enumerator.h"
17 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
18 #include "base/memory/scoped_ptr.h" 18 #include "base/memory/scoped_ptr.h"
19 #include "base/path_service.h" 19 #include "base/path_service.h"
20 #include "base/prefs/pref_service.h" 20 #include "base/prefs/pref_service.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/stringprintf.h" 22 #include "base/strings/stringprintf.h"
23 #include "base/threading/worker_pool.h" 23 #include "base/threading/worker_pool.h"
24 #include "chrome/browser/browser_process.h" 24 #include "chrome/browser/browser_process.h"
25 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" 25 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
26 #include "chrome/browser/profiles/profile.h" 26 #include "chrome/browser/profiles/profile.h"
27 #include "chrome/browser/sync/profile_sync_service.h"
28 #include "chrome/browser/sync/profile_sync_service_factory.h"
27 #include "chrome/common/chrome_paths.h" 29 #include "chrome/common/chrome_paths.h"
28 #include "chrome/common/pref_names.h" 30 #include "chrome/common/pref_names.h"
29 #include "chrome/grit/generated_resources.h" 31 #include "chrome/grit/generated_resources.h"
30 #include "components/user_manager/user.h" 32 #include "components/user_manager/user.h"
31 #include "components/user_manager/user_manager.h" 33 #include "components/user_manager/user_manager.h"
32 #include "content/public/browser/browser_thread.h" 34 #include "content/public/browser/browser_thread.h"
33 #include "extensions/browser/event_router.h" 35 #include "extensions/browser/event_router.h"
34 #include "grit/components_strings.h" 36 #include "grit/components_strings.h"
35 #include "ui/base/l10n/l10n_util.h" 37 #include "ui/base/l10n/l10n_util.h"
36 #include "ui/base/webui/web_ui_util.h" 38 #include "ui/base/webui/web_ui_util.h"
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 if (!app_name.empty()) 287 if (!app_name.empty())
286 dict->SetString("wallpaperAppName", app_name); 288 dict->SetString("wallpaperAppName", app_name);
287 289
288 dict->SetBoolean("isOEMDefaultWallpaper", IsOEMDefaultWallpaper()); 290 dict->SetBoolean("isOEMDefaultWallpaper", IsOEMDefaultWallpaper());
289 dict->SetBoolean("isExperimental", false); 291 dict->SetBoolean("isExperimental", false);
290 dict->SetString("canceledWallpaper", 292 dict->SetString("canceledWallpaper",
291 wallpaper_api_util::kCancelWallpaperMessage); 293 wallpaper_api_util::kCancelWallpaperMessage);
292 return true; 294 return true;
293 } 295 }
294 296
297 bool WallpaperPrivateGetSyncSettingFunction::RunSync() {
298 Profile* profile = Profile::FromBrowserContext(browser_context());
299 ProfileSyncService* sync =
300 ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile);
301 base::DictionaryValue* dict = new base::DictionaryValue();
302 SetResult(dict);
303 dict->SetBoolean("syncThemes",
304 sync->GetActiveDataTypes().Has(syncer::THEMES));
305 return true;
306 }
307
295 WallpaperPrivateSetWallpaperIfExistsFunction:: 308 WallpaperPrivateSetWallpaperIfExistsFunction::
296 WallpaperPrivateSetWallpaperIfExistsFunction() {} 309 WallpaperPrivateSetWallpaperIfExistsFunction() {}
297 310
298 WallpaperPrivateSetWallpaperIfExistsFunction:: 311 WallpaperPrivateSetWallpaperIfExistsFunction::
299 ~WallpaperPrivateSetWallpaperIfExistsFunction() {} 312 ~WallpaperPrivateSetWallpaperIfExistsFunction() {}
300 313
301 bool WallpaperPrivateSetWallpaperIfExistsFunction::RunAsync() { 314 bool WallpaperPrivateSetWallpaperIfExistsFunction::RunAsync() {
302 #if !defined(USE_ATHENA) 315 #if !defined(USE_ATHENA)
303 // TODO(bshe): Support wallpaper manager in Athena, crbug.com/408734. 316 // TODO(bshe): Support wallpaper manager in Athena, crbug.com/408734.
304 params = set_wallpaper_if_exists::Params::Create(*args_); 317 params = set_wallpaper_if_exists::Params::Create(*args_);
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
883 this, file_list)); 896 this, file_list));
884 } 897 }
885 898
886 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete( 899 void WallpaperPrivateGetOfflineWallpaperListFunction::OnComplete(
887 const std::vector<std::string>& file_list) { 900 const std::vector<std::string>& file_list) {
888 base::ListValue* results = new base::ListValue(); 901 base::ListValue* results = new base::ListValue();
889 results->AppendStrings(file_list); 902 results->AppendStrings(file_list);
890 SetResult(results); 903 SetResult(results);
891 SendResponse(true); 904 SendResponse(true);
892 } 905 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698