| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 // Icon file extension. | 45 // Icon file extension. |
| 46 const char kIconFileExtension[] = ".png"; | 46 const char kIconFileExtension[] = ".png"; |
| 47 | 47 |
| 48 // Save |raw_icon| for given |app_id|. | 48 // Save |raw_icon| for given |app_id|. |
| 49 void SaveIconToLocalOnBlockingPool( | 49 void SaveIconToLocalOnBlockingPool( |
| 50 const base::FilePath& icon_path, | 50 const base::FilePath& icon_path, |
| 51 scoped_refptr<base::RefCountedString> raw_icon) { | 51 scoped_refptr<base::RefCountedString> raw_icon) { |
| 52 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 52 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 53 | 53 |
| 54 base::FilePath dir = icon_path.DirName(); | 54 base::FilePath dir = icon_path.DirName(); |
| 55 if (!file_util::PathExists(dir)) | 55 if (!base::PathExists(dir)) |
| 56 CHECK(file_util::CreateDirectory(dir)); | 56 CHECK(file_util::CreateDirectory(dir)); |
| 57 | 57 |
| 58 CHECK_EQ(static_cast<int>(raw_icon->size()), | 58 CHECK_EQ(static_cast<int>(raw_icon->size()), |
| 59 file_util::WriteFile(icon_path, | 59 file_util::WriteFile(icon_path, |
| 60 raw_icon->data().c_str(), raw_icon->size())); | 60 raw_icon->data().c_str(), raw_icon->size())); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // Returns true for valid kiosk app manifest. | 63 // Returns true for valid kiosk app manifest. |
| 64 bool IsValidKioskAppManifest(const extensions::Manifest& manifest) { | 64 bool IsValidKioskAppManifest(const extensions::Manifest& manifest) { |
| 65 bool kiosk_enabled; | 65 bool kiosk_enabled; |
| (...skipping 371 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 |