OLD | NEW |
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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 LAZY_INSTANCE_INITIALIZER; | 86 LAZY_INSTANCE_INITIALIZER; |
87 | 87 |
88 } // namespace | 88 } // namespace |
89 | 89 |
90 WallpaperSetWallpaperFunction::WallpaperSetWallpaperFunction() { | 90 WallpaperSetWallpaperFunction::WallpaperSetWallpaperFunction() { |
91 } | 91 } |
92 | 92 |
93 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction() { | 93 WallpaperSetWallpaperFunction::~WallpaperSetWallpaperFunction() { |
94 } | 94 } |
95 | 95 |
96 bool WallpaperSetWallpaperFunction::RunImpl() { | 96 bool WallpaperSetWallpaperFunction::RunAsync() { |
97 params_ = set_wallpaper::Params::Create(*args_); | 97 params_ = set_wallpaper::Params::Create(*args_); |
98 EXTENSION_FUNCTION_VALIDATE(params_); | 98 EXTENSION_FUNCTION_VALIDATE(params_); |
99 | 99 |
100 // Gets email address and username hash while at UI thread. | 100 // Gets email address and username hash while at UI thread. |
101 user_id_ = chromeos::UserManager::Get()->GetLoggedInUser()->email(); | 101 user_id_ = chromeos::UserManager::Get()->GetLoggedInUser()->email(); |
102 user_id_hash_ = | 102 user_id_hash_ = |
103 chromeos::UserManager::Get()->GetLoggedInUser()->username_hash(); | 103 chromeos::UserManager::Get()->GetLoggedInUser()->username_hash(); |
104 | 104 |
105 if (params_->details.wallpaper_data) { | 105 if (params_->details.wallpaper_data) { |
106 StartDecode(*params_->details.wallpaper_data); | 106 StartDecode(*params_->details.wallpaper_data); |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 bool success, | 196 bool success, |
197 const std::string& response) { | 197 const std::string& response) { |
198 if (success) { | 198 if (success) { |
199 params_->details.wallpaper_data.reset(new std::string(response)); | 199 params_->details.wallpaper_data.reset(new std::string(response)); |
200 StartDecode(*params_->details.wallpaper_data); | 200 StartDecode(*params_->details.wallpaper_data); |
201 } else { | 201 } else { |
202 SetError(response); | 202 SetError(response); |
203 SendResponse(false); | 203 SendResponse(false); |
204 } | 204 } |
205 } | 205 } |
OLD | NEW |