Linux: Depend on liberation-fonts package for RPMs.
[chromium-blink-merge.git] / components / content_settings / core / browser / content_settings_registry.h
blobdfaaf72becaee4a52c94179867c5f706c862342a
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
3 // found in the LICENSE file.
5 #ifndef COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_REGISTRY_H_
6 #define COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_REGISTRY_H_
8 #include <string>
10 #include "base/lazy_instance.h"
11 #include "base/macros.h"
12 #include "base/memory/scoped_vector.h"
13 #include "components/content_settings/core/browser/content_settings_info.h"
14 #include "components/content_settings/core/browser/website_settings_info.h"
15 #include "components/content_settings/core/common/content_settings.h"
16 #include "components/content_settings/core/common/content_settings_types.h"
18 namespace content_settings {
20 class WebsiteSettingsRegistry;
22 // This class stores ContentSettingsInfo objects for each content setting in the
23 // system and provides access to them. Global instances can be fetched and
24 // methods called from from any thread because all of its public methods are
25 // const.
26 class ContentSettingsRegistry {
27 public:
28 static ContentSettingsRegistry* GetInstance();
30 // Reset the instance for use inside tests.
31 void ResetForTest();
33 const ContentSettingsInfo* Get(ContentSettingsType type) const;
35 private:
36 friend class ContentSettingsRegistryTest;
37 friend struct base::DefaultLazyInstanceTraits<ContentSettingsRegistry>;
39 ContentSettingsRegistry();
40 ContentSettingsRegistry(WebsiteSettingsRegistry* website_settings_registry);
41 ~ContentSettingsRegistry();
43 void Init();
45 // Register a new content setting. This maps an origin to an ALLOW/ASK/BLOCK
46 // value (see the ContentSetting enum).
47 void Register(ContentSettingsType type,
48 const std::string& name,
49 ContentSetting initial_default_value,
50 WebsiteSettingsInfo::SyncStatus sync_status,
51 const std::vector<std::string>& whitelisted_schemes);
53 ScopedVector<ContentSettingsInfo> content_settings_info_;
54 WebsiteSettingsRegistry* website_settings_registry_;
56 DISALLOW_COPY_AND_ASSIGN(ContentSettingsRegistry);
59 } // namespace content_settings
61 #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_REGISTRY_H_