| 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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 void SaveIconToLocalOnBlockingPool( | 51 void SaveIconToLocalOnBlockingPool( |
| 52 const base::FilePath& icon_path, | 52 const base::FilePath& icon_path, |
| 53 scoped_refptr<base::RefCountedString> raw_icon) { | 53 scoped_refptr<base::RefCountedString> raw_icon) { |
| 54 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 54 DCHECK(BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
| 55 | 55 |
| 56 base::FilePath dir = icon_path.DirName(); | 56 base::FilePath dir = icon_path.DirName(); |
| 57 if (!base::PathExists(dir)) | 57 if (!base::PathExists(dir)) |
| 58 CHECK(base::CreateDirectory(dir)); | 58 CHECK(base::CreateDirectory(dir)); |
| 59 | 59 |
| 60 CHECK_EQ(static_cast<int>(raw_icon->size()), | 60 CHECK_EQ(static_cast<int>(raw_icon->size()), |
| 61 file_util::WriteFile(icon_path, | 61 base::WriteFile(icon_path, |
| 62 raw_icon->data().c_str(), raw_icon->size())); | 62 raw_icon->data().c_str(), raw_icon->size())); |
| 63 } | 63 } |
| 64 | 64 |
| 65 // Returns true for valid kiosk app manifest. | 65 // Returns true for valid kiosk app manifest. |
| 66 bool IsValidKioskAppManifest(const extensions::Manifest& manifest) { | 66 bool IsValidKioskAppManifest(const extensions::Manifest& manifest) { |
| 67 bool kiosk_enabled; | 67 bool kiosk_enabled; |
| 68 if (manifest.GetBoolean(extensions::manifest_keys::kKioskEnabled, | 68 if (manifest.GetBoolean(extensions::manifest_keys::kKioskEnabled, |
| 69 &kiosk_enabled)) { | 69 &kiosk_enabled)) { |
| 70 return kiosk_enabled; | 70 return kiosk_enabled; |
| 71 } | 71 } |
| 72 | 72 |
| (...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 if (!response->GetString(key, value)) { | 493 if (!response->GetString(key, value)) { |
| 494 LOG(ERROR) << "Webstore response error (" << key | 494 LOG(ERROR) << "Webstore response error (" << key |
| 495 << "): " << ValueToString(response); | 495 << "): " << ValueToString(response); |
| 496 OnWebstoreResponseParseFailure(kInvalidWebstoreResponseError); | 496 OnWebstoreResponseParseFailure(kInvalidWebstoreResponseError); |
| 497 return false; | 497 return false; |
| 498 } | 498 } |
| 499 return true; | 499 return true; |
| 500 } | 500 } |
| 501 | 501 |
| 502 } // namespace chromeos | 502 } // namespace chromeos |
| OLD | NEW |