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

Side by Side Diff: chrome/browser/permissions/permission_manager.cc

Issue 1885823002: Fix bug: MIDI causes crash on onContentSettingChanged() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove {} Created 4 years, 8 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
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/permissions/permission_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698