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

Side by Side Diff: chromecast/browser/pref_service_helper.cc

Issue 1875623002: Convert //chromecast from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 "chromecast/browser/pref_service_helper.h" 5 #include "chromecast/browser/pref_service_helper.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 20 matching lines...) Expand all
31 31
32 base::FilePath GetConfigPath() { 32 base::FilePath GetConfigPath() {
33 base::FilePath config_path; 33 base::FilePath config_path;
34 CHECK(PathService::Get(FILE_CAST_CONFIG, &config_path)); 34 CHECK(PathService::Get(FILE_CAST_CONFIG, &config_path));
35 return config_path; 35 return config_path;
36 } 36 }
37 37
38 } // namespace 38 } // namespace
39 39
40 // static 40 // static
41 scoped_ptr<PrefService> PrefServiceHelper::CreatePrefService( 41 std::unique_ptr<PrefService> PrefServiceHelper::CreatePrefService(
42 PrefRegistrySimple* registry) { 42 PrefRegistrySimple* registry) {
43 const base::FilePath config_path(GetConfigPath()); 43 const base::FilePath config_path(GetConfigPath());
44 VLOG(1) << "Loading config from " << config_path.value(); 44 VLOG(1) << "Loading config from " << config_path.value();
45 45
46 registry->RegisterBooleanPref(prefs::kEnableRemoteDebugging, false); 46 registry->RegisterBooleanPref(prefs::kEnableRemoteDebugging, false);
47 registry->RegisterBooleanPref(prefs::kMetricsIsNewClientID, false); 47 registry->RegisterBooleanPref(prefs::kMetricsIsNewClientID, false);
48 // Opt-in stats default to true to handle two different cases: 48 // Opt-in stats default to true to handle two different cases:
49 // 1) Any crashes or UMA logs are recorded prior to setup completing 49 // 1) Any crashes or UMA logs are recorded prior to setup completing
50 // successfully (even though we can't send them yet). Unless the user 50 // successfully (even though we can't send them yet). Unless the user
51 // ends up actually opting out, we don't want to lose this data once 51 // ends up actually opting out, we don't want to lose this data once
(...skipping 10 matching lines...) Expand all
62 config_path, 62 config_path,
63 content::BrowserThread::GetBlockingPool()); 63 content::BrowserThread::GetBlockingPool());
64 prefServiceFactory.SetUserPrefsFile(config_path, task_runner.get()); 64 prefServiceFactory.SetUserPrefsFile(config_path, task_runner.get());
65 prefServiceFactory.set_async(false); 65 prefServiceFactory.set_async(false);
66 66
67 PersistentPrefStore::PrefReadError prefs_read_error = 67 PersistentPrefStore::PrefReadError prefs_read_error =
68 PersistentPrefStore::PREF_READ_ERROR_NONE; 68 PersistentPrefStore::PREF_READ_ERROR_NONE;
69 prefServiceFactory.set_read_error_callback( 69 prefServiceFactory.set_read_error_callback(
70 base::Bind(&UserPrefsLoadError, &prefs_read_error)); 70 base::Bind(&UserPrefsLoadError, &prefs_read_error));
71 71
72 scoped_ptr<PrefService> pref_service(prefServiceFactory.Create(registry)); 72 std::unique_ptr<PrefService> pref_service(
73 prefServiceFactory.Create(registry));
73 if (prefs_read_error != PersistentPrefStore::PREF_READ_ERROR_NONE) { 74 if (prefs_read_error != PersistentPrefStore::PREF_READ_ERROR_NONE) {
74 LOG(ERROR) << "Cannot initialize chromecast config: " 75 LOG(ERROR) << "Cannot initialize chromecast config: "
75 << config_path.value() 76 << config_path.value()
76 << ", pref_error=" << prefs_read_error; 77 << ", pref_error=" << prefs_read_error;
77 } 78 }
78 79
79 OnPrefsLoaded(pref_service.get()); 80 OnPrefsLoaded(pref_service.get());
80 return pref_service; 81 return pref_service;
81 } 82 }
82 83
83 } // namespace shell 84 } // namespace shell
84 } // namespace chromecast 85 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/pref_service_helper.h ('k') | chromecast/browser/service/cast_service_simple.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698