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 <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/desktop_background/desktop_background_controller.h" | 10 #include "ash/desktop_background/desktop_background_controller.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 | 41 |
42 class WallpaperFetcher : public net::URLFetcherDelegate { | 42 class WallpaperFetcher : public net::URLFetcherDelegate { |
43 public: | 43 public: |
44 WallpaperFetcher() {} | 44 WallpaperFetcher() {} |
45 | 45 |
46 ~WallpaperFetcher() override {} | 46 ~WallpaperFetcher() override {} |
47 | 47 |
48 void FetchWallpaper(const GURL& url, FetchCallback callback) { | 48 void FetchWallpaper(const GURL& url, FetchCallback callback) { |
49 CancelPreviousFetch(); | 49 CancelPreviousFetch(); |
50 callback_ = callback; | 50 callback_ = callback; |
51 url_fetcher_.reset(net::URLFetcher::Create(url, | 51 url_fetcher_ = net::URLFetcher::Create(url, net::URLFetcher::GET, this); |
52 net::URLFetcher::GET, | |
53 this)); | |
54 url_fetcher_->SetRequestContext( | 52 url_fetcher_->SetRequestContext( |
55 g_browser_process->system_request_context()); | 53 g_browser_process->system_request_context()); |
56 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); | 54 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE); |
57 url_fetcher_->Start(); | 55 url_fetcher_->Start(); |
58 } | 56 } |
59 | 57 |
60 private: | 58 private: |
61 // URLFetcherDelegate overrides: | 59 // URLFetcherDelegate overrides: |
62 void OnURLFetchComplete(const net::URLFetcher* source) override { | 60 void OnURLFetchComplete(const net::URLFetcher* source) override { |
63 DCHECK(url_fetcher_.get() == source); | 61 DCHECK(url_fetcher_.get() == source); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 const std::string& response) { | 223 const std::string& response) { |
226 if (success) { | 224 if (success) { |
227 params_->details.data.reset( | 225 params_->details.data.reset( |
228 new std::vector<char>(response.begin(), response.end())); | 226 new std::vector<char>(response.begin(), response.end())); |
229 StartDecode(*params_->details.data); | 227 StartDecode(*params_->details.data); |
230 } else { | 228 } else { |
231 SetError(response); | 229 SetError(response); |
232 SendResponse(false); | 230 SendResponse(false); |
233 } | 231 } |
234 } | 232 } |
OLD | NEW |