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

Side by Side Diff: chrome/browser/android/preferences/website_preference_bridge.cc

Issue 1803973002: Content Settings: Add RevocationObserver to measure when permissions are revoked (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rewrite patch in permissions layer Created 4 years, 9 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 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 "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_string.h" 8 #include "base/android/jni_string.h"
9 #include "base/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h" 13 #include "chrome/browser/browsing_data/browsing_data_local_storage_helper.h"
14 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h" 14 #include "chrome/browser/browsing_data/browsing_data_quota_helper.h"
15 #include "chrome/browser/browsing_data/cookies_tree_model.h" 15 #include "chrome/browser/browsing_data/cookies_tree_model.h"
16 #include "chrome/browser/browsing_data/local_data_container.h" 16 #include "chrome/browser/browsing_data/local_data_container.h"
17 #include "chrome/browser/content_settings/cookie_settings_factory.h" 17 #include "chrome/browser/content_settings/cookie_settings_factory.h"
18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 18 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
19 #include "chrome/browser/content_settings/tab_specific_content_settings.h" 19 #include "chrome/browser/content_settings/tab_specific_content_settings.h"
20 #include "chrome/browser/content_settings/web_site_settings_uma_util.h" 20 #include "chrome/browser/content_settings/web_site_settings_uma_util.h"
21 #include "chrome/browser/notifications/desktop_notification_profile_util.h" 21 #include "chrome/browser/notifications/desktop_notification_profile_util.h"
22 #include "chrome/browser/permissions/permission_util.h"
22 #include "chrome/browser/profiles/profile.h" 23 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/browser/profiles/profile_manager.h" 24 #include "chrome/browser/profiles/profile_manager.h"
24 #include "chrome/browser/storage/storage_info_fetcher.h" 25 #include "chrome/browser/storage/storage_info_fetcher.h"
25 #include "components/content_settings/core/browser/cookie_settings.h" 26 #include "components/content_settings/core/browser/cookie_settings.h"
26 #include "components/content_settings/core/browser/host_content_settings_map.h" 27 #include "components/content_settings/core/browser/host_content_settings_map.h"
27 #include "content/public/browser/browser_thread.h" 28 #include "content/public/browser/browser_thread.h"
28 #include "content/public/browser/storage_partition.h" 29 #include "content/public/browser/storage_partition.h"
29 #include "jni/WebsitePreferenceBridge_jni.h" 30 #include "jni/WebsitePreferenceBridge_jni.h"
30 #include "storage/browser/quota/quota_manager.h" 31 #include "storage/browser/quota/quota_manager.h"
31 #include "storage/common/quota/quota_status_code.h" 32 #include "storage/common/quota/quota_status_code.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 } 130 }
130 131
131 void SetSettingForOrigin(JNIEnv* env, 132 void SetSettingForOrigin(JNIEnv* env,
132 ContentSettingsType content_type, 133 ContentSettingsType content_type,
133 jstring origin, 134 jstring origin,
134 jstring embedder, 135 jstring embedder,
135 ContentSetting setting, 136 ContentSetting setting,
136 jboolean is_incognito) { 137 jboolean is_incognito) {
137 GURL origin_url(ConvertJavaStringToUTF8(env, origin)); 138 GURL origin_url(ConvertJavaStringToUTF8(env, origin));
138 GURL embedder_url(ConvertJavaStringToUTF8(env, embedder)); 139 GURL embedder_url(ConvertJavaStringToUTF8(env, embedder));
139 GetHostContentSettingsMap(is_incognito) 140 PermissionUtil::SetContentSettingRecordRevocation(
140 ->SetContentSettingDefaultScope(origin_url, embedder_url, content_type, 141 GetActiveUserProfile(is_incognito), origin_url, embedder_url,
141 std::string(), setting); 142 content_type, std::string(), setting);
142 WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting); 143 WebSiteSettingsUmaUtil::LogPermissionChange(content_type, setting);
143 } 144 }
144 145
145 } // anonymous namespace 146 } // anonymous namespace
146 147
147 static void GetFullscreenOrigins(JNIEnv* env, 148 static void GetFullscreenOrigins(JNIEnv* env,
148 const JavaParamRef<jclass>& clazz, 149 const JavaParamRef<jclass>& clazz,
149 const JavaParamRef<jobject>& list, 150 const JavaParamRef<jobject>& list,
150 jboolean managedOnly) { 151 jboolean managedOnly) {
151 GetOrigins(env, CONTENT_SETTINGS_TYPE_FULLSCREEN, 152 GetOrigins(env, CONTENT_SETTINGS_TYPE_FULLSCREEN,
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 GURL url(ConvertJavaStringToUTF8(env, jorigin)); 752 GURL url(ConvertJavaStringToUTF8(env, jorigin));
752 scoped_refptr<SiteDataDeleteHelper> site_data_deleter( 753 scoped_refptr<SiteDataDeleteHelper> site_data_deleter(
753 new SiteDataDeleteHelper(profile, url)); 754 new SiteDataDeleteHelper(profile, url));
754 site_data_deleter->Run(); 755 site_data_deleter->Run();
755 } 756 }
756 757
757 // Register native methods 758 // Register native methods
758 bool RegisterWebsitePreferenceBridge(JNIEnv* env) { 759 bool RegisterWebsitePreferenceBridge(JNIEnv* env) {
759 return RegisterNativesImpl(env); 760 return RegisterNativesImpl(env);
760 } 761 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_util.h » ('j') | chrome/browser/permissions/permission_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698