| 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 <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 callback_.Run(false, wallpaper_api_util::kCancelWallpaperMessage); | 85 callback_.Run(false, wallpaper_api_util::kCancelWallpaperMessage); |
| 86 callback_.Reset(); | 86 callback_.Reset(); |
| 87 url_fetcher_.reset(); | 87 url_fetcher_.reset(); |
| 88 } | 88 } |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::unique_ptr<net::URLFetcher> url_fetcher_; | 91 std::unique_ptr<net::URLFetcher> url_fetcher_; |
| 92 FetchCallback callback_; | 92 FetchCallback callback_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 base::LazyInstance<WallpaperFetcher> g_wallpaper_fetcher = | 95 base::LazyInstance<WallpaperFetcher>::DestructorAtExit g_wallpaper_fetcher = |
| 96 LAZY_INSTANCE_INITIALIZER; | 96 LAZY_INSTANCE_INITIALIZER; |
| 97 | 97 |
| 98 // Gets the |User| for a given |BrowserContext|. The function will only return | 98 // Gets the |User| for a given |BrowserContext|. The function will only return |
| 99 // valid objects. | 99 // valid objects. |
| 100 const user_manager::User* GetUserFromBrowserContext( | 100 const user_manager::User* GetUserFromBrowserContext( |
| 101 content::BrowserContext* context) { | 101 content::BrowserContext* context) { |
| 102 Profile* profile = Profile::FromBrowserContext(context); | 102 Profile* profile = Profile::FromBrowserContext(context); |
| 103 DCHECK(profile); | 103 DCHECK(profile); |
| 104 const user_manager::User* user = | 104 const user_manager::User* user = |
| 105 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 105 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 const std::string& response) { | 278 const std::string& response) { |
| 279 if (success) { | 279 if (success) { |
| 280 params_->details.data.reset( | 280 params_->details.data.reset( |
| 281 new std::vector<char>(response.begin(), response.end())); | 281 new std::vector<char>(response.begin(), response.end())); |
| 282 StartDecode(*params_->details.data); | 282 StartDecode(*params_->details.data); |
| 283 } else { | 283 } else { |
| 284 SetError(response); | 284 SetError(response); |
| 285 SendResponse(false); | 285 SendResponse(false); |
| 286 } | 286 } |
| 287 } | 287 } |
| OLD | NEW |