Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_queue_controller.h" | 5 #include "chrome/browser/permissions/permission_queue_controller.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
| 9 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" | 9 #include "chrome/browser/geolocation/geolocation_infobar_delegate.h" |
| 10 #include "chrome/browser/infobars/infobar_service.h" | 10 #include "chrome/browser/infobars/infobar_service.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 } | 106 } |
| 107 | 107 |
| 108 void PermissionQueueController::PendingInfobarRequest::RunCallback( | 108 void PermissionQueueController::PendingInfobarRequest::RunCallback( |
| 109 ContentSetting content_setting) { | 109 ContentSetting content_setting) { |
| 110 callback_.Run(content_setting); | 110 callback_.Run(content_setting); |
| 111 } | 111 } |
| 112 | 112 |
| 113 void PermissionQueueController::PendingInfobarRequest::CreateInfoBar( | 113 void PermissionQueueController::PendingInfobarRequest::CreateInfoBar( |
| 114 PermissionQueueController* controller, | 114 PermissionQueueController* controller, |
| 115 const std::string& display_languages) { | 115 const std::string& display_languages) { |
| 116 base::Callback<void(bool, bool)> callback = | |
|
mlamouri (slow - plz ping)
2015/09/15 12:55:59
rename to PermissionInfobarDelegate::PermissionSet
Lalit Maganti
2015/09/15 14:19:25
Done.
| |
| 117 base::Bind(&PermissionQueueController::OnPermissionSet, | |
| 118 base::Unretained(controller), | |
|
mlamouri (slow - plz ping)
2015/09/15 12:55:59
Add a comment explaining why base::Unretained() is
Lalit Maganti
2015/09/15 14:19:25
Done.
| |
| 119 id_, | |
| 120 requesting_frame_, | |
| 121 embedder_); | |
| 122 | |
| 116 switch (type_) { | 123 switch (type_) { |
| 117 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 124 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 118 infobar_ = GeolocationInfoBarDelegate::Create( | 125 infobar_ = GeolocationInfoBarDelegate::Create( |
| 119 GetInfoBarService(id_), controller, id_, requesting_frame_, | 126 GetInfoBarService(id_), id_, requesting_frame_, |
| 120 display_languages); | 127 display_languages, callback); |
| 121 break; | 128 break; |
| 122 #if defined(ENABLE_NOTIFICATIONS) | 129 #if defined(ENABLE_NOTIFICATIONS) |
| 123 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 130 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 124 infobar_ = NotificationPermissionInfobarDelegate::Create( | 131 infobar_ = NotificationPermissionInfobarDelegate::Create( |
| 125 GetInfoBarService(id_), controller, id_, requesting_frame_, | 132 GetInfoBarService(id_), id_, requesting_frame_, |
| 126 display_languages); | 133 display_languages, callback); |
| 127 break; | 134 break; |
| 128 #endif // ENABLE_NOTIFICATIONS | 135 #endif // ENABLE_NOTIFICATIONS |
| 129 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 136 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 130 infobar_ = MidiPermissionInfoBarDelegate::Create( | 137 infobar_ = MidiPermissionInfoBarDelegate::Create( |
| 131 GetInfoBarService(id_), controller, id_, requesting_frame_, | 138 GetInfoBarService(id_), id_, requesting_frame_, |
| 132 display_languages, type_); | 139 display_languages, type_, callback); |
| 133 break; | 140 break; |
| 134 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) | 141 #if defined(OS_ANDROID) || defined(OS_CHROMEOS) |
| 135 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: | 142 case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: |
| 136 infobar_ = ProtectedMediaIdentifierInfoBarDelegate::Create( | 143 infobar_ = ProtectedMediaIdentifierInfoBarDelegate::Create( |
| 137 GetInfoBarService(id_), controller, id_, requesting_frame_, | 144 GetInfoBarService(id_), id_, requesting_frame_, |
| 138 display_languages); | 145 display_languages, callback); |
| 139 break; | 146 break; |
| 140 #endif | 147 #endif |
| 141 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: | 148 case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: |
| 142 infobar_ = DurableStoragePermissionInfoBarDelegate::Create( | 149 infobar_ = DurableStoragePermissionInfoBarDelegate::Create( |
| 143 GetInfoBarService(id_), controller, id_, requesting_frame_, | 150 GetInfoBarService(id_), id_, requesting_frame_, |
| 144 display_languages, type_); | 151 display_languages, type_, callback); |
| 145 break; | 152 break; |
| 146 default: | 153 default: |
| 147 NOTREACHED(); | 154 NOTREACHED(); |
| 148 break; | 155 break; |
| 149 } | 156 } |
| 150 } | 157 } |
| 151 | 158 |
| 152 | 159 |
| 153 PermissionQueueController::PermissionQueueController(Profile* profile, | 160 PermissionQueueController::PermissionQueueController(Profile* profile, |
| 154 ContentSettingsType type) | 161 ContentSettingsType type) |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 397 ContentSettingsPattern::Wildcard() : | 404 ContentSettingsPattern::Wildcard() : |
| 398 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); | 405 ContentSettingsPattern::FromURLNoWildcard(embedder.GetOrigin()); |
| 399 | 406 |
| 400 profile_->GetHostContentSettingsMap()->SetContentSetting( | 407 profile_->GetHostContentSettingsMap()->SetContentSetting( |
| 401 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), | 408 ContentSettingsPattern::FromURLNoWildcard(requesting_frame.GetOrigin()), |
| 402 embedder_pattern, | 409 embedder_pattern, |
| 403 type_, | 410 type_, |
| 404 std::string(), | 411 std::string(), |
| 405 content_setting); | 412 content_setting); |
| 406 } | 413 } |
| OLD | NEW |