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

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

Issue 271853002: Allow debug configurations of stub users when wallpaper info may be absent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/ash_switches.h" 10 #include "ash/ash_switches.h"
11 #include "ash/desktop_background/desktop_background_controller.h" 11 #include "ash/desktop_background/desktop_background_controller.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/debug/trace_event.h" 14 #include "base/debug/trace_event.h"
15 #include "base/file_util.h" 15 #include "base/file_util.h"
16 #include "base/files/file_enumerator.h" 16 #include "base/files/file_enumerator.h"
17 #include "base/files/file_path.h" 17 #include "base/files/file_path.h"
18 #include "base/logging.h" 18 #include "base/logging.h"
19 #include "base/metrics/histogram.h" 19 #include "base/metrics/histogram.h"
20 #include "base/path_service.h" 20 #include "base/path_service.h"
21 #include "base/prefs/pref_registry_simple.h" 21 #include "base/prefs/pref_registry_simple.h"
22 #include "base/prefs/pref_service.h" 22 #include "base/prefs/pref_service.h"
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/sys_info.h"
27 #include "base/threading/worker_pool.h" 28 #include "base/threading/worker_pool.h"
28 #include "base/time/time.h" 29 #include "base/time/time.h"
29 #include "base/values.h" 30 #include "base/values.h"
30 #include "chrome/browser/browser_process.h" 31 #include "chrome/browser/browser_process.h"
31 #include "chrome/browser/chrome_notification_types.h" 32 #include "chrome/browser/chrome_notification_types.h"
32 #include "chrome/browser/chromeos/customization_document.h" 33 #include "chrome/browser/chromeos/customization_document.h"
33 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h" 34 #include "chrome/browser/chromeos/extensions/wallpaper_manager_util.h"
34 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h" 35 #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/login_display_host_impl.h"
36 #include "chrome/browser/chromeos/login/startup_utils.h" 37 #include "chrome/browser/chromeos/login/startup_utils.h"
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 SetUserWallpaperDelayed(users[index]->email()); 1327 SetUserWallpaperDelayed(users[index]->email());
1327 } 1328 }
1328 } 1329 }
1329 1330
1330 void WallpaperManager::LoadWallpaper(const std::string& user_id, 1331 void WallpaperManager::LoadWallpaper(const std::string& user_id,
1331 const WallpaperInfo& info, 1332 const WallpaperInfo& info,
1332 bool update_wallpaper, 1333 bool update_wallpaper,
1333 MovableOnDestroyCallbackHolder on_finish) { 1334 MovableOnDestroyCallbackHolder on_finish) {
1334 base::FilePath wallpaper_dir; 1335 base::FilePath wallpaper_dir;
1335 base::FilePath wallpaper_path; 1336 base::FilePath wallpaper_path;
1337
1338 // Do a sanity check that file path information is not empty.
1339 if (info.type == User::ONLINE || info.type == User::DEFAULT) {
1340 if (info.file.empty()) {
1341 if (base::SysInfo::IsRunningOnChromeOS()) {
1342 NOTREACHED() << "User wallpaper info appears to be broken: " << user_id;
1343 } else {
1344 // Filename might be empty on debug configurations when stub users
1345 // were created directly in Local State (for testing). Ignore such
1346 // errors i.e. allowsuch type of debug configurations on the desktop.
1347 LOG(WARNING) << "User wallpaper info is empty: " << user_id;
1348
1349 // |on_finish| callback will get called on destruction.
1350 return;
1351 }
1352 }
1353 }
1354
1336 if (info.type == User::ONLINE) { 1355 if (info.type == User::ONLINE) {
1337 std::string file_name = GURL(info.file).ExtractFileName(); 1356 std::string file_name = GURL(info.file).ExtractFileName();
1338 WallpaperResolution resolution = GetAppropriateResolution(); 1357 WallpaperResolution resolution = GetAppropriateResolution();
1339 // Only solid color wallpapers have stretch layout and they have only one 1358 // Only solid color wallpapers have stretch layout and they have only one
1340 // resolution. 1359 // resolution.
1341 if (info.layout != ash::WALLPAPER_LAYOUT_STRETCH && 1360 if (info.layout != ash::WALLPAPER_LAYOUT_STRETCH &&
1342 resolution == WALLPAPER_RESOLUTION_SMALL) { 1361 resolution == WALLPAPER_RESOLUTION_SMALL) {
1343 file_name = base::FilePath(file_name).InsertBeforeExtension( 1362 file_name = base::FilePath(file_name).InsertBeforeExtension(
1344 kSmallWallpaperSuffix).value(); 1363 kSmallWallpaperSuffix).value();
1345 } 1364 }
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after
1911 } 1930 }
1912 } 1931 }
1913 1932
1914 if (need_update_screen) { 1933 if (need_update_screen) {
1915 DoSetDefaultWallpaper(std::string(), 1934 DoSetDefaultWallpaper(std::string(),
1916 MovableOnDestroyCallbackHolder().Pass()); 1935 MovableOnDestroyCallbackHolder().Pass());
1917 } 1936 }
1918 } 1937 }
1919 1938
1920 } // namespace chromeos 1939 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698