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/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 private: | 105 private: |
106 friend class base::RefCountedThreadSafe<IconLoader>; | 106 friend class base::RefCountedThreadSafe<IconLoader>; |
107 | 107 |
108 virtual ~IconLoader() {} | 108 virtual ~IconLoader() {} |
109 | 109 |
110 // Loads the icon from locally stored |icon_path_| on the blocking pool | 110 // Loads the icon from locally stored |icon_path_| on the blocking pool |
111 void LoadOnBlockingPool() { | 111 void LoadOnBlockingPool() { |
112 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 112 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
113 | 113 |
114 std::string data; | 114 std::string data; |
115 if (!file_util::ReadFileToString(base::FilePath(icon_path_), &data)) { | 115 if (!base::ReadFileToString(base::FilePath(icon_path_), &data)) { |
116 ReportResultOnBlockingPool(FAILED_TO_LOAD); | 116 ReportResultOnBlockingPool(FAILED_TO_LOAD); |
117 return; | 117 return; |
118 } | 118 } |
119 raw_icon_ = base::RefCountedString::TakeString(&data); | 119 raw_icon_ = base::RefCountedString::TakeString(&data); |
120 | 120 |
121 scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder( | 121 scoped_refptr<ImageDecoder> image_decoder = new ImageDecoder( |
122 this, raw_icon_->data(), ImageDecoder::DEFAULT_CODEC); | 122 this, raw_icon_->data(), ImageDecoder::DEFAULT_CODEC); |
123 image_decoder->Start(task_runner_); | 123 image_decoder->Start(task_runner_); |
124 } | 124 } |
125 | 125 |
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 icon_url, | 437 icon_url, |
438 GetRequestContextGetter()); | 438 GetRequestContextGetter()); |
439 } | 439 } |
440 | 440 |
441 void KioskAppData::OnWebstoreResponseParseFailure(const std::string& error) { | 441 void KioskAppData::OnWebstoreResponseParseFailure(const std::string& error) { |
442 webstore_fetcher_.reset(); | 442 webstore_fetcher_.reset(); |
443 SetStatus(STATUS_ERROR); | 443 SetStatus(STATUS_ERROR); |
444 } | 444 } |
445 | 445 |
446 } // namespace chromeos | 446 } // namespace chromeos |
OLD | NEW |