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

Side by Side Diff: components/content_settings/core/browser/website_settings_registry.h

Issue 1252073002: Move pref names and default value into WebsiteSettingsInfo (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@website-settings-registry-simple
Patch Set: Created 5 years, 4 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 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_REGISTRY_H_ 5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_REGISTRY_H_
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_REGISTRY_H_ 6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_REGISTRY_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "components/content_settings/core/browser/website_settings_info.h" 13 #include "components/content_settings/core/browser/website_settings_info.h"
14 #include "components/content_settings/core/common/content_settings.h"
14 #include "components/content_settings/core/common/content_settings_types.h" 15 #include "components/content_settings/core/common/content_settings_types.h"
15 16
16 namespace content_settings { 17 namespace content_settings {
17 18
18 // This class stores WebsiteSettingsInfo objects for each website setting in the 19 // This class stores WebsiteSettingsInfo objects for each website setting in the
19 // system and provides access to them. Global instances can be fetched and 20 // system and provides access to them. Global instances can be fetched and
20 // methods called from from any thread because all of its public methods are 21 // methods called from from any thread because all of its public methods are
21 // const. 22 // const.
22 class WebsiteSettingsRegistry { 23 class WebsiteSettingsRegistry {
23 public: 24 public:
24 static WebsiteSettingsRegistry* GetInstance(); 25 static WebsiteSettingsRegistry* GetInstance();
25 26
26 const WebsiteSettingsInfo* Get(ContentSettingsType type) const; 27 const WebsiteSettingsInfo* Get(ContentSettingsType type) const;
27 const WebsiteSettingsInfo* GetByName(const std::string& name) const; 28 const WebsiteSettingsInfo* GetByName(const std::string& name) const;
28 29
29 private: 30 private:
31 friend class WebsiteSettingsRegistryTest;
32 friend struct base::DefaultLazyInstanceTraits<WebsiteSettingsRegistry>;
33
30 WebsiteSettingsRegistry(); 34 WebsiteSettingsRegistry();
31 ~WebsiteSettingsRegistry(); 35 ~WebsiteSettingsRegistry();
32 36
33 // Register a new WebsiteSettingsInfo. 37 // Register a new WebsiteSettingsInfo.
34 void Register(ContentSettingsType type, const std::string& name); 38 void Register(ContentSettingsType type, const std::string& name);
39 // Register a new WebsiteSettingsInfo for a permission-like setting.
msramek 2015/07/29 09:20:07 In our past discussions, we used the word "permiss
Bernhard Bauer 2015/07/29 10:12:39 In the past, we've used the term "compound" for co
raymes 2015/07/30 05:25:03 I've named them RegisterWebsiteSetting and Registe
msramek 2015/07/31 15:27:49 That's the terminology from this document, right?
40 void RegisterPermission(ContentSettingsType type,
41 const std::string& name,
42 ContentSetting initial_default_value);
43
44 // Helper used by Register/RegisterPermission.
45 void StoreWebsiteSettingsInfo(WebsiteSettingsInfo* info);
35 46
36 ScopedVector<WebsiteSettingsInfo> website_settings_info_; 47 ScopedVector<WebsiteSettingsInfo> website_settings_info_;
37 48
38 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsRegistry); 49 DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsRegistry);
39 friend class WebsiteSettingsRegistryTest;
40 friend struct base::DefaultLazyInstanceTraits<WebsiteSettingsRegistry>;
41 }; 50 };
42 51
43 } // namespace content_settings 52 } // namespace content_settings
44 53
45 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_REGISTRY_H_ 54 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_WEBSITE_SETTINGS_REGISTRY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698