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

Side by Side Diff: chrome/browser/chromeos/app_mode/kiosk_app_manager.cc

Issue 2765363004: Stop passing raw pointers to DictionaryValue::Set, part 2 (Closed)
Patch Set: Fix comments Created 3 years, 9 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
OLDNEW
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_manager.h" 5 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
632 KioskAppExternalLoader* secondary_loader = new KioskAppExternalLoader(); 632 KioskAppExternalLoader* secondary_loader = new KioskAppExternalLoader();
633 secondary_app_external_loader_ = secondary_loader->AsWeakPtr(); 633 secondary_app_external_loader_ = secondary_loader->AsWeakPtr();
634 634
635 return secondary_loader; 635 return secondary_loader;
636 } 636 }
637 637
638 void KioskAppManager::InstallFromCache(const std::string& id) { 638 void KioskAppManager::InstallFromCache(const std::string& id) {
639 const base::DictionaryValue* extension = nullptr; 639 const base::DictionaryValue* extension = nullptr;
640 if (external_cache_->cached_extensions()->GetDictionary(id, &extension)) { 640 if (external_cache_->cached_extensions()->GetDictionary(id, &extension)) {
641 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue); 641 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
642 base::DictionaryValue* extension_copy = extension->DeepCopy(); 642 prefs->Set(id, extension->CreateDeepCopy());
643 prefs->Set(id, extension_copy);
644 external_loader_->SetCurrentAppExtensions(std::move(prefs)); 643 external_loader_->SetCurrentAppExtensions(std::move(prefs));
645 } else { 644 } else {
646 LOG(ERROR) << "Can't find app in the cached externsions" 645 LOG(ERROR) << "Can't find app in the cached externsions"
647 << " id = " << id; 646 << " id = " << id;
648 } 647 }
649 } 648 }
650 649
651 void KioskAppManager::InstallSecondaryApps( 650 void KioskAppManager::InstallSecondaryApps(
652 const std::vector<std::string>& ids) { 651 const std::vector<std::string>& ids) {
653 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue); 652 std::unique_ptr<base::DictionaryValue> prefs(new base::DictionaryValue);
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue); 879 std::unique_ptr<base::DictionaryValue> entry(new base::DictionaryValue);
881 880
882 if (apps_[i]->update_url().is_valid()) { 881 if (apps_[i]->update_url().is_valid()) {
883 entry->SetString(extensions::ExternalProviderImpl::kExternalUpdateUrl, 882 entry->SetString(extensions::ExternalProviderImpl::kExternalUpdateUrl,
884 apps_[i]->update_url().spec()); 883 apps_[i]->update_url().spec());
885 } else { 884 } else {
886 entry->SetString(extensions::ExternalProviderImpl::kExternalUpdateUrl, 885 entry->SetString(extensions::ExternalProviderImpl::kExternalUpdateUrl,
887 extension_urls::GetWebstoreUpdateUrl().spec()); 886 extension_urls::GetWebstoreUpdateUrl().spec());
888 } 887 }
889 888
890 prefs->Set(apps_[i]->app_id(), entry.release()); 889 prefs->Set(apps_[i]->app_id(), std::move(entry));
891 } 890 }
892 external_cache_->UpdateExtensionsList(std::move(prefs)); 891 external_cache_->UpdateExtensionsList(std::move(prefs));
893 } 892 }
894 893
895 void KioskAppManager::GetKioskAppIconCacheDir(base::FilePath* cache_dir) { 894 void KioskAppManager::GetKioskAppIconCacheDir(base::FilePath* cache_dir) {
896 base::FilePath user_data_dir; 895 base::FilePath user_data_dir;
897 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)); 896 CHECK(PathService::Get(chrome::DIR_USER_DATA, &user_data_dir));
898 *cache_dir = user_data_dir.AppendASCII(kIconCacheDir); 897 *cache_dir = user_data_dir.AppendASCII(kIconCacheDir);
899 } 898 }
900 899
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 base::TimeDelta KioskAppManager::GetAutoLaunchDelay() const { 969 base::TimeDelta KioskAppManager::GetAutoLaunchDelay() const {
971 int delay; 970 int delay;
972 if (!CrosSettings::Get()->GetInteger( 971 if (!CrosSettings::Get()->GetInteger(
973 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) { 972 kAccountsPrefDeviceLocalAccountAutoLoginDelay, &delay)) {
974 return base::TimeDelta(); // Default delay is 0ms. 973 return base::TimeDelta(); // Default delay is 0ms.
975 } 974 }
976 return base::TimeDelta::FromMilliseconds(delay); 975 return base::TimeDelta::FromMilliseconds(delay);
977 } 976 }
978 977
979 } // namespace chromeos 978 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698