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

Side by Side Diff: chrome/browser/chromeos/file_system_provider/registry.cc

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/file_system_provider/registry.h" 5 #include "chrome/browser/chromeos/file_system_provider/registry.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/memory/ptr_util.h"
8 #include "base/stl_util.h" 9 #include "base/stl_util.h"
9 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h" 10 #include "chrome/browser/chromeos/file_system_provider/mount_path_util.h"
10 #include "chrome/browser/chromeos/file_system_provider/observer.h" 11 #include "chrome/browser/chromeos/file_system_provider/observer.h"
11 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h" 12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system.h"
12 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h" 13 #include "chrome/browser/chromeos/file_system_provider/provided_file_system_info .h"
13 #include "chrome/browser/chromeos/file_system_provider/service_factory.h" 14 #include "chrome/browser/chromeos/file_system_provider/service_factory.h"
14 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
15 #include "chrome/common/pref_names.h" 16 #include "chrome/common/pref_names.h"
16 #include "components/pref_registry/pref_registry_syncable.h" 17 #include "components/pref_registry/pref_registry_syncable.h"
17 #include "components/prefs/pref_service.h" 18 #include "components/prefs/pref_service.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 base::DictionaryValue* file_systems_per_extension = NULL; 113 base::DictionaryValue* file_systems_per_extension = NULL;
113 if (!dict_update->GetDictionaryWithoutPathExpansion( 114 if (!dict_update->GetDictionaryWithoutPathExpansion(
114 extension_id, &file_systems_per_extension)) 115 extension_id, &file_systems_per_extension))
115 return; // Nothing to forget. 116 return; // Nothing to forget.
116 117
117 file_systems_per_extension->RemoveWithoutPathExpansion(file_system_id, NULL); 118 file_systems_per_extension->RemoveWithoutPathExpansion(file_system_id, NULL);
118 if (!file_systems_per_extension->size()) 119 if (!file_systems_per_extension->size())
119 dict_update->Remove(extension_id, NULL); 120 dict_update->Remove(extension_id, NULL);
120 } 121 }
121 122
122 scoped_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems( 123 std::unique_ptr<Registry::RestoredFileSystems> Registry::RestoreFileSystems(
123 const std::string& extension_id) { 124 const std::string& extension_id) {
124 PrefService* const pref_service = profile_->GetPrefs(); 125 PrefService* const pref_service = profile_->GetPrefs();
125 DCHECK(pref_service); 126 DCHECK(pref_service);
126 127
127 const base::DictionaryValue* const file_systems = 128 const base::DictionaryValue* const file_systems =
128 pref_service->GetDictionary(prefs::kFileSystemProviderMounted); 129 pref_service->GetDictionary(prefs::kFileSystemProviderMounted);
129 DCHECK(file_systems); 130 DCHECK(file_systems);
130 131
131 const base::DictionaryValue* file_systems_per_extension = NULL; 132 const base::DictionaryValue* file_systems_per_extension = NULL;
132 if (!file_systems->GetDictionaryWithoutPathExpansion( 133 if (!file_systems->GetDictionaryWithoutPathExpansion(
133 extension_id, &file_systems_per_extension)) { 134 extension_id, &file_systems_per_extension)) {
134 return make_scoped_ptr(new RestoredFileSystems); // Nothing to restore. 135 return base::WrapUnique(new RestoredFileSystems); // Nothing to restore.
135 } 136 }
136 137
137 scoped_ptr<RestoredFileSystems> restored_file_systems( 138 std::unique_ptr<RestoredFileSystems> restored_file_systems(
138 new RestoredFileSystems); 139 new RestoredFileSystems);
139 140
140 for (base::DictionaryValue::Iterator it(*file_systems_per_extension); 141 for (base::DictionaryValue::Iterator it(*file_systems_per_extension);
141 !it.IsAtEnd(); 142 !it.IsAtEnd();
142 it.Advance()) { 143 it.Advance()) {
143 const base::Value* file_system_value = NULL; 144 const base::Value* file_system_value = NULL;
144 const base::DictionaryValue* file_system = NULL; 145 const base::DictionaryValue* file_system = NULL;
145 file_systems_per_extension->GetWithoutPathExpansion(it.key(), 146 file_systems_per_extension->GetWithoutPathExpansion(it.key(),
146 &file_system_value); 147 &file_system_value);
147 DCHECK(file_system_value); 148 DCHECK(file_system_value);
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
270 LOG(ERROR) << "Broken preferences detected while updating a tag."; 271 LOG(ERROR) << "Broken preferences detected while updating a tag.";
271 return; 272 return;
272 } 273 }
273 274
274 watcher_value->SetStringWithoutPathExpansion(kPrefKeyWatcherLastTag, 275 watcher_value->SetStringWithoutPathExpansion(kPrefKeyWatcherLastTag,
275 watcher.last_tag); 276 watcher.last_tag);
276 } 277 }
277 278
278 } // namespace file_system_provider 279 } // namespace file_system_provider
279 } // namespace chromeos 280 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698