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/app_mode/kiosk_app_data.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_data.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 | 156 |
157 void ReportResultOnUIThread() { | 157 void ReportResultOnUIThread() { |
158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 158 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
159 | 159 |
160 NotifyClient(); | 160 NotifyClient(); |
161 delete this; | 161 delete this; |
162 } | 162 } |
163 | 163 |
164 // ImageDecoder::Delegate overrides: | 164 // ImageDecoder::Delegate overrides: |
165 virtual void OnImageDecoded(const ImageDecoder* decoder, | 165 virtual void OnImageDecoded(const ImageDecoder* decoder, |
166 const SkBitmap& decoded_image) OVERRIDE { | 166 const SkBitmap& decoded_image) override { |
167 icon_ = gfx::ImageSkia::CreateFrom1xBitmap(decoded_image); | 167 icon_ = gfx::ImageSkia::CreateFrom1xBitmap(decoded_image); |
168 icon_.MakeThreadSafe(); | 168 icon_.MakeThreadSafe(); |
169 ReportResultOnBlockingPool(SUCCESS); | 169 ReportResultOnBlockingPool(SUCCESS); |
170 } | 170 } |
171 | 171 |
172 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) OVERRIDE { | 172 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) override { |
173 ReportResultOnBlockingPool(FAILED_TO_DECODE); | 173 ReportResultOnBlockingPool(FAILED_TO_DECODE); |
174 } | 174 } |
175 | 175 |
176 base::WeakPtr<KioskAppData> client_; | 176 base::WeakPtr<KioskAppData> client_; |
177 base::FilePath icon_path_; | 177 base::FilePath icon_path_; |
178 | 178 |
179 LoadResult load_result_; | 179 LoadResult load_result_; |
180 scoped_refptr<base::SequencedTaskRunner> task_runner_; | 180 scoped_refptr<base::SequencedTaskRunner> task_runner_; |
181 | 181 |
182 gfx::ImageSkia icon_; | 182 gfx::ImageSkia icon_; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 if (client_) | 218 if (client_) |
219 client_->OnWebstoreParseFailure(); | 219 client_->OnWebstoreParseFailure(); |
220 | 220 |
221 delete this; | 221 delete this; |
222 } | 222 } |
223 | 223 |
224 // WebstoreInstallHelper::Delegate overrides: | 224 // WebstoreInstallHelper::Delegate overrides: |
225 virtual void OnWebstoreParseSuccess( | 225 virtual void OnWebstoreParseSuccess( |
226 const std::string& id, | 226 const std::string& id, |
227 const SkBitmap& icon, | 227 const SkBitmap& icon, |
228 base::DictionaryValue* parsed_manifest) OVERRIDE { | 228 base::DictionaryValue* parsed_manifest) override { |
229 // Takes ownership of |parsed_manifest|. | 229 // Takes ownership of |parsed_manifest|. |
230 extensions::Manifest manifest( | 230 extensions::Manifest manifest( |
231 extensions::Manifest::INVALID_LOCATION, | 231 extensions::Manifest::INVALID_LOCATION, |
232 scoped_ptr<base::DictionaryValue>(parsed_manifest)); | 232 scoped_ptr<base::DictionaryValue>(parsed_manifest)); |
233 | 233 |
234 if (!IsValidKioskAppManifest(manifest)) { | 234 if (!IsValidKioskAppManifest(manifest)) { |
235 ReportFailure(); | 235 ReportFailure(); |
236 return; | 236 return; |
237 } | 237 } |
238 | 238 |
239 if (client_) | 239 if (client_) |
240 client_->OnWebstoreParseSuccess(icon); | 240 client_->OnWebstoreParseSuccess(icon); |
241 delete this; | 241 delete this; |
242 } | 242 } |
243 virtual void OnWebstoreParseFailure( | 243 virtual void OnWebstoreParseFailure( |
244 const std::string& id, | 244 const std::string& id, |
245 InstallHelperResultCode result_code, | 245 InstallHelperResultCode result_code, |
246 const std::string& error_message) OVERRIDE { | 246 const std::string& error_message) override { |
247 ReportFailure(); | 247 ReportFailure(); |
248 } | 248 } |
249 | 249 |
250 base::WeakPtr<KioskAppData> client_; | 250 base::WeakPtr<KioskAppData> client_; |
251 | 251 |
252 DISALLOW_COPY_AND_ASSIGN(WebstoreDataParser); | 252 DISALLOW_COPY_AND_ASSIGN(WebstoreDataParser); |
253 }; | 253 }; |
254 | 254 |
255 //////////////////////////////////////////////////////////////////////////////// | 255 //////////////////////////////////////////////////////////////////////////////// |
256 // KioskAppData | 256 // KioskAppData |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
496 if (!response->GetString(key, value)) { | 496 if (!response->GetString(key, value)) { |
497 LOG(ERROR) << "Webstore response error (" << key | 497 LOG(ERROR) << "Webstore response error (" << key |
498 << "): " << ValueToString(response); | 498 << "): " << ValueToString(response); |
499 OnWebstoreResponseParseFailure(kInvalidWebstoreResponseError); | 499 OnWebstoreResponseParseFailure(kInvalidWebstoreResponseError); |
500 return false; | 500 return false; |
501 } | 501 } |
502 return true; | 502 return true; |
503 } | 503 } |
504 | 504 |
505 } // namespace chromeos | 505 } // namespace chromeos |
OLD | NEW |