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/permissions/permission_manager.h" | 5 #include "chrome/browser/permissions/permission_manager.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" |
9 #include "chrome/browser/permissions/permission_context.h" | 9 #include "chrome/browser/permissions/permission_context.h" |
10 #include "chrome/browser/permissions/permission_context_base.h" | 10 #include "chrome/browser/permissions/permission_context_base.h" |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
332 } | 332 } |
333 | 333 |
334 void PermissionManager::RegisterPermissionUsage(PermissionType permission, | 334 void PermissionManager::RegisterPermissionUsage(PermissionType permission, |
335 const GURL& requesting_origin, | 335 const GURL& requesting_origin, |
336 const GURL& embedding_origin) { | 336 const GURL& embedding_origin) { |
337 // This is required because constant permissions don't have a | 337 // This is required because constant permissions don't have a |
338 // ContentSettingsType. | 338 // ContentSettingsType. |
339 if (IsConstantPermission(permission)) | 339 if (IsConstantPermission(permission)) |
340 return; | 340 return; |
341 | 341 |
342 HostContentSettingsMapFactory::GetForProfile(profile_)->UpdateLastUsage( | 342 // TODO(tsergeant): Use this for measuring permission usage stats. |
mlamouri (slow - plz ping)
2015/11/09 20:33:13
I'm confused. How is that method not used if it is
raymes
2015/11/09 23:07:58
What I'm trying to say is that the usage informati
| |
343 requesting_origin, | |
344 embedding_origin, | |
345 PermissionTypeToContentSetting(permission)); | |
346 } | 343 } |
347 | 344 |
348 int PermissionManager::SubscribePermissionStatusChange( | 345 int PermissionManager::SubscribePermissionStatusChange( |
349 PermissionType permission, | 346 PermissionType permission, |
350 const GURL& requesting_origin, | 347 const GURL& requesting_origin, |
351 const GURL& embedding_origin, | 348 const GURL& embedding_origin, |
352 const base::Callback<void(PermissionStatus)>& callback) { | 349 const base::Callback<void(PermissionStatus)>& callback) { |
353 if (subscriptions_.IsEmpty()) | 350 if (subscriptions_.IsEmpty()) |
354 HostContentSettingsMapFactory::GetForProfile(profile_)->AddObserver(this); | 351 HostContentSettingsMapFactory::GetForProfile(profile_)->AddObserver(this); |
355 | 352 |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
421 // Add the callback to |callbacks| which will be run after the loop to | 418 // Add the callback to |callbacks| which will be run after the loop to |
422 // prevent re-entrance issues. | 419 // prevent re-entrance issues. |
423 callbacks.push_back( | 420 callbacks.push_back( |
424 base::Bind(subscription->callback, | 421 base::Bind(subscription->callback, |
425 ContentSettingToPermissionStatus(new_value))); | 422 ContentSettingToPermissionStatus(new_value))); |
426 } | 423 } |
427 | 424 |
428 for (const auto& callback : callbacks) | 425 for (const auto& callback : callbacks) |
429 callback.Run(); | 426 callback.Run(); |
430 } | 427 } |
OLD | NEW |