| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/apps/drive/drive_app_converter.h" | 5 #include "chrome/browser/apps/drive/drive_app_converter.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 // url is passed from a DriveAppInfo and should follow icon url definition | 30 // url is passed from a DriveAppInfo and should follow icon url definition |
| 31 // in Drive API: | 31 // in Drive API: |
| 32 // https://developers.google.com/drive/v2/reference/apps#resource | 32 // https://developers.google.com/drive/v2/reference/apps#resource |
| 33 // Each icon url represents a single image associated with a certain size. | 33 // Each icon url represents a single image associated with a certain size. |
| 34 class DriveAppConverter::IconFetcher : public net::URLFetcherDelegate, | 34 class DriveAppConverter::IconFetcher : public net::URLFetcherDelegate, |
| 35 public ImageDecoder::ImageRequest { | 35 public ImageDecoder::ImageRequest { |
| 36 public: | 36 public: |
| 37 IconFetcher(DriveAppConverter* converter, | 37 IconFetcher(DriveAppConverter* converter, |
| 38 const GURL& icon_url, | 38 const GURL& icon_url, |
| 39 int expected_size) | 39 int expected_size) |
| 40 : ImageRequest( | 40 : converter_(converter), |
| 41 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)), | |
| 42 converter_(converter), | |
| 43 icon_url_(icon_url), | 41 icon_url_(icon_url), |
| 44 expected_size_(expected_size) {} | 42 expected_size_(expected_size) {} |
| 45 ~IconFetcher() override {} | 43 ~IconFetcher() override {} |
| 46 | 44 |
| 47 void Start() { | 45 void Start() { |
| 48 fetcher_.reset( | 46 fetcher_.reset( |
| 49 net::URLFetcher::Create(icon_url_, net::URLFetcher::GET, this)); | 47 net::URLFetcher::Create(icon_url_, net::URLFetcher::GET, this)); |
| 50 fetcher_->SetRequestContext(converter_->profile_->GetRequestContext()); | 48 fetcher_->SetRequestContext(converter_->profile_->GetRequestContext()); |
| 51 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); | 49 fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SAVE_COOKIES); |
| 52 fetcher_->Start(); | 50 fetcher_->Start(); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 return; | 194 return; |
| 197 } | 195 } |
| 198 | 196 |
| 199 extension_ = crx_installer_->extension(); | 197 extension_ = crx_installer_->extension(); |
| 200 is_new_install_ = success && crx_installer_->current_version().empty(); | 198 is_new_install_ = success && crx_installer_->current_version().empty(); |
| 201 PostInstallCleanUp(); | 199 PostInstallCleanUp(); |
| 202 | 200 |
| 203 finished_callback_.Run(this, success); | 201 finished_callback_.Run(this, success); |
| 204 // |finished_callback_| could delete this. | 202 // |finished_callback_| could delete this. |
| 205 } | 203 } |
| OLD | NEW |