| 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 "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 ContentSetting setting) { | 70 ContentSetting setting) { |
| 71 callback.Run(ContentSettingToPermissionStatus(setting)); | 71 callback.Run(ContentSettingToPermissionStatus(setting)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // Helper method to convert PermissionType to ContentSettingType. | 74 // Helper method to convert PermissionType to ContentSettingType. |
| 75 ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { | 75 ContentSettingsType PermissionTypeToContentSetting(PermissionType permission) { |
| 76 switch (permission) { | 76 switch (permission) { |
| 77 case PermissionType::MIDI_SYSEX: | 77 case PermissionType::MIDI_SYSEX: |
| 78 return CONTENT_SETTINGS_TYPE_MIDI_SYSEX; | 78 return CONTENT_SETTINGS_TYPE_MIDI_SYSEX; |
| 79 case PermissionType::PUSH_MESSAGING: | 79 case PermissionType::PUSH_MESSAGING: |
| 80 return CONTENT_SETTINGS_TYPE_PUSH_MESSAGING; | |
| 81 case PermissionType::NOTIFICATIONS: | 80 case PermissionType::NOTIFICATIONS: |
| 82 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; | 81 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; |
| 83 case PermissionType::GEOLOCATION: | 82 case PermissionType::GEOLOCATION: |
| 84 return CONTENT_SETTINGS_TYPE_GEOLOCATION; | 83 return CONTENT_SETTINGS_TYPE_GEOLOCATION; |
| 85 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: | 84 case PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 86 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 85 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 87 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; | 86 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; |
| 88 #else | 87 #else |
| 89 NOTIMPLEMENTED(); | 88 NOTIMPLEMENTED(); |
| 90 break; | 89 break; |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 // Add the callback to |callbacks| which will be run after the loop to | 473 // Add the callback to |callbacks| which will be run after the loop to |
| 475 // prevent re-entrance issues. | 474 // prevent re-entrance issues. |
| 476 callbacks.push_back( | 475 callbacks.push_back( |
| 477 base::Bind(subscription->callback, | 476 base::Bind(subscription->callback, |
| 478 ContentSettingToPermissionStatus(new_value))); | 477 ContentSettingToPermissionStatus(new_value))); |
| 479 } | 478 } |
| 480 | 479 |
| 481 for (const auto& callback : callbacks) | 480 for (const auto& callback : callbacks) |
| 482 callback.Run(); | 481 callback.Run(); |
| 483 } | 482 } |
| OLD | NEW |