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

Side by Side Diff: components/content_settings/core/browser/host_content_settings_map.cc

Issue 2886433002: [Android] Adding content settings provider for notification channels (Closed)
Patch Set: update filenames elsewhere Created 3 years, 7 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 (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 #include "components/content_settings/core/browser/host_content_settings_map.h" 5 #include "components/content_settings/core/browser/host_content_settings_map.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/android/jni_android.h"
Peter Beverloo 2017/05/15 15:10:09 None of the changes in this file are used?
awdf 2017/05/16 15:17:36 Indeed, about the jni stuff.. I do need to add an
11 #include "base/command_line.h" 12 #include "base/command_line.h"
12 #include "base/macros.h" 13 #include "base/macros.h"
13 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
14 #include "base/metrics/histogram_macros.h" 15 #include "base/metrics/histogram_macros.h"
15 #include "base/strings/string_util.h" 16 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 17 #include "base/strings/utf_string_conversions.h"
17 #include "base/threading/thread_task_runner_handle.h" 18 #include "base/threading/thread_task_runner_handle.h"
18 #include "base/time/clock.h" 19 #include "base/time/clock.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "components/content_settings/core/browser/content_settings_default_prov ider.h" 21 #include "components/content_settings/core/browser/content_settings_default_prov ider.h"
21 #include "components/content_settings/core/browser/content_settings_details.h" 22 #include "components/content_settings/core/browser/content_settings_details.h"
22 #include "components/content_settings/core/browser/content_settings_info.h" 23 #include "components/content_settings/core/browser/content_settings_info.h"
23 #include "components/content_settings/core/browser/content_settings_observable_p rovider.h" 24 #include "components/content_settings/core/browser/content_settings_observable_p rovider.h"
24 #include "components/content_settings/core/browser/content_settings_policy_provi der.h" 25 #include "components/content_settings/core/browser/content_settings_policy_provi der.h"
25 #include "components/content_settings/core/browser/content_settings_pref_provide r.h" 26 #include "components/content_settings/core/browser/content_settings_pref_provide r.h"
26 #include "components/content_settings/core/browser/content_settings_provider.h" 27 #include "components/content_settings/core/browser/content_settings_provider.h"
27 #include "components/content_settings/core/browser/content_settings_registry.h" 28 #include "components/content_settings/core/browser/content_settings_registry.h"
28 #include "components/content_settings/core/browser/content_settings_rule.h" 29 #include "components/content_settings/core/browser/content_settings_rule.h"
29 #include "components/content_settings/core/browser/content_settings_utils.h" 30 #include "components/content_settings/core/browser/content_settings_utils.h"
30 #include "components/content_settings/core/browser/website_settings_registry.h" 31 #include "components/content_settings/core/browser/website_settings_registry.h"
31 #include "components/content_settings/core/common/content_settings_pattern.h" 32 #include "components/content_settings/core/common/content_settings_pattern.h"
32 #include "components/content_settings/core/common/pref_names.h" 33 #include "components/content_settings/core/common/pref_names.h"
33 #include "components/pref_registry/pref_registry_syncable.h" 34 #include "components/pref_registry/pref_registry_syncable.h"
34 #include "components/prefs/pref_service.h" 35 #include "components/prefs/pref_service.h"
35 #include "net/base/net_errors.h" 36 #include "net/base/net_errors.h"
36 #include "net/base/static_cookie_policy.h" 37 #include "net/base/static_cookie_policy.h"
37 #include "url/gurl.h" 38 #include "url/gurl.h"
38 39
40 using base::android::AttachCurrentThread;
39 using content_settings::WebsiteSettingsInfo; 41 using content_settings::WebsiteSettingsInfo;
40 using content_settings::ContentSettingsInfo; 42 using content_settings::ContentSettingsInfo;
41 43
42 namespace { 44 namespace {
43 45
44 typedef std::vector<content_settings::Rule> Rules; 46 typedef std::vector<content_settings::Rule> Rules;
45 47
46 typedef std::pair<std::string, std::string> StringPair; 48 typedef std::pair<std::string, std::string> StringPair;
47 49
48 struct ProviderNamesSourceMapEntry { 50 struct ProviderNamesSourceMapEntry {
49 const char* provider_name; 51 const char* provider_name;
50 content_settings::SettingSource provider_source; 52 content_settings::SettingSource provider_source;
51 }; 53 };
52 54
53 const ProviderNamesSourceMapEntry kProviderNamesSourceMap[] = { 55 const ProviderNamesSourceMapEntry kProviderNamesSourceMap[] = {
54 {"platform_app", content_settings::SETTING_SOURCE_EXTENSION}, 56 {"platform_app", content_settings::SETTING_SOURCE_EXTENSION},
55 {"policy", content_settings::SETTING_SOURCE_POLICY}, 57 {"policy", content_settings::SETTING_SOURCE_POLICY},
56 {"supervised_user", content_settings::SETTING_SOURCE_SUPERVISED}, 58 {"supervised_user", content_settings::SETTING_SOURCE_SUPERVISED},
57 {"extension", content_settings::SETTING_SOURCE_EXTENSION}, 59 {"extension", content_settings::SETTING_SOURCE_EXTENSION},
60 {"system", content_settings::SETTING_SOURCE_SYSTEM},
58 {"preference", content_settings::SETTING_SOURCE_USER}, 61 {"preference", content_settings::SETTING_SOURCE_USER},
59 {"default", content_settings::SETTING_SOURCE_USER}, 62 {"default", content_settings::SETTING_SOURCE_USER},
60 }; 63 };
61 64
62 // Enum describing the status of domain to origin migration of content settings. 65 // Enum describing the status of domain to origin migration of content settings.
63 // Migration will be done twice: once upon construction of the 66 // Migration will be done twice: once upon construction of the
64 // HostContentSettingsMap (before syncing any content settings) and once after 67 // HostContentSettingsMap (before syncing any content settings) and once after
65 // sync has finished. We always migrate before sync to ensure that settings will 68 // sync has finished. We always migrate before sync to ensure that settings will
66 // get migrated even if a user doesn't have sync enabled. We migrate after sync 69 // get migrated even if a user doesn't have sync enabled. We migrate after sync
67 // to ensure that any sync'd settings will be migrated. Once these events have 70 // to ensure that any sync'd settings will be migrated. Once these events have
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
903 return base::WrapUnique(rule.value.get()->DeepCopy()); 906 return base::WrapUnique(rule.value.get()->DeepCopy());
904 } 907 }
905 } 908 }
906 } 909 }
907 return std::unique_ptr<base::Value>(); 910 return std::unique_ptr<base::Value>();
908 } 911 }
909 912
910 void HostContentSettingsMap::SetClockForTesting( 913 void HostContentSettingsMap::SetClockForTesting(
911 std::unique_ptr<base::Clock> clock) { 914 std::unique_ptr<base::Clock> clock) {
912 pref_provider_->SetClockForTesting(std::move(clock)); 915 pref_provider_->SetClockForTesting(std::move(clock));
913 } 916 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698