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

Side by Side Diff: chrome/browser/extensions/external_pref_loader.cc

Issue 2777063003: Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Just rebased Created 3 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 (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/extensions/external_pref_loader.h" 5 #include "chrome/browser/extensions/external_pref_loader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 #endif 298 #endif
299 299
300 DVLOG(1) << "Reading json file: " 300 DVLOG(1) << "Reading json file: "
301 << extension_candidate_path.LossyDisplayName(); 301 << extension_candidate_path.LossyDisplayName();
302 302
303 JSONFileValueDeserializer deserializer(extension_candidate_path); 303 JSONFileValueDeserializer deserializer(extension_candidate_path);
304 std::unique_ptr<base::DictionaryValue> ext_prefs = 304 std::unique_ptr<base::DictionaryValue> ext_prefs =
305 ExtractExtensionPrefs(&deserializer, extension_candidate_path); 305 ExtractExtensionPrefs(&deserializer, extension_candidate_path);
306 if (ext_prefs) { 306 if (ext_prefs) {
307 DVLOG(1) << "Adding extension with id: " << id; 307 DVLOG(1) << "Adding extension with id: " << id;
308 prefs->Set(id, ext_prefs.release()); 308 prefs->Set(id, std::move(ext_prefs));
309 } 309 }
310 } 310 }
311 } 311 }
312 312
313 ExternalTestingLoader::ExternalTestingLoader( 313 ExternalTestingLoader::ExternalTestingLoader(
314 const std::string& json_data, 314 const std::string& json_data,
315 const base::FilePath& fake_base_path) 315 const base::FilePath& fake_base_path)
316 : fake_base_path_(fake_base_path) { 316 : fake_base_path_(fake_base_path) {
317 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 317 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
318 JSONStringValueDeserializer deserializer(json_data); 318 JSONStringValueDeserializer deserializer(json_data);
319 base::FilePath fake_json_path = fake_base_path.AppendASCII("fake.json"); 319 base::FilePath fake_json_path = fake_base_path.AppendASCII("fake.json");
320 testing_prefs_ = ExtractExtensionPrefs(&deserializer, fake_json_path); 320 testing_prefs_ = ExtractExtensionPrefs(&deserializer, fake_json_path);
321 } 321 }
322 322
323 void ExternalTestingLoader::StartLoading() { 323 void ExternalTestingLoader::StartLoading() {
324 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 324 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
325 prefs_.reset(testing_prefs_->DeepCopy()); 325 prefs_.reset(testing_prefs_->DeepCopy());
326 LoadFinished(); 326 LoadFinished();
327 } 327 }
328 328
329 ExternalTestingLoader::~ExternalTestingLoader() {} 329 ExternalTestingLoader::~ExternalTestingLoader() {}
330 330
331 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() { 331 const base::FilePath ExternalTestingLoader::GetBaseCrxFilePath() {
332 return fake_base_path_; 332 return fake_base_path_;
333 } 333 }
334 334
335 } // namespace extensions 335 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698