| 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 const char kIconFileExtension[] = ".png"; | 47 const char kIconFileExtension[] = ".png"; |
| 48 | 48 |
| 49 // Save |raw_icon| for given |app_id|. | 49 // Save |raw_icon| for given |app_id|. |
| 50 void SaveIconToLocalOnBlockingPool( | 50 void SaveIconToLocalOnBlockingPool( |
| 51 const base::FilePath& icon_path, | 51 const base::FilePath& icon_path, |
| 52 scoped_refptr<base::RefCountedString> raw_icon) { | 52 scoped_refptr<base::RefCountedString> raw_icon) { |
| 53 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 53 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 54 | 54 |
| 55 base::FilePath dir = icon_path.DirName(); | 55 base::FilePath dir = icon_path.DirName(); |
| 56 if (!base::PathExists(dir)) | 56 if (!base::PathExists(dir)) |
| 57 CHECK(file_util::CreateDirectory(dir)); | 57 CHECK(base::CreateDirectory(dir)); |
| 58 | 58 |
| 59 CHECK_EQ(static_cast<int>(raw_icon->size()), | 59 CHECK_EQ(static_cast<int>(raw_icon->size()), |
| 60 file_util::WriteFile(icon_path, | 60 file_util::WriteFile(icon_path, |
| 61 raw_icon->data().c_str(), raw_icon->size())); | 61 raw_icon->data().c_str(), raw_icon->size())); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Returns true for valid kiosk app manifest. | 64 // Returns true for valid kiosk app manifest. |
| 65 bool IsValidKioskAppManifest(const extensions::Manifest& manifest) { | 65 bool IsValidKioskAppManifest(const extensions::Manifest& manifest) { |
| 66 bool kiosk_enabled; | 66 bool kiosk_enabled; |
| 67 if (manifest.GetBoolean(extensions::manifest_keys::kKioskEnabled, | 67 if (manifest.GetBoolean(extensions::manifest_keys::kKioskEnabled, |
| (...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 if (!response->GetString(key, value)) { | 454 if (!response->GetString(key, value)) { |
| 455 LOG(ERROR) << "Webstore response error (" << key | 455 LOG(ERROR) << "Webstore response error (" << key |
| 456 << "): " << ValueToString(response); | 456 << "): " << ValueToString(response); |
| 457 OnWebstoreResponseParseFailure(kInvalidWebstoreResponseError); | 457 OnWebstoreResponseParseFailure(kInvalidWebstoreResponseError); |
| 458 return false; | 458 return false; |
| 459 } | 459 } |
| 460 return true; | 460 return true; |
| 461 } | 461 } |
| 462 | 462 |
| 463 } // namespace chromeos | 463 } // namespace chromeos |
| OLD | NEW |