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

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

Issue 793663007: Set RemoteDebuggingServer port based on "remote-debugging-port" flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 25 matching lines...) Expand all
36 } 36 }
37 37
38 } // namespace 38 } // namespace
39 39
40 // static 40 // static
41 scoped_ptr<PrefService> PrefServiceHelper::CreatePrefService( 41 scoped_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::kMetricsIsNewClientID, false); 47 registry->RegisterBooleanPref(prefs::kMetricsIsNewClientID, false);
47 registry->RegisterIntegerPref(prefs::kRemoteDebuggingPort, 0);
48 48
49 RegisterPlatformPrefs(registry); 49 RegisterPlatformPrefs(registry);
50 50
51 base::PrefServiceFactory prefServiceFactory; 51 base::PrefServiceFactory prefServiceFactory;
52 scoped_refptr<base::SequencedTaskRunner> task_runner = 52 scoped_refptr<base::SequencedTaskRunner> task_runner =
53 JsonPrefStore::GetTaskRunnerForFile( 53 JsonPrefStore::GetTaskRunnerForFile(
54 config_path, 54 config_path,
55 content::BrowserThread::GetBlockingPool()); 55 content::BrowserThread::GetBlockingPool());
56 prefServiceFactory.SetUserPrefsFile(config_path, task_runner.get()); 56 prefServiceFactory.SetUserPrefsFile(config_path, task_runner.get());
57 prefServiceFactory.set_async(false); 57 prefServiceFactory.set_async(false);
58 58
59 PersistentPrefStore::PrefReadError prefs_read_error = 59 PersistentPrefStore::PrefReadError prefs_read_error =
60 PersistentPrefStore::PREF_READ_ERROR_NONE; 60 PersistentPrefStore::PREF_READ_ERROR_NONE;
61 prefServiceFactory.set_read_error_callback( 61 prefServiceFactory.set_read_error_callback(
62 base::Bind(&UserPrefsLoadError, &prefs_read_error)); 62 base::Bind(&UserPrefsLoadError, &prefs_read_error));
63 63
64 scoped_ptr<PrefService> pref_service(prefServiceFactory.Create(registry)); 64 scoped_ptr<PrefService> pref_service(prefServiceFactory.Create(registry));
65 if (prefs_read_error != PersistentPrefStore::PREF_READ_ERROR_NONE) { 65 if (prefs_read_error != PersistentPrefStore::PREF_READ_ERROR_NONE) {
66 LOG(ERROR) << "Cannot initialize chromecast config: " 66 LOG(ERROR) << "Cannot initialize chromecast config: "
67 << config_path.value() 67 << config_path.value()
68 << ", pref_error=" << prefs_read_error; 68 << ", pref_error=" << prefs_read_error;
69 } 69 }
70 70
71 OnPrefsLoaded(pref_service.get()); 71 OnPrefsLoaded(pref_service.get());
72 return pref_service.Pass(); 72 return pref_service.Pass();
73 } 73 }
74 74
75 } // namespace shell 75 } // namespace shell
76 } // namespace chromecast 76 } // namespace chromecast
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698