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

Side by Side Diff: chrome/browser/chromeos/login/wallpaper_manager.cc

Issue 162393002: Enable surprise me wallpaper for new profiles. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 6 years, 9 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 | Annotate | Revision Log
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/login/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
6 6
7 #include <numeric> 7 #include <numeric>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/shell.h" 10 #include "ash/shell.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/debug/trace_event.h" 12 #include "base/debug/trace_event.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_enumerator.h" 14 #include "base/files/file_enumerator.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/logging.h" 16 #include "base/logging.h"
17 #include "base/metrics/histogram.h" 17 #include "base/metrics/histogram.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/prefs/pref_registry_simple.h" 19 #include "base/prefs/pref_registry_simple.h"
20 #include "base/prefs/pref_service.h" 20 #include "base/prefs/pref_service.h"
21 #include "base/prefs/scoped_user_pref_update.h" 21 #include "base/prefs/scoped_user_pref_update.h"
22 #include "base/strings/string_number_conversions.h" 22 #include "base/strings/string_number_conversions.h"
23 #include "base/strings/string_util.h" 23 #include "base/strings/string_util.h"
24 #include "base/strings/stringprintf.h" 24 #include "base/strings/stringprintf.h"
25 #include "base/threading/worker_pool.h" 25 #include "base/threading/worker_pool.h"
26 #include "base/time/time.h" 26 #include "base/time/time.h"
27 #include "base/values.h" 27 #include "base/values.h"
28 #include "chrome/browser/browser_process.h" 28 #include "chrome/browser/browser_process.h"
29 #include "chrome/browser/chrome_notification_types.h" 29 #include "chrome/browser/chrome_notification_types.h"
30 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h"
31 #include "chrome/browser/chromeos/login/login_display_host_impl.h"
30 #include "chrome/browser/chromeos/login/startup_utils.h" 32 #include "chrome/browser/chromeos/login/startup_utils.h"
31 #include "chrome/browser/chromeos/login/user.h" 33 #include "chrome/browser/chromeos/login/user.h"
32 #include "chrome/browser/chromeos/login/user_manager.h" 34 #include "chrome/browser/chromeos/login/user_manager.h"
33 #include "chrome/browser/chromeos/login/wizard_controller.h" 35 #include "chrome/browser/chromeos/login/wizard_controller.h"
34 #include "chrome/browser/chromeos/settings/cros_settings.h" 36 #include "chrome/browser/chromeos/settings/cros_settings.h"
35 #include "chrome/common/chrome_paths.h" 37 #include "chrome/common/chrome_paths.h"
36 #include "chrome/common/chrome_switches.h" 38 #include "chrome/common/chrome_switches.h"
37 #include "chrome/common/pref_names.h" 39 #include "chrome/common/pref_names.h"
38 #include "chromeos/chromeos_switches.h" 40 #include "chromeos/chromeos_switches.h"
39 #include "chromeos/dbus/dbus_thread_manager.h" 41 #include "chromeos/dbus/dbus_thread_manager.h"
40 #include "content/public/browser/browser_thread.h" 42 #include "content/public/browser/browser_thread.h"
41 #include "content/public/browser/notification_service.h" 43 #include "content/public/browser/notification_service.h"
44 #include "content/public/browser/web_ui.h"
42 #include "ui/base/resource/resource_bundle.h" 45 #include "ui/base/resource/resource_bundle.h"
43 #include "ui/gfx/codec/jpeg_codec.h" 46 #include "ui/gfx/codec/jpeg_codec.h"
44 #include "ui/gfx/image/image_skia_operations.h" 47 #include "ui/gfx/image/image_skia_operations.h"
45 #include "ui/gfx/skia_util.h" 48 #include "ui/gfx/skia_util.h"
46 49
47 using content::BrowserThread; 50 using content::BrowserThread;
48 51
49 namespace { 52 namespace {
50 53
51 // The amount of delay before starts to move custom wallpapers to the new place. 54 // The amount of delay before starts to move custom wallpapers to the new place.
(...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 } 846 }
844 847
845 void WallpaperManager::AddObserver(WallpaperManager::Observer* observer) { 848 void WallpaperManager::AddObserver(WallpaperManager::Observer* observer) {
846 observers_.AddObserver(observer); 849 observers_.AddObserver(observer);
847 } 850 }
848 851
849 void WallpaperManager::RemoveObserver(WallpaperManager::Observer* observer) { 852 void WallpaperManager::RemoveObserver(WallpaperManager::Observer* observer) {
850 observers_.RemoveObserver(observer); 853 observers_.RemoveObserver(observer);
851 } 854 }
852 855
856 void WallpaperManager::EnableSurpriseMe() {
857 static_cast<chromeos::LoginDisplayHostImpl*>(
858 chromeos::LoginDisplayHostImpl::default_host())
Nikita (slow) 2014/02/28 10:44:14 I assumes this call may happen inside session (whe
859 ->GetOobeUI()
860 ->web_ui()
861 ->CallJavascriptFunction("SurpriseWallpaper.prototype.enableSurpriseMe");
862 }
863
853 void WallpaperManager::NotifyAnimationFinished() { 864 void WallpaperManager::NotifyAnimationFinished() {
854 FOR_EACH_OBSERVER( 865 FOR_EACH_OBSERVER(
855 Observer, observers_, OnWallpaperAnimationFinished(last_selected_user_)); 866 Observer, observers_, OnWallpaperAnimationFinished(last_selected_user_));
856 } 867 }
857 868
858 // WallpaperManager, private: -------------------------------------------------- 869 // WallpaperManager, private: --------------------------------------------------
859 870
860 bool WallpaperManager::GetWallpaperFromCache(const std::string& user_id, 871 bool WallpaperManager::GetWallpaperFromCache(const std::string& user_id,
861 gfx::ImageSkia* wallpaper) { 872 gfx::ImageSkia* wallpaper) {
862 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 873 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
1389 loading_.push_back(new WallpaperManager::PendingWallpaper( 1400 loading_.push_back(new WallpaperManager::PendingWallpaper(
1390 (delayed ? GetWallpaperLoadDelay() 1401 (delayed ? GetWallpaperLoadDelay()
1391 : base::TimeDelta::FromMilliseconds(0)), 1402 : base::TimeDelta::FromMilliseconds(0)),
1392 user_id)); 1403 user_id));
1393 pending_inactive_ = loading_.back(); 1404 pending_inactive_ = loading_.back();
1394 } 1405 }
1395 return pending_inactive_; 1406 return pending_inactive_;
1396 } 1407 }
1397 1408
1398 } // namespace chromeos 1409 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698