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

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

Issue 2772313004: [ash-md] WIP Added wallpaper color caching. (Closed)
Patch Set: "Working'ish" prototype Created 3 years, 8 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
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 <utility> 7 #include <utility>
8 8
9 #include "ash/common/ash_constants.h" 9 #include "ash/common/ash_constants.h"
10 #include "ash/common/wallpaper/wallpaper_controller.h" 10 #include "ash/common/wallpaper/wallpaper_controller.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "chrome/common/pref_names.h" 42 #include "chrome/common/pref_names.h"
43 #include "chromeos/chromeos_switches.h" 43 #include "chromeos/chromeos_switches.h"
44 #include "chromeos/cryptohome/system_salt_getter.h" 44 #include "chromeos/cryptohome/system_salt_getter.h"
45 #include "components/prefs/pref_registry_simple.h" 45 #include "components/prefs/pref_registry_simple.h"
46 #include "components/prefs/pref_service.h" 46 #include "components/prefs/pref_service.h"
47 #include "components/prefs/scoped_user_pref_update.h" 47 #include "components/prefs/scoped_user_pref_update.h"
48 #include "components/signin/core/account_id/account_id.h" 48 #include "components/signin/core/account_id/account_id.h"
49 #include "components/user_manager/known_user.h" 49 #include "components/user_manager/known_user.h"
50 #include "components/user_manager/user_names.h" 50 #include "components/user_manager/user_names.h"
51 #include "components/user_manager/user_type.h" 51 #include "components/user_manager/user_type.h"
52 #include "components/wallpaper/pref_based_wallpaper_color_cache.h"
52 #include "components/wallpaper/wallpaper_files_id.h" 53 #include "components/wallpaper/wallpaper_files_id.h"
53 #include "components/wallpaper/wallpaper_layout.h" 54 #include "components/wallpaper/wallpaper_layout.h"
54 #include "content/public/browser/browser_thread.h" 55 #include "content/public/browser/browser_thread.h"
55 #include "content/public/browser/notification_service.h" 56 #include "content/public/browser/notification_service.h"
56 #include "content/public/common/content_switches.h" 57 #include "content/public/common/content_switches.h"
57 #include "content/public/common/service_manager_connection.h" 58 #include "content/public/common/service_manager_connection.h"
58 #include "crypto/sha2.h" 59 #include "crypto/sha2.h"
59 #include "services/service_manager/public/cpp/connector.h" 60 #include "services/service_manager/public/cpp/connector.h"
60 #include "url/gurl.h" 61 #include "url/gurl.h"
61 62
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 DISALLOW_COPY_AND_ASSIGN(PendingWallpaper); 382 DISALLOW_COPY_AND_ASSIGN(PendingWallpaper);
382 }; 383 };
383 384
384 // WallpaperManager, public: --------------------------------------------------- 385 // WallpaperManager, public: ---------------------------------------------------
385 386
386 WallpaperManager::~WallpaperManager() { 387 WallpaperManager::~WallpaperManager() {
387 show_user_name_on_signin_subscription_.reset(); 388 show_user_name_on_signin_subscription_.reset();
388 device_wallpaper_image_subscription_.reset(); 389 device_wallpaper_image_subscription_.reset();
389 user_manager::UserManager::Get()->RemoveSessionStateObserver(this); 390 user_manager::UserManager::Get()->RemoveSessionStateObserver(this);
390 weak_factory_.InvalidateWeakPtrs(); 391 weak_factory_.InvalidateWeakPtrs();
392
393 if (wallpaper_color_cache_) {
394 ash::Shell::GetInstance()->wallpaper_controller()->SetWallpaperColorCache(
jonross 2017/03/28 14:33:27 This pattern is the older method of having chrome
395 nullptr);
396 }
391 } 397 }
392 398
393 // static 399 // static
394 void WallpaperManager::Initialize() { 400 void WallpaperManager::Initialize() {
395 CHECK(!wallpaper_manager); 401 CHECK(!wallpaper_manager);
396 wallpaper_manager = new WallpaperManager(); 402 wallpaper_manager = new WallpaperManager();
397 } 403 }
398 404
399 // static 405 // static
400 WallpaperManager* WallpaperManager::Get() { 406 WallpaperManager* WallpaperManager::Get() {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 // used here to determine if current user is guest. 472 // used here to determine if current user is guest.
467 return; 473 return;
468 } 474 }
469 475
470 if (command_line->HasSwitch(::switches::kTestType)) 476 if (command_line->HasSwitch(::switches::kTestType))
471 WizardController::SetZeroDelays(); 477 WizardController::SetZeroDelays();
472 478
473 // Zero delays is also set in autotests. 479 // Zero delays is also set in autotests.
474 if (WizardController::IsZeroDelayEnabled()) { 480 if (WizardController::IsZeroDelayEnabled()) {
475 // Ensure tests have some sort of wallpaper. 481 // Ensure tests have some sort of wallpaper.
482 // Foobar();
476 ash::Shell::GetInstance()->wallpaper_controller()->CreateEmptyWallpaper(); 483 ash::Shell::GetInstance()->wallpaper_controller()->CreateEmptyWallpaper();
477 return; 484 return;
478 } 485 }
479 486
480 if (!user_manager->IsUserLoggedIn()) { 487 if (!user_manager->IsUserLoggedIn()) {
481 if (!StartupUtils::IsDeviceRegistered()) 488 if (!StartupUtils::IsDeviceRegistered())
482 SetDefaultWallpaperDelayed(user_manager::SignInAccountId()); 489 SetDefaultWallpaperDelayed(user_manager::SignInAccountId());
483 else 490 else
484 InitializeRegisteredDeviceWallpaper(); 491 InitializeRegisteredDeviceWallpaper();
485 return; 492 return;
(...skipping 875 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 } 1368 }
1362 1369
1363 void WallpaperManager::SetDefaultWallpaperPath( 1370 void WallpaperManager::SetDefaultWallpaperPath(
1364 const base::FilePath& default_small_wallpaper_file, 1371 const base::FilePath& default_small_wallpaper_file,
1365 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image, 1372 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image,
1366 const base::FilePath& default_large_wallpaper_file, 1373 const base::FilePath& default_large_wallpaper_file,
1367 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) { 1374 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image) {
1368 default_small_wallpaper_file_ = default_small_wallpaper_file; 1375 default_small_wallpaper_file_ = default_small_wallpaper_file;
1369 default_large_wallpaper_file_ = default_large_wallpaper_file; 1376 default_large_wallpaper_file_ = default_large_wallpaper_file;
1370 1377
1378 // Foobar();
1371 ash::WallpaperController* controller = 1379 ash::WallpaperController* controller =
1372 ash::Shell::GetInstance()->wallpaper_controller(); 1380 ash::Shell::GetInstance()->wallpaper_controller();
1373 1381
1374 // |need_update_screen| is true if the previous default wallpaper is visible 1382 // |need_update_screen| is true if the previous default wallpaper is visible
1375 // now, so we need to update wallpaper on the screen. 1383 // now, so we need to update wallpaper on the screen.
1376 // 1384 //
1377 // Layout is ignored here, so wallpaper::WALLPAPER_LAYOUT_CENTER is used 1385 // Layout is ignored here, so wallpaper::WALLPAPER_LAYOUT_CENTER is used
1378 // as a placeholder only. 1386 // as a placeholder only.
1379 const bool need_update_screen = 1387 const bool need_update_screen =
1380 default_wallpaper_image_.get() && 1388 default_wallpaper_image_.get() &&
(...skipping 25 matching lines...) Expand all
1406 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user); 1414 Profile* profile = ProfileHelper::Get()->GetProfileByUser(user);
1407 1415
1408 UMA_HISTOGRAM_ENUMERATION( 1416 UMA_HISTOGRAM_ENUMERATION(
1409 "Ash.Wallpaper.Apps", 1417 "Ash.Wallpaper.Apps",
1410 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile) 1418 wallpaper_manager_util::ShouldUseAndroidWallpapersApp(profile)
1411 ? WALLPAPERS_APP_ANDROID 1419 ? WALLPAPERS_APP_ANDROID
1412 : WALLPAPERS_PICKER_APP_CHROMEOS, 1420 : WALLPAPERS_PICKER_APP_CHROMEOS,
1413 WALLPAPERS_APPS_NUM); 1421 WALLPAPERS_APPS_NUM);
1414 } 1422 }
1415 1423
1424 // void WallpaperManager::Foobar() {
1425 // // TODO(bruthig): Install a color cache in Mash.
1426 // LOG(ERROR) << " *** " << __FUNCTION__ << "() line=" << __LINE__ << "
1427 // HERE!!!"; static int count = 0; if (count <= 0) {
1428 // ++count;
1429 // LOG(ERROR) << " *** " << __FUNCTION__ << "() line=" << __LINE__ << "
1430 // Installed"; wallpaper_color_cache_ =
1431 // base::MakeUnique<wallpaper::PrefBasedWallpaperColorCache>(
1432 // g_browser_process->local_state());
1433 // ash::Shell::GetInstance()->wallpaper_controller()->SetWallpaperColorCache (
1434 // wallpaper_color_cache_.get());
1435 // } else {
1436
1437 // LOG(ERROR) << " *** " << __FUNCTION__ << "() line=" << __LINE__ << "
1438 // ash_util::IsRunningInMash()=" << ash_util::IsRunningInMash() << "
1439 // ash::Shell::HasInstance()=" << ash::Shell::HasInstance();
1440 // }
1441 // }
1442
1416 } // namespace chromeos 1443 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698