| 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/files/file_util.h" | 8 #include "base/files/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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 net::URLFetcher::GET, | 47 net::URLFetcher::GET, |
| 48 this)); | 48 this)); |
| 49 url_fetcher_->SetRequestContext( | 49 url_fetcher_->SetRequestContext( |
| 50 g_browser_process->system_request_context()); | 50 g_browser_process->system_request_context()); |
| 51 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 51 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
| 52 url_fetcher_->Start(); | 52 url_fetcher_->Start(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 private: | 55 private: |
| 56 // URLFetcherDelegate overrides: | 56 // URLFetcherDelegate overrides: |
| 57 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE { | 57 virtual void OnURLFetchComplete(const net::URLFetcher* source) override { |
| 58 DCHECK(url_fetcher_.get() == source); | 58 DCHECK(url_fetcher_.get() == source); |
| 59 | 59 |
| 60 bool success = source->GetStatus().is_success() && | 60 bool success = source->GetStatus().is_success() && |
| 61 source->GetResponseCode() == net::HTTP_OK; | 61 source->GetResponseCode() == net::HTTP_OK; |
| 62 std::string response; | 62 std::string response; |
| 63 if (success) { | 63 if (success) { |
| 64 source->GetResponseAsString(&response); | 64 source->GetResponseAsString(&response); |
| 65 } else { | 65 } else { |
| 66 response = base::StringPrintf( | 66 response = base::StringPrintf( |
| 67 "Downloading wallpaper %s failed. The response code is %d.", | 67 "Downloading wallpaper %s failed. The response code is %d.", |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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.data.reset(new std::string(response)); | 212 params_->details.data.reset(new std::string(response)); |
| 213 StartDecode(*params_->details.data); | 213 StartDecode(*params_->details.data); |
| 214 } else { | 214 } else { |
| 215 SetError(response); | 215 SetError(response); |
| 216 SendResponse(false); | 216 SendResponse(false); |
| 217 } | 217 } |
| 218 } | 218 } |
| OLD | NEW |