OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/prefs/pref_service_syncable_util.h" | 5 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
11 #include "chrome/browser/prefs/pref_service_syncable.h" | |
12 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/common/pref_names.h" | 12 #include "chrome/common/pref_names.h" |
| 13 #include "components/syncable_prefs/pref_service_syncable.h" |
14 | 14 |
15 #if defined(OS_ANDROID) || defined(OS_IOS) | 15 #if defined(OS_ANDROID) || defined(OS_IOS) |
16 #include "components/proxy_config/proxy_config_pref_names.h" | 16 #include "components/proxy_config/proxy_config_pref_names.h" |
17 #endif | 17 #endif |
18 | 18 |
19 PrefServiceSyncable* PrefServiceSyncableFromProfile(Profile* profile) { | 19 PrefServiceSyncable* PrefServiceSyncableFromProfile(Profile* profile) { |
20 return static_cast<PrefServiceSyncable*>(profile->GetPrefs()); | 20 return static_cast<PrefServiceSyncable*>(profile->GetPrefs()); |
21 } | 21 } |
22 | 22 |
23 PrefServiceSyncable* PrefServiceSyncableIncognitoFromProfile(Profile* profile) { | 23 PrefServiceSyncable* PrefServiceSyncableIncognitoFromProfile(Profile* profile) { |
24 return static_cast<PrefServiceSyncable*>(profile->GetOffTheRecordPrefs()); | 24 return static_cast<PrefServiceSyncable*>(profile->GetOffTheRecordPrefs()); |
25 } | 25 } |
26 | 26 |
27 PrefServiceSyncable* CreateIncognitoPrefServiceSyncable( | 27 PrefServiceSyncable* CreateIncognitoPrefServiceSyncable( |
28 PrefServiceSyncable* pref_service, | 28 PrefServiceSyncable* pref_service, |
29 PrefStore* incognito_extension_pref_store) { | 29 PrefStore* incognito_extension_pref_store) { |
30 // List of keys that cannot be changed in the user prefs file by the incognito | 30 // List of keys that cannot be changed in the user prefs file by the incognito |
31 // profile. All preferences that store information about the browsing history | 31 // profile. All preferences that store information about the browsing history |
32 // or behavior of the user should have this property. | 32 // or behavior of the user should have this property. |
33 std::vector<const char*> overlay_pref_names; | 33 std::vector<const char*> overlay_pref_names; |
34 overlay_pref_names.push_back(prefs::kBrowserWindowPlacement); | 34 overlay_pref_names.push_back(prefs::kBrowserWindowPlacement); |
35 overlay_pref_names.push_back(prefs::kSaveFileDefaultDirectory); | 35 overlay_pref_names.push_back(prefs::kSaveFileDefaultDirectory); |
36 #if defined(OS_ANDROID) || defined(OS_IOS) | 36 #if defined(OS_ANDROID) || defined(OS_IOS) |
37 overlay_pref_names.push_back(proxy_config::prefs::kProxy); | 37 overlay_pref_names.push_back(proxy_config::prefs::kProxy); |
38 #endif | 38 #endif |
39 return pref_service->CreateIncognitoPrefService( | 39 return pref_service->CreateIncognitoPrefService( |
40 incognito_extension_pref_store, overlay_pref_names); | 40 incognito_extension_pref_store, overlay_pref_names); |
41 } | 41 } |
OLD | NEW |