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 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_INFO_H_ | 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_INFO_H_ |
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_INFO_H_ | 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_INFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
11 #include "components/content_settings/core/common/content_settings_types.h" | 12 #include "components/content_settings/core/common/content_settings_types.h" |
12 | 13 |
14 namespace base { | |
15 class Value; | |
16 } // namespace base | |
17 | |
13 namespace content_settings { | 18 namespace content_settings { |
14 | 19 |
15 // This class stores the properties related to a website setting. | 20 // This class stores the properties related to a website setting. |
16 // TODO(raymes): Move more properties into this class. | 21 // TODO(raymes): Move more properties into this class. |
17 class WebsiteSettingsInfo { | 22 class WebsiteSettingsInfo { |
18 public: | 23 public: |
19 WebsiteSettingsInfo(ContentSettingsType type, const std::string& name); | 24 // Ownership of |initial_default_value| remains with the caller. |
25 WebsiteSettingsInfo(ContentSettingsType type, | |
26 const std::string& name, | |
27 const base::Value* initial_default_value); | |
Bernhard Bauer
2015/07/30 08:13:00
You could also pass this in as a scoped_ptr, if yo
raymes
2015/08/03 03:18:17
Let me know if I've done what you were thinking :)
Bernhard Bauer
2015/08/03 07:33:52
Yup, exactly.
| |
20 ~WebsiteSettingsInfo(); | 28 ~WebsiteSettingsInfo(); |
21 | 29 |
22 ContentSettingsType type() const { return type_; } | 30 ContentSettingsType type() const { return type_; } |
23 const std::string& name() const { return name_; } | 31 const std::string& name() const { return name_; } |
24 | 32 |
33 const std::string& pref_name() const { return pref_name_; } | |
34 const std::string& default_value_pref_name() const { | |
35 return default_value_pref_name_; | |
36 } | |
37 const base::Value* initial_default_value() const { | |
38 return initial_default_value_.get(); | |
39 } | |
40 | |
25 private: | 41 private: |
26 const ContentSettingsType type_; | 42 const ContentSettingsType type_; |
27 const std::string name_; | 43 const std::string name_; |
28 | 44 |
45 const std::string pref_name_; | |
46 const std::string default_value_pref_name_; | |
47 const scoped_ptr<base::Value> initial_default_value_; | |
48 | |
29 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsInfo); | 49 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsInfo); |
30 }; | 50 }; |
31 | 51 |
32 } // namespace content_settings | 52 } // namespace content_settings |
33 | 53 |
34 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_INFO_H_ | 54 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_INFO_H_ |
OLD | NEW |