| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 void PermissionManager::OnContentSettingChanged( | 391 void PermissionManager::OnContentSettingChanged( |
| 392 const ContentSettingsPattern& primary_pattern, | 392 const ContentSettingsPattern& primary_pattern, |
| 393 const ContentSettingsPattern& secondary_pattern, | 393 const ContentSettingsPattern& secondary_pattern, |
| 394 ContentSettingsType content_type, | 394 ContentSettingsType content_type, |
| 395 std::string resource_identifier) { | 395 std::string resource_identifier) { |
| 396 std::list<base::Closure> callbacks; | 396 std::list<base::Closure> callbacks; |
| 397 | 397 |
| 398 for (SubscriptionsMap::iterator iter(&subscriptions_); | 398 for (SubscriptionsMap::iterator iter(&subscriptions_); |
| 399 !iter.IsAtEnd(); iter.Advance()) { | 399 !iter.IsAtEnd(); iter.Advance()) { |
| 400 Subscription* subscription = iter.GetCurrentValue(); | 400 Subscription* subscription = iter.GetCurrentValue(); |
| 401 if (IsConstantPermission(subscription->permission)) |
| 402 continue; |
| 401 if (PermissionTypeToContentSetting(subscription->permission) != | 403 if (PermissionTypeToContentSetting(subscription->permission) != |
| 402 content_type) { | 404 content_type) { |
| 403 continue; | 405 continue; |
| 404 } | 406 } |
| 405 | 407 |
| 406 if (primary_pattern.IsValid() && | 408 if (primary_pattern.IsValid() && |
| 407 !primary_pattern.Matches(subscription->requesting_origin)) | 409 !primary_pattern.Matches(subscription->requesting_origin)) |
| 408 continue; | 410 continue; |
| 409 if (secondary_pattern.IsValid() && | 411 if (secondary_pattern.IsValid() && |
| 410 !secondary_pattern.Matches(subscription->embedding_origin)) | 412 !secondary_pattern.Matches(subscription->embedding_origin)) |
| (...skipping 11 matching lines...) Expand all Loading... |
| 422 // Add the callback to |callbacks| which will be run after the loop to | 424 // Add the callback to |callbacks| which will be run after the loop to |
| 423 // prevent re-entrance issues. | 425 // prevent re-entrance issues. |
| 424 callbacks.push_back( | 426 callbacks.push_back( |
| 425 base::Bind(subscription->callback, | 427 base::Bind(subscription->callback, |
| 426 ContentSettingToPermissionStatus(new_value))); | 428 ContentSettingToPermissionStatus(new_value))); |
| 427 } | 429 } |
| 428 | 430 |
| 429 for (const auto& callback : callbacks) | 431 for (const auto& callback : callbacks) |
| 430 callback.Run(); | 432 callback.Run(); |
| 431 } | 433 } |
| OLD | NEW |