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/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/ash_switches.h" | 10 #include "ash/ash_switches.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "base/prefs/scoped_user_pref_update.h" | 23 #include "base/prefs/scoped_user_pref_update.h" |
24 #include "base/strings/string_number_conversions.h" | 24 #include "base/strings/string_number_conversions.h" |
25 #include "base/strings/string_util.h" | 25 #include "base/strings/string_util.h" |
26 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
27 #include "base/threading/worker_pool.h" | 27 #include "base/threading/worker_pool.h" |
28 #include "base/time/time.h" | 28 #include "base/time/time.h" |
29 #include "base/values.h" | 29 #include "base/values.h" |
30 #include "chrome/browser/browser_process.h" | 30 #include "chrome/browser/browser_process.h" |
31 #include "chrome/browser/chrome_notification_types.h" | 31 #include "chrome/browser/chrome_notification_types.h" |
32 #include "chrome/browser/chromeos/customization_document.h" | 32 #include "chrome/browser/chromeos/customization_document.h" |
33 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" | |
34 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" | |
35 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | |
36 #include "chrome/browser/chromeos/login/startup_utils.h" | 33 #include "chrome/browser/chromeos/login/startup_utils.h" |
37 #include "chrome/browser/chromeos/login/user.h" | 34 #include "chrome/browser/chromeos/login/user.h" |
38 #include "chrome/browser/chromeos/login/user_image.h" | 35 #include "chrome/browser/chromeos/login/user_image.h" |
39 #include "chrome/browser/chromeos/login/user_manager.h" | 36 #include "chrome/browser/chromeos/login/user_manager.h" |
40 #include "chrome/browser/chromeos/login/wizard_controller.h" | 37 #include "chrome/browser/chromeos/login/wizard_controller.h" |
41 #include "chrome/browser/chromeos/settings/cros_settings.h" | 38 #include "chrome/browser/chromeos/settings/cros_settings.h" |
42 #include "chrome/browser/extensions/extension_service.h" | |
43 #include "chrome/common/chrome_paths.h" | 39 #include "chrome/common/chrome_paths.h" |
44 #include "chrome/common/chrome_switches.h" | 40 #include "chrome/common/chrome_switches.h" |
45 #include "chrome/common/pref_names.h" | 41 #include "chrome/common/pref_names.h" |
46 #include "chromeos/chromeos_switches.h" | 42 #include "chromeos/chromeos_switches.h" |
47 #include "chromeos/dbus/dbus_thread_manager.h" | 43 #include "chromeos/dbus/dbus_thread_manager.h" |
48 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
49 #include "content/public/browser/notification_service.h" | 45 #include "content/public/browser/notification_service.h" |
50 #include "content/public/browser/web_ui.h" | |
51 #include "extensions/browser/event_router.h" | |
52 #include "grit/ash_resources.h" | 46 #include "grit/ash_resources.h" |
53 #include "ui/base/resource/resource_bundle.h" | 47 #include "ui/base/resource/resource_bundle.h" |
54 #include "ui/gfx/codec/jpeg_codec.h" | 48 #include "ui/gfx/codec/jpeg_codec.h" |
55 #include "ui/gfx/image/image_skia_operations.h" | 49 #include "ui/gfx/image/image_skia_operations.h" |
56 #include "ui/gfx/skia_util.h" | 50 #include "ui/gfx/skia_util.h" |
57 | 51 |
58 using content::BrowserThread; | 52 using content::BrowserThread; |
59 | 53 |
60 namespace chromeos { | 54 namespace chromeos { |
61 | 55 |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1158 } | 1152 } |
1159 | 1153 |
1160 void WallpaperManager::AddObserver(WallpaperManager::Observer* observer) { | 1154 void WallpaperManager::AddObserver(WallpaperManager::Observer* observer) { |
1161 observers_.AddObserver(observer); | 1155 observers_.AddObserver(observer); |
1162 } | 1156 } |
1163 | 1157 |
1164 void WallpaperManager::RemoveObserver(WallpaperManager::Observer* observer) { | 1158 void WallpaperManager::RemoveObserver(WallpaperManager::Observer* observer) { |
1165 observers_.RemoveObserver(observer); | 1159 observers_.RemoveObserver(observer); |
1166 } | 1160 } |
1167 | 1161 |
1168 void WallpaperManager::EnableSurpriseMe() { | |
1169 Profile* profile = ProfileManager::GetActiveUserProfile(); | |
1170 DCHECK(profile); | |
1171 DCHECK(extensions::EventRouter::Get(profile)); | |
1172 | |
1173 using namespace extensions::api::wallpaper_private; | |
1174 scoped_ptr<extensions::Event> event( | |
1175 new extensions::Event(OnRequestEnableSurpriseMe::kEventName, | |
1176 OnRequestEnableSurpriseMe::Create())); | |
1177 | |
1178 extensions::EventRouter::Get(profile)->DispatchEventToExtension( | |
1179 extension_misc::kWallpaperManagerId, event.Pass()); | |
1180 } | |
1181 | |
1182 void WallpaperManager::NotifyAnimationFinished() { | 1162 void WallpaperManager::NotifyAnimationFinished() { |
1183 FOR_EACH_OBSERVER( | 1163 FOR_EACH_OBSERVER( |
1184 Observer, observers_, OnWallpaperAnimationFinished(last_selected_user_)); | 1164 Observer, observers_, OnWallpaperAnimationFinished(last_selected_user_)); |
1185 } | 1165 } |
1186 | 1166 |
1187 // WallpaperManager, private: -------------------------------------------------- | 1167 // WallpaperManager, private: -------------------------------------------------- |
1188 | 1168 |
1189 bool WallpaperManager::GetWallpaperFromCache(const std::string& user_id, | 1169 bool WallpaperManager::GetWallpaperFromCache(const std::string& user_id, |
1190 gfx::ImageSkia* image) { | 1170 gfx::ImageSkia* image) { |
1191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 1171 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1911 } | 1891 } |
1912 } | 1892 } |
1913 | 1893 |
1914 if (need_update_screen) { | 1894 if (need_update_screen) { |
1915 DoSetDefaultWallpaper(std::string(), | 1895 DoSetDefaultWallpaper(std::string(), |
1916 MovableOnDestroyCallbackHolder().Pass()); | 1896 MovableOnDestroyCallbackHolder().Pass()); |
1917 } | 1897 } |
1918 } | 1898 } |
1919 | 1899 |
1920 } // namespace chromeos | 1900 } // namespace chromeos |
OLD | NEW |