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

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

Issue 10815047: Save user selected wallpaper information to local state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | chrome/browser/chromeos/login/wallpaper_manager.h » ('j') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_private_api.h" 5 #include "chrome/browser/chromeos/extensions/wallpaper_private_api.h"
6 6
7 #include "ash/desktop_background/desktop_background_controller.h"
8 #include "ash/shell.h"
9 #include "base/file_util.h" 7 #include "base/file_util.h"
10 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
11 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
12 #include "base/path_service.h" 10 #include "base/path_service.h"
13 #include "base/synchronization/cancellation_flag.h" 11 #include "base/synchronization/cancellation_flag.h"
14 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/chromeos/login/user_manager.h" 13 #include "chrome/browser/chromeos/login/user_manager.h"
16 #include "chrome/browser/chromeos/login/wallpaper_manager.h" 14 #include "chrome/browser/chromeos/login/wallpaper_manager.h"
17 #include "chrome/browser/extensions/extension_event_router.h" 15 #include "chrome/browser/extensions/extension_event_router.h"
18 #include "chrome/browser/image_decoder.h" 16 #include "chrome/browser/image_decoder.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 scoped_refptr<WallpaperSetWallpaperFunction> function_; 90 scoped_refptr<WallpaperSetWallpaperFunction> function_;
93 scoped_refptr<ImageDecoder> image_decoder_; 91 scoped_refptr<ImageDecoder> image_decoder_;
94 base::CancellationFlag cancel_flag_; 92 base::CancellationFlag cancel_flag_;
95 93
96 DISALLOW_COPY_AND_ASSIGN(WallpaperDecoder); 94 DISALLOW_COPY_AND_ASSIGN(WallpaperDecoder);
97 }; 95 };
98 96
99 WallpaperSetWallpaperFunction::WallpaperDecoder* 97 WallpaperSetWallpaperFunction::WallpaperDecoder*
100 WallpaperSetWallpaperFunction::wallpaper_decoder_; 98 WallpaperSetWallpaperFunction::wallpaper_decoder_;
101 99
102 WallpaperSetWallpaperFunction::WallpaperSetWallpaperFunction(){ 100 WallpaperSetWallpaperFunction::WallpaperSetWallpaperFunction(){
Nikita (slow) 2012/07/24 17:06:54 nit: missing space before {
103 } 101 }
104 102
105 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction(){ 103 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction(){
Nikita (slow) 2012/07/24 17:06:54 nit: missing space before {
106 } 104 }
107 105
108 bool WallpaperSetWallpaperFunction::RunImpl() { 106 bool WallpaperSetWallpaperFunction::RunImpl() {
109 BinaryValue* input = NULL; 107 BinaryValue* input = NULL;
110 if (args_ == NULL || !args_->GetBinary(0, &input)) { 108 if (args_ == NULL || !args_->GetBinary(0, &input)) {
111 return false; 109 return false;
112 } 110 }
113 std::string layout_string; 111 std::string layout_string;
114 if (!args_->GetString(1, &layout_string) || layout_string.empty()) { 112 if (!args_->GetString(1, &layout_string) || layout_string.empty()) {
115 return false; 113 return false;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 this)); 167 this));
170 } else { 168 } else {
171 BrowserThread::PostTask( 169 BrowserThread::PostTask(
172 BrowserThread::UI, FROM_HERE, 170 BrowserThread::UI, FROM_HERE,
173 base::Bind(&WallpaperSetWallpaperFunction::OnFail, 171 base::Bind(&WallpaperSetWallpaperFunction::OnFail,
174 this)); 172 this));
175 } 173 }
176 } 174 }
177 175
178 void WallpaperSetWallpaperFunction::SetDecodedWallpaper() { 176 void WallpaperSetWallpaperFunction::SetDecodedWallpaper() {
179 ash::Shell::GetInstance()->desktop_background_controller()-> 177 chromeos::WallpaperManager* wallpaper_manager =
180 SetCustomWallpaper(wallpaper_, layout_); 178 chromeos::WallpaperManager::Get();
179 wallpaper_manager->SetWallpaperFromImageSkia(wallpaper_, layout_);
180 wallpaper_manager->SaveUserWallpaperInfo(email_, file_name_, layout_,
181 chromeos::User::DEFAULT);
181 wallpaper_decoder_ = NULL; 182 wallpaper_decoder_ = NULL;
182 SendResponse(true); 183 SendResponse(true);
183 } 184 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/wallpaper_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698