OLD | NEW |
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 #include "chrome/browser/android/preferences/website_preference_bridge.h" | 5 #include "chrome/browser/android/preferences/website_preference_bridge.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chrome/browser/android/preferences/important_sites_util.h" | 21 #include "chrome/browser/android/preferences/important_sites_util.h" |
22 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" | 22 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" |
23 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" | 23 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" |
24 #include "chrome/browser/browsing_data/cookies_tree_model.h" | 24 #include "chrome/browser/browsing_data/cookies_tree_model.h" |
25 #include "chrome/browser/browsing_data/local_data_container.h" | 25 #include "chrome/browser/browsing_data/local_data_container.h" |
26 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 26 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
27 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 27 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
28 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 28 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
29 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" | 29 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" |
30 #include "chrome/browser/notifications/desktop_notification_profile_util.h" | 30 #include "chrome/browser/notifications/desktop_notification_profile_util.h" |
| 31 #include "chrome/browser/permissions/permission_uma_util.h" |
31 #include "chrome/browser/permissions/permission_util.h" | 32 #include "chrome/browser/permissions/permission_util.h" |
32 #include "chrome/browser/profiles/profile.h" | 33 #include "chrome/browser/profiles/profile.h" |
33 #include "chrome/browser/profiles/profile_manager.h" | 34 #include "chrome/browser/profiles/profile_manager.h" |
34 #include "chrome/browser/storage/storage_info_fetcher.h" | 35 #include "chrome/browser/storage/storage_info_fetcher.h" |
35 #include "chrome/browser/usb/usb_chooser_context.h" | 36 #include "chrome/browser/usb/usb_chooser_context.h" |
36 #include "chrome/browser/usb/usb_chooser_context_factory.h" | 37 #include "chrome/browser/usb/usb_chooser_context_factory.h" |
37 #include "components/content_settings/core/browser/cookie_settings.h" | 38 #include "components/content_settings/core/browser/cookie_settings.h" |
38 #include "components/content_settings/core/browser/host_content_settings_map.h" | 39 #include "components/content_settings/core/browser/host_content_settings_map.h" |
39 #include "content/public/browser/browser_thread.h" | 40 #include "content/public/browser/browser_thread.h" |
40 #include "content/public/browser/storage_partition.h" | 41 #include "content/public/browser/storage_partition.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 | 149 |
149 void SetSettingForOrigin(JNIEnv* env, | 150 void SetSettingForOrigin(JNIEnv* env, |
150 ContentSettingsType content_type, | 151 ContentSettingsType content_type, |
151 jstring origin, | 152 jstring origin, |
152 jstring embedder, | 153 jstring embedder, |
153 ContentSetting setting, | 154 ContentSetting setting, |
154 jboolean is_incognito) { | 155 jboolean is_incognito) { |
155 GURL origin_url(ConvertJavaStringToUTF8(env, origin)); | 156 GURL origin_url(ConvertJavaStringToUTF8(env, origin)); |
156 GURL embedder_url = | 157 GURL embedder_url = |
157 embedder ? GURL(ConvertJavaStringToUTF8(env, embedder)) : GURL(); | 158 embedder ? GURL(ConvertJavaStringToUTF8(env, embedder)) : GURL(); |
158 PermissionUtil::SetContentSettingAndRecordRevocation( | 159 Profile* profile = GetActiveUserProfile(is_incognito); |
159 GetActiveUserProfile(is_incognito), origin_url, embedder_url, | 160 PermissionUtil::ScopedRevocationReporter scoped_revocation_reporter( |
160 content_type, std::string(), setting); | 161 profile, origin_url, embedder_url, content_type, |
| 162 PermissionSourceUI::SITE_SETTINGS); |
| 163 HostContentSettingsMapFactory::GetForProfile(profile) |
| 164 ->SetContentSettingDefaultScope(origin_url, embedder_url, content_type, |
| 165 std::string(), setting); |
161 WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting); | 166 WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting); |
162 } | 167 } |
163 | 168 |
164 } // anonymous namespace | 169 } // anonymous namespace |
165 | 170 |
166 static void GetFullscreenOrigins(JNIEnv* env, | 171 static void GetFullscreenOrigins(JNIEnv* env, |
167 const JavaParamRef<jclass>& clazz, | 172 const JavaParamRef<jclass>& clazz, |
168 const JavaParamRef<jobject>& list, | 173 const JavaParamRef<jobject>& list, |
169 jboolean managedOnly) { | 174 jboolean managedOnly) { |
170 GetOrigins(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, | 175 GetOrigins(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
775 GURL url(ConvertJavaStringToUTF8(env, jorigin)); | 780 GURL url(ConvertJavaStringToUTF8(env, jorigin)); |
776 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( | 781 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( |
777 new SiteDataDeleteHelper(profile, url)); | 782 new SiteDataDeleteHelper(profile, url)); |
778 site_data_deleter->Run(); | 783 site_data_deleter->Run(); |
779 } | 784 } |
780 | 785 |
781 // Register native methods | 786 // Register native methods |
782 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { | 787 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { |
783 return RegisterNativesImpl(env); | 788 return RegisterNativesImpl(env); |
784 } | 789 } |
OLD | NEW |