| 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" |
| 11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
| 12 #include "base/prefs/pref_service.h" | 12 #include "base/prefs/pref_service.h" |
| 13 #include "base/threading/sequenced_worker_pool.h" | 13 #include "base/threading/sequenced_worker_pool.h" |
| 14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" | 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" | 16 #include "chrome/browser/chromeos/app_mode/kiosk_app_data_delegate.h" |
| 17 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 17 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 18 #include "chrome/browser/extensions/webstore_data_fetcher.h" | 18 #include "chrome/browser/extensions/webstore_data_fetcher.h" |
| 19 #include "chrome/browser/extensions/webstore_install_helper.h" | 19 #include "chrome/browser/extensions/webstore_install_helper.h" |
| 20 #include "chrome/browser/image_decoder.h" | 20 #include "chrome/browser/image_decoder.h" |
| 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 21 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 22 #include "chrome/common/extensions/extension_constants.h" | 22 #include "chrome/common/extensions/extension_constants.h" |
| 23 #include "chrome/common/extensions/extension_manifest_constants.h" | |
| 24 #include "chrome/common/extensions/manifest.h" | 23 #include "chrome/common/extensions/manifest.h" |
| 25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
| 25 #include "extensions/common/manifest_constants.h" |
| 26 #include "ui/gfx/codec/png_codec.h" | 26 #include "ui/gfx/codec/png_codec.h" |
| 27 | 27 |
| 28 using content::BrowserThread; | 28 using content::BrowserThread; |
| 29 | 29 |
| 30 namespace chromeos { | 30 namespace chromeos { |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 // Keys for local state data. See sample layout in KioskAppManager. | 34 // Keys for local state data. See sample layout in KioskAppManager. |
| 35 const char kKeyName[] = "name"; | 35 const char kKeyName[] = "name"; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 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; |
| 66 if (manifest.GetBoolean(extension_manifest_keys::kKioskEnabled, | 66 if (manifest.GetBoolean(extensions::manifest_keys::kKioskEnabled, |
| 67 &kiosk_enabled)) { | 67 &kiosk_enabled)) { |
| 68 return kiosk_enabled; | 68 return kiosk_enabled; |
| 69 } | 69 } |
| 70 | 70 |
| 71 return false; | 71 return false; |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace | 74 } // namespace |
| 75 | 75 |
| 76 //////////////////////////////////////////////////////////////////////////////// | 76 //////////////////////////////////////////////////////////////////////////////// |
| (...skipping 360 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 |