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

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

Issue 542253003: Add a global on/off switch for content settings and expose a toggle on the Website Settings options… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@global-settings
Patch Set: 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
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
Bernhard Bauer 2014/09/10 09:07:18 2014, and I think the (c) shouldn't be there for n
Daniel Nishi 2014/09/10 16:38:29 Done.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_OVERRIDE_PROVIDER_H_
6 #define CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_OVERRIDE_PROVIDER_H_
7
8 #include <map>
9
10 #include "base/basictypes.h"
Bernhard Bauer 2014/09/10 09:07:17 Do you actually need basictypes here, or base/macr
Daniel Nishi 2014/09/10 16:38:29 The latter. Done.
11 #include "base/synchronization/lock.h"
12 #include "components/content_settings/core/common/content_settings_types.h"
13
14 class PrefService;
15
16 namespace user_prefs {
17 class PrefRegistrySyncable;
18 }
19
20 namespace content_settings {
21
22 // OverrideProvider contains if certain content settings are enabled or
23 // globally disabled.
Bernhard Bauer 2014/09/10 09:07:18 What's the thread safety story here?
Daniel Nishi 2014/09/10 16:38:29 I think now that I've locked checking IsEnabled(),
24 class OverrideProvider {
25 public:
26 static void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry);
27
28 OverrideProvider(PrefService* prefs, bool incognito);
29 virtual ~OverrideProvider();
30
31 // Returns if |content_type| is enabled.
Bernhard Bauer 2014/09/10 09:07:17 Note that content settings in principle are a gene
Daniel Nishi 2014/09/10 16:38:29 I've clarified the comment. I think for how it is
32 bool IsEnabled(ContentSettingsType content_type) const;
33
34 // Sets |content_type|'s enabled status.
35 void SetContentSetting(ContentSettingsType content_type, bool is_enabled);
36
37 private:
38 // Reads the override settings from the preferences service.
39 void ReadOverrideSettings();
40
41 // Copies of the pref data, so that we can read it on the IO thread.
42 std::map<ContentSettingsType, bool> override_settings_;
43
44 PrefService* prefs_;
45
46 bool is_incognito_;
47
48 // Used around accesses to the |override_content_settings_| object to
49 // guarantee thread safety.
50 mutable base::Lock lock_;
51
52 DISALLOW_COPY_AND_ASSIGN(OverrideProvider);
53 };
54
55 } // namespace content_settings
56
57 #endif // CHROME_BROWSER_CONTENT_SETTINGS_CONTENT_SETTINGS_OVERRIDE_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698