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

Side by Side Diff: chrome/browser/chromeos/extensions/wallpaper_api.cc

Issue 375413002: Replace chromeos::UserManager::Get() with chromeos::GetUserManager(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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/extensions/wallpaper_api.h" 5 #include "chrome/browser/chromeos/extensions/wallpaper_api.h"
6 6
7 #include "ash/desktop_background/desktop_background_controller.h" 7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction() { 94 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction() {
95 } 95 }
96 96
97 bool WallpaperSetWallpaperFunction::RunAsync() { 97 bool WallpaperSetWallpaperFunction::RunAsync() {
98 DCHECK_CURRENTLY_ON(BrowserThread::UI); 98 DCHECK_CURRENTLY_ON(BrowserThread::UI);
99 params_ = set_wallpaper::Params::Create(*args_); 99 params_ = set_wallpaper::Params::Create(*args_);
100 EXTENSION_FUNCTION_VALIDATE(params_); 100 EXTENSION_FUNCTION_VALIDATE(params_);
101 101
102 // Gets email address and username hash while at UI thread. 102 // Gets email address and username hash while at UI thread.
103 user_id_ = chromeos::UserManager::Get()->GetLoggedInUser()->email(); 103 user_id_ = chromeos::GetUserManager()->GetLoggedInUser()->email();
104 user_id_hash_ = 104 user_id_hash_ =
105 chromeos::UserManager::Get()->GetLoggedInUser()->username_hash(); 105 chromeos::GetUserManager()->GetLoggedInUser()->username_hash();
106 106
107 if (params_->details.wallpaper_data) { 107 if (params_->details.wallpaper_data) {
108 StartDecode(*params_->details.wallpaper_data); 108 StartDecode(*params_->details.wallpaper_data);
109 } else { 109 } else {
110 GURL wallpaper_url(*params_->details.url); 110 GURL wallpaper_url(*params_->details.url);
111 if (wallpaper_url.is_valid()) { 111 if (wallpaper_url.is_valid()) {
112 g_wallpaper_fetcher.Get().FetchWallpaper( 112 g_wallpaper_fetcher.Get().FetchWallpaper(
113 wallpaper_url, 113 wallpaper_url,
114 base::Bind(&WallpaperSetWallpaperFunction::OnWallpaperFetched, this)); 114 base::Bind(&WallpaperSetWallpaperFunction::OnWallpaperFetched, this));
115 } else { 115 } else {
(...skipping 15 matching lines...) Expand all
131 131
132 sequence_token_ = BrowserThread::GetBlockingPool()-> 132 sequence_token_ = BrowserThread::GetBlockingPool()->
133 GetNamedSequenceToken(chromeos::kWallpaperSequenceTokenName); 133 GetNamedSequenceToken(chromeos::kWallpaperSequenceTokenName);
134 scoped_refptr<base::SequencedTaskRunner> task_runner = 134 scoped_refptr<base::SequencedTaskRunner> task_runner =
135 BrowserThread::GetBlockingPool()-> 135 BrowserThread::GetBlockingPool()->
136 GetSequencedTaskRunnerWithShutdownBehavior(sequence_token_, 136 GetSequencedTaskRunnerWithShutdownBehavior(sequence_token_,
137 base::SequencedWorkerPool::BLOCK_SHUTDOWN); 137 base::SequencedWorkerPool::BLOCK_SHUTDOWN);
138 ash::WallpaperLayout layout = wallpaper_api_util::GetLayoutEnum( 138 ash::WallpaperLayout layout = wallpaper_api_util::GetLayoutEnum(
139 set_wallpaper::Params::Details::ToString(params_->details.layout)); 139 set_wallpaper::Params::Details::ToString(params_->details.layout));
140 bool update_wallpaper = 140 bool update_wallpaper =
141 user_id_ == chromeos::UserManager::Get()->GetActiveUser()->email(); 141 user_id_ == chromeos::GetUserManager()->GetActiveUser()->email();
142 wallpaper_manager->SetCustomWallpaper(user_id_, 142 wallpaper_manager->SetCustomWallpaper(user_id_,
143 user_id_hash_, 143 user_id_hash_,
144 params_->details.name, 144 params_->details.name,
145 layout, 145 layout,
146 chromeos::User::CUSTOMIZED, 146 chromeos::User::CUSTOMIZED,
147 image, 147 image,
148 update_wallpaper); 148 update_wallpaper);
149 unsafe_wallpaper_decoder_ = NULL; 149 unsafe_wallpaper_decoder_ = NULL;
150 150
151 if (params_->details.thumbnail) { 151 if (params_->details.thumbnail) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 bool success, 209 bool success,
210 const std::string& response) { 210 const std::string& response) {
211 if (success) { 211 if (success) {
212 params_->details.wallpaper_data.reset(new std::string(response)); 212 params_->details.wallpaper_data.reset(new std::string(response));
213 StartDecode(*params_->details.wallpaper_data); 213 StartDecode(*params_->details.wallpaper_data);
214 } else { 214 } else {
215 SetError(response); 215 SetError(response);
216 SendResponse(false); 216 SendResponse(false);
217 } 217 }
218 } 218 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/extensions/info_private_api.cc ('k') | chrome/browser/chromeos/extensions/wallpaper_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698