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

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

Issue 378513005: [Athena] Extract Chrome OS authentication stack (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix includes in one more test Created 6 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/users/wallpaper/wallpaper_manager.h" 5 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h"
6 6
7 #include <numeric> 7 #include <numeric>
8 #include <vector> 8 #include <vector>
9 9
10 #include "ash/ash_constants.h" 10 #include "ash/ash_constants.h"
(...skipping 25 matching lines...) Expand all
36 #include "chrome/browser/chromeos/login/users/avatar/user_image.h" 36 #include "chrome/browser/chromeos/login/users/avatar/user_image.h"
37 #include "chrome/browser/chromeos/login/users/user.h" 37 #include "chrome/browser/chromeos/login/users/user.h"
38 #include "chrome/browser/chromeos/login/users/user_manager.h" 38 #include "chrome/browser/chromeos/login/users/user_manager.h"
39 #include "chrome/browser/chromeos/login/wizard_controller.h" 39 #include "chrome/browser/chromeos/login/wizard_controller.h"
40 #include "chrome/browser/chromeos/settings/cros_settings.h" 40 #include "chrome/browser/chromeos/settings/cros_settings.h"
41 #include "chrome/common/chrome_paths.h" 41 #include "chrome/common/chrome_paths.h"
42 #include "chrome/common/chrome_switches.h" 42 #include "chrome/common/chrome_switches.h"
43 #include "chrome/common/pref_names.h" 43 #include "chrome/common/pref_names.h"
44 #include "chromeos/chromeos_switches.h" 44 #include "chromeos/chromeos_switches.h"
45 #include "chromeos/dbus/dbus_thread_manager.h" 45 #include "chromeos/dbus/dbus_thread_manager.h"
46 #include "chromeos/login/user_names.h"
46 #include "components/user_manager/user_type.h" 47 #include "components/user_manager/user_type.h"
47 #include "content/public/browser/browser_thread.h" 48 #include "content/public/browser/browser_thread.h"
48 #include "content/public/browser/notification_service.h" 49 #include "content/public/browser/notification_service.h"
49 #include "third_party/skia/include/core/SkColor.h" 50 #include "third_party/skia/include/core/SkColor.h"
50 #include "ui/gfx/codec/jpeg_codec.h" 51 #include "ui/gfx/codec/jpeg_codec.h"
51 #include "ui/gfx/image/image_skia_operations.h" 52 #include "ui/gfx/image/image_skia_operations.h"
52 #include "ui/gfx/skia_util.h" 53 #include "ui/gfx/skia_util.h"
53 54
54 using content::BrowserThread; 55 using content::BrowserThread;
55 56
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after
615 // Zero delays is also set in autotests. 616 // Zero delays is also set in autotests.
616 if (WizardController::IsZeroDelayEnabled()) { 617 if (WizardController::IsZeroDelayEnabled()) {
617 // Ensure tests have some sort of wallpaper. 618 // Ensure tests have some sort of wallpaper.
618 ash::Shell::GetInstance()->desktop_background_controller()-> 619 ash::Shell::GetInstance()->desktop_background_controller()->
619 CreateEmptyWallpaper(); 620 CreateEmptyWallpaper();
620 return; 621 return;
621 } 622 }
622 623
623 if (!user_manager->IsUserLoggedIn()) { 624 if (!user_manager->IsUserLoggedIn()) {
624 if (!StartupUtils::IsDeviceRegistered()) 625 if (!StartupUtils::IsDeviceRegistered())
625 SetDefaultWallpaperDelayed(UserManager::kSignInUser); 626 SetDefaultWallpaperDelayed(chromeos::login::kSignInUser);
626 else 627 else
627 InitializeRegisteredDeviceWallpaper(); 628 InitializeRegisteredDeviceWallpaper();
628 return; 629 return;
629 } 630 }
630 SetUserWallpaperDelayed(user_manager->GetLoggedInUser()->email()); 631 SetUserWallpaperDelayed(user_manager->GetLoggedInUser()->email());
631 } 632 }
632 633
633 void WallpaperManager::Observe(int type, 634 void WallpaperManager::Observe(int type,
634 const content::NotificationSource& source, 635 const content::NotificationSource& source,
635 const content::NotificationDetails& details) { 636 const content::NotificationDetails& details) {
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 void WallpaperManager::UpdateWallpaper(bool clear_cache) { 1228 void WallpaperManager::UpdateWallpaper(bool clear_cache) {
1228 FOR_EACH_OBSERVER(Observer, observers_, OnUpdateWallpaperForTesting()); 1229 FOR_EACH_OBSERVER(Observer, observers_, OnUpdateWallpaperForTesting());
1229 if (clear_cache) 1230 if (clear_cache)
1230 wallpaper_cache_.clear(); 1231 wallpaper_cache_.clear();
1231 current_wallpaper_path_.clear(); 1232 current_wallpaper_path_.clear();
1232 // For GAIA login flow, the last_selected_user_ may not be set before user 1233 // For GAIA login flow, the last_selected_user_ may not be set before user
1233 // login. If UpdateWallpaper is called at GAIA login screen, no wallpaper will 1234 // login. If UpdateWallpaper is called at GAIA login screen, no wallpaper will
1234 // be set. It could result a black screen on external monitors. 1235 // be set. It could result a black screen on external monitors.
1235 // See http://crbug.com/265689 for detail. 1236 // See http://crbug.com/265689 for detail.
1236 if (last_selected_user_.empty()) { 1237 if (last_selected_user_.empty()) {
1237 SetDefaultWallpaperNow(UserManager::kSignInUser); 1238 SetDefaultWallpaperNow(chromeos::login::kSignInUser);
1238 return; 1239 return;
1239 } 1240 }
1240 SetUserWallpaperNow(last_selected_user_); 1241 SetUserWallpaperNow(last_selected_user_);
1241 } 1242 }
1242 1243
1243 void WallpaperManager::AddObserver(WallpaperManager::Observer* observer) { 1244 void WallpaperManager::AddObserver(WallpaperManager::Observer* observer) {
1244 observers_.AddObserver(observer); 1245 observers_.AddObserver(observer);
1245 } 1246 }
1246 1247
1247 void WallpaperManager::RemoveObserver(WallpaperManager::Observer* observer) { 1248 void WallpaperManager::RemoveObserver(WallpaperManager::Observer* observer) {
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1379 GetCommandLine()->HasSwitch(switches::kDisableBootAnimation); 1380 GetCommandLine()->HasSwitch(switches::kDisableBootAnimation);
1380 bool show_users = true; 1381 bool show_users = true;
1381 bool result = CrosSettings::Get()->GetBoolean( 1382 bool result = CrosSettings::Get()->GetBoolean(
1382 kAccountsPrefShowUserNamesOnSignIn, &show_users); 1383 kAccountsPrefShowUserNamesOnSignIn, &show_users);
1383 DCHECK(result) << "Unable to fetch setting " 1384 DCHECK(result) << "Unable to fetch setting "
1384 << kAccountsPrefShowUserNamesOnSignIn; 1385 << kAccountsPrefShowUserNamesOnSignIn;
1385 const chromeos::UserList& users = UserManager::Get()->GetUsers(); 1386 const chromeos::UserList& users = UserManager::Get()->GetUsers();
1386 int public_session_user_index = FindPublicSession(users); 1387 int public_session_user_index = FindPublicSession(users);
1387 if ((!show_users && public_session_user_index == -1) || users.empty()) { 1388 if ((!show_users && public_session_user_index == -1) || users.empty()) {
1388 // Boot into sign in form, preload default wallpaper. 1389 // Boot into sign in form, preload default wallpaper.
1389 SetDefaultWallpaperDelayed(UserManager::kSignInUser); 1390 SetDefaultWallpaperDelayed(chromeos::login::kSignInUser);
1390 return; 1391 return;
1391 } 1392 }
1392 1393
1393 if (!disable_boot_animation) { 1394 if (!disable_boot_animation) {
1394 int index = public_session_user_index != -1 ? public_session_user_index : 0; 1395 int index = public_session_user_index != -1 ? public_session_user_index : 0;
1395 // Normal boot, load user wallpaper. 1396 // Normal boot, load user wallpaper.
1396 // If normal boot animation is disabled wallpaper would be set 1397 // If normal boot animation is disabled wallpaper would be set
1397 // asynchronously once user pods are loaded. 1398 // asynchronously once user pods are loaded.
1398 SetUserWallpaperDelayed(users[index]->email()); 1399 SetUserWallpaperDelayed(users[index]->email());
1399 } 1400 }
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1903 void WallpaperManager::CreateSolidDefaultWallpaper() { 1904 void WallpaperManager::CreateSolidDefaultWallpaper() {
1904 loaded_wallpapers_++; 1905 loaded_wallpapers_++;
1905 SkBitmap bitmap; 1906 SkBitmap bitmap;
1906 bitmap.allocN32Pixels(1, 1); 1907 bitmap.allocN32Pixels(1, 1);
1907 bitmap.eraseColor(kDefaultWallpaperColor); 1908 bitmap.eraseColor(kDefaultWallpaperColor);
1908 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); 1909 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap);
1909 default_wallpaper_image_.reset(new UserImage(image)); 1910 default_wallpaper_image_.reset(new UserImage(image));
1910 } 1911 }
1911 1912
1912 } // namespace chromeos 1913 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698