Chromium Code Reviews| 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; | |
| 403 } | |
|
raymes
2016/04/13 04:11:36
nit: no {}
| |
| 401 if (PermissionTypeToContentSetting(subscription->permission) != | 404 if (PermissionTypeToContentSetting(subscription->permission) != |
| 402 content_type) { | 405 content_type) { |
| 403 continue; | 406 continue; |
| 404 } | 407 } |
| 405 | 408 |
| 406 if (primary_pattern.IsValid() && | 409 if (primary_pattern.IsValid() && |
| 407 !primary_pattern.Matches(subscription->requesting_origin)) | 410 !primary_pattern.Matches(subscription->requesting_origin)) |
| 408 continue; | 411 continue; |
| 409 if (secondary_pattern.IsValid() && | 412 if (secondary_pattern.IsValid() && |
| 410 !secondary_pattern.Matches(subscription->embedding_origin)) | 413 !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 | 425 // Add the callback to |callbacks| which will be run after the loop to |
| 423 // prevent re-entrance issues. | 426 // prevent re-entrance issues. |
| 424 callbacks.push_back( | 427 callbacks.push_back( |
| 425 base::Bind(subscription->callback, | 428 base::Bind(subscription->callback, |
| 426 ContentSettingToPermissionStatus(new_value))); | 429 ContentSettingToPermissionStatus(new_value))); |
| 427 } | 430 } |
| 428 | 431 |
| 429 for (const auto& callback : callbacks) | 432 for (const auto& callback : callbacks) |
| 430 callback.Run(); | 433 callback.Run(); |
| 431 } | 434 } |
| OLD | NEW |