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 "components/content_settings/core/browser/website_settings_info.h" | 5 #include "components/content_settings/core/browser/website_settings_info.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/prefs/pref_registry.h" | 8 #include "base/prefs/pref_registry.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 } // namespace | 24 } // namespace |
25 | 25 |
26 namespace content_settings { | 26 namespace content_settings { |
27 | 27 |
28 WebsiteSettingsInfo::WebsiteSettingsInfo( | 28 WebsiteSettingsInfo::WebsiteSettingsInfo( |
29 ContentSettingsType type, | 29 ContentSettingsType type, |
30 const std::string& name, | 30 const std::string& name, |
31 scoped_ptr<base::Value> initial_default_value, | 31 scoped_ptr<base::Value> initial_default_value, |
32 SyncStatus sync_status, | 32 SyncStatus sync_status, |
33 LossyStatus lossy_status, | 33 LossyStatus lossy_status, |
34 ScopingType scoping_type) | 34 ScopingType scoping_type, |
| 35 IncognitoBehavior incognito_behavior) |
35 : type_(type), | 36 : type_(type), |
36 name_(name), | 37 name_(name), |
37 pref_name_(GetPrefName(name, kPrefPrefix)), | 38 pref_name_(GetPrefName(name, kPrefPrefix)), |
38 default_value_pref_name_(GetPrefName(name, kDefaultPrefPrefix)), | 39 default_value_pref_name_(GetPrefName(name, kDefaultPrefPrefix)), |
39 initial_default_value_(initial_default_value.Pass()), | 40 initial_default_value_(initial_default_value.Pass()), |
40 sync_status_(sync_status), | 41 sync_status_(sync_status), |
41 lossy_status_(lossy_status), | 42 lossy_status_(lossy_status), |
42 scoping_type_(scoping_type) { | 43 scoping_type_(scoping_type), |
| 44 incognito_behavior_(incognito_behavior) { |
43 // For legacy reasons the default value is currently restricted to be an int. | 45 // For legacy reasons the default value is currently restricted to be an int. |
44 // TODO(raymes): We should migrate the underlying pref to be a dictionary | 46 // TODO(raymes): We should migrate the underlying pref to be a dictionary |
45 // rather than an int. | 47 // rather than an int. |
46 DCHECK(!initial_default_value_ || | 48 DCHECK(!initial_default_value_ || |
47 initial_default_value_->IsType(base::Value::TYPE_INTEGER)); | 49 initial_default_value_->IsType(base::Value::TYPE_INTEGER)); |
48 } | 50 } |
49 | 51 |
50 WebsiteSettingsInfo::~WebsiteSettingsInfo() {} | 52 WebsiteSettingsInfo::~WebsiteSettingsInfo() {} |
51 | 53 |
52 uint32 WebsiteSettingsInfo::GetPrefRegistrationFlags() const { | 54 uint32 WebsiteSettingsInfo::GetPrefRegistrationFlags() const { |
53 uint32 flags = PrefRegistry::NO_REGISTRATION_FLAGS; | 55 uint32 flags = PrefRegistry::NO_REGISTRATION_FLAGS; |
54 | 56 |
55 if (sync_status_ == SYNCABLE) | 57 if (sync_status_ == SYNCABLE) |
56 flags |= user_prefs::PrefRegistrySyncable::SYNCABLE_PREF; | 58 flags |= user_prefs::PrefRegistrySyncable::SYNCABLE_PREF; |
57 | 59 |
58 if (lossy_status_ == LOSSY) | 60 if (lossy_status_ == LOSSY) |
59 flags |= PrefRegistry::LOSSY_PREF; | 61 flags |= PrefRegistry::LOSSY_PREF; |
60 | 62 |
61 return flags; | 63 return flags; |
62 } | 64 } |
63 | 65 |
64 } // namespace content_settings | 66 } // namespace content_settings |
OLD | NEW |