Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(589)

Side by Side Diff: chrome/browser/chromeos/policy/app_pack_updater.cc

Issue 14306004: Put Kiosk App parameters into device settings. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/policy/app_pack_updater.h" 5 #include "chrome/browser/chromeos/policy/app_pack_updater.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 25 matching lines...) Expand all
36 namespace { 36 namespace {
37 37
38 // Directory where the AppPack extensions are cached. 38 // Directory where the AppPack extensions are cached.
39 const char kAppPackCacheDir[] = "/var/cache/app_pack"; 39 const char kAppPackCacheDir[] = "/var/cache/app_pack";
40 40
41 // File name extension for CRX files (not case sensitive). 41 // File name extension for CRX files (not case sensitive).
42 const char kCRXFileExtension[] = ".crx"; 42 const char kCRXFileExtension[] = ".crx";
43 43
44 } // namespace 44 } // namespace
45 45
46 const char AppPackUpdater::kExtensionId[] = "extension-id";
47 const char AppPackUpdater::kUpdateUrl[] = "update-url";
48
49 // A custom extensions::ExternalLoader that the AppPackUpdater creates and uses 46 // A custom extensions::ExternalLoader that the AppPackUpdater creates and uses
50 // to publish AppPack updates to the extensions system. 47 // to publish AppPack updates to the extensions system.
51 class AppPackExternalLoader 48 class AppPackExternalLoader
52 : public extensions::ExternalLoader, 49 : public extensions::ExternalLoader,
53 public base::SupportsWeakPtr<AppPackExternalLoader> { 50 public base::SupportsWeakPtr<AppPackExternalLoader> {
54 public: 51 public:
55 AppPackExternalLoader() {} 52 AppPackExternalLoader() {}
56 53
57 // Used by the AppPackUpdater to update the current list of extensions. 54 // Used by the AppPackUpdater to update the current list of extensions.
58 // The format of |prefs| is detailed in the extensions::ExternalLoader/ 55 // The format of |prefs| is detailed in the extensions::ExternalLoader/
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (value && value->GetAsList(&list)) { 181 if (value && value->GetAsList(&list)) {
185 for (base::ListValue::const_iterator it = list->begin(); 182 for (base::ListValue::const_iterator it = list->begin();
186 it != list->end(); ++it) { 183 it != list->end(); ++it) {
187 base::DictionaryValue* dict = NULL; 184 base::DictionaryValue* dict = NULL;
188 if (!(*it)->GetAsDictionary(&dict)) { 185 if (!(*it)->GetAsDictionary(&dict)) {
189 LOG(WARNING) << "AppPack entry is not a dictionary, ignoring."; 186 LOG(WARNING) << "AppPack entry is not a dictionary, ignoring.";
190 continue; 187 continue;
191 } 188 }
192 std::string id; 189 std::string id;
193 std::string update_url; 190 std::string update_url;
194 if (dict->GetString(kExtensionId, &id) && 191 if (dict->GetString(chromeos::kAppPackKeyExtensionId, &id) &&
195 dict->GetString(kUpdateUrl, &update_url)) { 192 dict->GetString(chromeos::kAppPackKeyUpdateUrl, &update_url)) {
196 app_pack_extensions_[id] = update_url; 193 app_pack_extensions_[id] = update_url;
197 } else { 194 } else {
198 LOG(WARNING) << "Failed to read required fields for an AppPack entry, " 195 LOG(WARNING) << "Failed to read required fields for an AppPack entry, "
199 << "ignoring."; 196 << "ignoring.";
200 } 197 }
201 } 198 }
202 } 199 }
203 200
204 VLOG(1) << "Refreshed AppPack policy, got " << app_pack_extensions_.size() 201 VLOG(1) << "Refreshed AppPack policy, got " << app_pack_extensions_.size()
205 << " entries."; 202 << " entries.";
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 void AppPackUpdater::SetScreenSaverPath(const base::FilePath& path) { 560 void AppPackUpdater::SetScreenSaverPath(const base::FilePath& path) {
564 // Don't invoke the callback if the path isn't changing. 561 // Don't invoke the callback if the path isn't changing.
565 if (path != screen_saver_path_) { 562 if (path != screen_saver_path_) {
566 screen_saver_path_ = path; 563 screen_saver_path_ = path;
567 if (!screen_saver_update_callback_.is_null()) 564 if (!screen_saver_update_callback_.is_null())
568 screen_saver_update_callback_.Run(screen_saver_path_); 565 screen_saver_update_callback_.Run(screen_saver_path_);
569 } 566 }
570 } 567 }
571 568
572 } // namespace policy 569 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/policy/app_pack_updater.h ('k') | chrome/browser/chromeos/policy/device_local_account_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698