| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 602 case CONTENT_SETTING_NUM_SETTINGS: | 602 case CONTENT_SETTING_NUM_SETTINGS: |
| 603 break; | 603 break; |
| 604 } | 604 } |
| 605 NOTREACHED(); | 605 NOTREACHED(); |
| 606 return content::PERMISSION_STATUS_DENIED; | 606 return content::PERMISSION_STATUS_DENIED; |
| 607 } | 607 } |
| 608 | 608 |
| 609 PermissionContextBase* GetPermissionContext(Profile* profile, | 609 PermissionContextBase* GetPermissionContext(Profile* profile, |
| 610 content::PermissionType permission) { | 610 content::PermissionType permission) { |
| 611 switch (permission) { | 611 switch (permission) { |
| 612 case content::PERMISSION_MIDI_SYSEX: | 612 case content::PermissionType::MIDI_SYSEX: |
| 613 return MidiPermissionContextFactory::GetForProfile(profile); | 613 return MidiPermissionContextFactory::GetForProfile(profile); |
| 614 case content::PERMISSION_NOTIFICATIONS: | 614 case content::PermissionType::NOTIFICATIONS: |
| 615 #if defined(ENABLE_NOTIFICATIONS) | 615 #if defined(ENABLE_NOTIFICATIONS) |
| 616 return DesktopNotificationServiceFactory::GetForProfile(profile); | 616 return DesktopNotificationServiceFactory::GetForProfile(profile); |
| 617 #else | 617 #else |
| 618 NOTIMPLEMENTED(); | 618 NOTIMPLEMENTED(); |
| 619 break; | 619 break; |
| 620 #endif | 620 #endif |
| 621 case content::PERMISSION_GEOLOCATION: | 621 case content::PermissionType::GEOLOCATION: |
| 622 return GeolocationPermissionContextFactory::GetForProfile(profile); | 622 return GeolocationPermissionContextFactory::GetForProfile(profile); |
| 623 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER: | 623 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 624 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 624 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 625 return ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( | 625 return ProtectedMediaIdentifierPermissionContextFactory::GetForProfile( |
| 626 profile); | 626 profile); |
| 627 #else | 627 #else |
| 628 NOTIMPLEMENTED(); | 628 NOTIMPLEMENTED(); |
| 629 break; | 629 break; |
| 630 #endif | 630 #endif |
| 631 case content::PERMISSION_PUSH_MESSAGING: | 631 case content::PermissionType::PUSH_MESSAGING: |
| 632 return PushMessagingPermissionContextFactory::GetForProfile(profile); | 632 return PushMessagingPermissionContextFactory::GetForProfile(profile); |
| 633 case content::PERMISSION_NUM: | 633 case content::PermissionType::NUM: |
| 634 NOTREACHED() << "Invalid RequestPermission for " << permission; | 634 NOTREACHED() << "Invalid RequestPermission for " |
| 635 << static_cast<int>(permission); |
| 635 break; | 636 break; |
| 636 } | 637 } |
| 637 return nullptr; | 638 return nullptr; |
| 638 } | 639 } |
| 639 | 640 |
| 640 // Helper method to translate from Permissions to ContentSettings | 641 // Helper method to translate from Permissions to ContentSettings |
| 641 ContentSettingsType PermissionToContentSetting( | 642 ContentSettingsType PermissionToContentSetting( |
| 642 content::PermissionType permission) { | 643 content::PermissionType permission) { |
| 643 switch (permission) { | 644 switch (permission) { |
| 644 case content::PERMISSION_MIDI_SYSEX: | 645 case content::PermissionType::MIDI_SYSEX: |
| 645 return CONTENT_SETTINGS_TYPE_MIDI_SYSEX; | 646 return CONTENT_SETTINGS_TYPE_MIDI_SYSEX; |
| 646 case content::PERMISSION_PUSH_MESSAGING: | 647 case content::PermissionType::PUSH_MESSAGING: |
| 647 return CONTENT_SETTINGS_TYPE_PUSH_MESSAGING; | 648 return CONTENT_SETTINGS_TYPE_PUSH_MESSAGING; |
| 648 case content::PERMISSION_NOTIFICATIONS: | 649 case content::PermissionType::NOTIFICATIONS: |
| 649 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; | 650 return CONTENT_SETTINGS_TYPE_NOTIFICATIONS; |
| 650 case content::PERMISSION_GEOLOCATION: | 651 case content::PermissionType::GEOLOCATION: |
| 651 return CONTENT_SETTINGS_TYPE_GEOLOCATION; | 652 return CONTENT_SETTINGS_TYPE_GEOLOCATION; |
| 652 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 653 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 653 case content::PERMISSION_PROTECTED_MEDIA_IDENTIFIER: | 654 case content::PermissionType::PROTECTED_MEDIA_IDENTIFIER: |
| 654 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; | 655 return CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER; |
| 655 #endif | 656 #endif |
| 656 default: | 657 default: |
| 657 NOTREACHED() << "Unknown content setting for permission " << permission; | 658 NOTREACHED() << "Unknown content setting for permission " |
| 659 << static_cast<int>(permission); |
| 658 return CONTENT_SETTINGS_TYPE_DEFAULT; | 660 return CONTENT_SETTINGS_TYPE_DEFAULT; |
| 659 } | 661 } |
| 660 } | 662 } |
| 661 | 663 |
| 662 void OnRequestPermission( | 664 void OnRequestPermission( |
| 663 const base::Callback<void(content::PermissionStatus)>& callback, | 665 const base::Callback<void(content::PermissionStatus)>& callback, |
| 664 ContentSetting content_setting) { | 666 ContentSetting content_setting) { |
| 665 callback.Run(ContentSettingToPermissionStatus(content_setting)); | 667 callback.Run(ContentSettingToPermissionStatus(content_setting)); |
| 666 } | 668 } |
| 667 | 669 |
| (...skipping 1914 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2582 switches::kDisableWebRtcEncryption, | 2584 switches::kDisableWebRtcEncryption, |
| 2583 }; | 2585 }; |
| 2584 to_command_line->CopySwitchesFrom(from_command_line, | 2586 to_command_line->CopySwitchesFrom(from_command_line, |
| 2585 kWebRtcDevSwitchNames, | 2587 kWebRtcDevSwitchNames, |
| 2586 arraysize(kWebRtcDevSwitchNames)); | 2588 arraysize(kWebRtcDevSwitchNames)); |
| 2587 } | 2589 } |
| 2588 } | 2590 } |
| 2589 #endif // defined(ENABLE_WEBRTC) | 2591 #endif // defined(ENABLE_WEBRTC) |
| 2590 | 2592 |
| 2591 } // namespace chrome | 2593 } // namespace chrome |
| OLD | NEW |