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

Side by Side Diff: chrome/browser/content_settings/host_content_settings_map.h

Issue 545413002: Detach the dependency from host_content_settings_map to extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: todo Created 6 years, 3 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
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // Maps hostnames to custom content settings. Written on the UI thread and read 5 // Maps hostnames to custom content settings. Written on the UI thread and read
6 // on any thread. One instance per profile. 6 // on any thread. One instance per profile.
7 7
8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 8 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 9 #define CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
10 10
(...skipping 15 matching lines...) Expand all
26 class ExtensionService; 26 class ExtensionService;
27 class GURL; 27 class GURL;
28 class PrefService; 28 class PrefService;
29 29
30 namespace base { 30 namespace base {
31 class Clock; 31 class Clock;
32 class Value; 32 class Value;
33 } 33 }
34 34
35 namespace content_settings { 35 namespace content_settings {
36 class ObservableProvider;
36 class ProviderInterface; 37 class ProviderInterface;
37 class PrefProvider; 38 class PrefProvider;
38 } 39 }
39 40
40 namespace user_prefs { 41 namespace user_prefs {
41 class PrefRegistrySyncable; 42 class PrefRegistrySyncable;
42 } 43 }
43 44
44 class HostContentSettingsMap 45 class HostContentSettingsMap
45 : public content_settings::Observer, 46 : public content_settings::Observer,
46 public base::RefCountedThreadSafe<HostContentSettingsMap> { 47 public base::RefCountedThreadSafe<HostContentSettingsMap> {
47 public: 48 public:
48 enum ProviderType { 49 enum ProviderType {
50 // EXTENSION names is a layering violation when this class will move to
51 // components.
52 // TODO(mukai): find the solution.
49 INTERNAL_EXTENSION_PROVIDER = 0, 53 INTERNAL_EXTENSION_PROVIDER = 0,
50 POLICY_PROVIDER, 54 POLICY_PROVIDER,
51 CUSTOM_EXTENSION_PROVIDER, 55 CUSTOM_EXTENSION_PROVIDER,
52 PREF_PROVIDER, 56 PREF_PROVIDER,
53 DEFAULT_PROVIDER, 57 DEFAULT_PROVIDER,
54 NUM_PROVIDER_TYPES, 58 NUM_PROVIDER_TYPES,
55 }; 59 };
56 60
57 HostContentSettingsMap(PrefService* prefs, bool incognito); 61 HostContentSettingsMap(PrefService* prefs, bool incognito);
58 62
59 #if defined(ENABLE_EXTENSIONS) 63 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
60 // In some cases, the ExtensionService is not available at the time the
61 // HostContentSettingsMap is constructed. In these cases, we register the
62 // service once it's available.
63 void RegisterExtensionService(ExtensionService* extension_service);
64 #endif
65 64
66 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry); 65 // Adds a new provider for |type|.
66 void RegisterProvider(
67 ProviderType type,
68 scoped_ptr<content_settings::ObservableProvider> provider);
67 69
68 // Returns the default setting for a particular content type. If |provider_id| 70 // Returns the default setting for a particular content type. If |provider_id|
69 // is not NULL, the id of the provider which provided the default setting is 71 // is not NULL, the id of the provider which provided the default setting is
70 // assigned to it. 72 // assigned to it.
71 // 73 //
72 // This may be called on any thread. 74 // This may be called on any thread.
73 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type, 75 ContentSetting GetDefaultContentSetting(ContentSettingsType content_type,
74 std::string* provider_id) const; 76 std::string* provider_id) const;
75 77
76 // Returns a single |ContentSetting| which applies to the given URLs. Note 78 // Returns a single |ContentSetting| which applies to the given URLs. Note
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 // time and by RegisterExtensionService, both of which should happen 316 // time and by RegisterExtensionService, both of which should happen
315 // before any other uses of it. 317 // before any other uses of it.
316 ProviderMap content_settings_providers_; 318 ProviderMap content_settings_providers_;
317 319
318 ObserverList<content_settings::Observer> observers_; 320 ObserverList<content_settings::Observer> observers_;
319 321
320 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap); 322 DISALLOW_COPY_AND_ASSIGN(HostContentSettingsMap);
321 }; 323 };
322 324
323 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_ 325 #endif // CHROME_BROWSER_CONTENT_SETTINGS_HOST_CONTENT_SETTINGS_MAP_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/content_settings/host_content_settings_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698