| 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/media/chrome_midi_permission_context.h" | 5 #include "chrome/browser/media/chrome_midi_permission_context.h" |
| 6 | 6 |
| 7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 9 #include "chrome/browser/content_settings/permission_queue_controller.h" | 9 #include "chrome/browser/content_settings/permission_queue_controller.h" |
| 10 #include "chrome/browser/content_settings/permission_request_id.h" | 10 #include "chrome/browser/content_settings/permission_request_id.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 case CONTENT_SETTING_BLOCK: | 192 case CONTENT_SETTING_BLOCK: |
| 193 PermissionDecided(id, requesting_frame, embedder, callback, false); | 193 PermissionDecided(id, requesting_frame, embedder, callback, false); |
| 194 break; | 194 break; |
| 195 case CONTENT_SETTING_ALLOW: | 195 case CONTENT_SETTING_ALLOW: |
| 196 PermissionDecided(id, requesting_frame, embedder, callback, true); | 196 PermissionDecided(id, requesting_frame, embedder, callback, true); |
| 197 break; | 197 break; |
| 198 default: | 198 default: |
| 199 if (PermissionBubbleManager::Enabled()) { | 199 if (PermissionBubbleManager::Enabled()) { |
| 200 PermissionBubbleManager* bubble_manager = | 200 PermissionBubbleManager* bubble_manager = |
| 201 PermissionBubbleManager::FromWebContents(web_contents); | 201 PermissionBubbleManager::FromWebContents(web_contents); |
| 202 bubble_manager->AddRequest(new MidiPermissionRequest( | 202 if (bubble_manager) { |
| 203 this, id, requesting_frame, user_gesture, | 203 bubble_manager->AddRequest(new MidiPermissionRequest( |
| 204 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), | 204 this, id, requesting_frame, user_gesture, |
| 205 callback)); | 205 profile_->GetPrefs()->GetString(prefs::kAcceptLanguages), |
| 206 callback)); |
| 207 } |
| 206 return; | 208 return; |
| 207 } | 209 } |
| 208 | 210 |
| 209 // TODO(gbillock): Delete this and the infobar delegate when | 211 // TODO(gbillock): Delete this and the infobar delegate when |
| 210 // we're using only bubbles. crbug.com/337458 | 212 // we're using only bubbles. crbug.com/337458 |
| 211 GetQueueController()->CreateInfoBarRequest( | 213 GetQueueController()->CreateInfoBarRequest( |
| 212 id, requesting_frame, embedder, std::string(), base::Bind( | 214 id, requesting_frame, embedder, std::string(), base::Bind( |
| 213 &ChromeMidiPermissionContext::NotifyPermissionSet, | 215 &ChromeMidiPermissionContext::NotifyPermissionSet, |
| 214 base::Unretained(this), id, requesting_frame, callback)); | 216 base::Unretained(this), id, requesting_frame, callback)); |
| 215 } | 217 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 } | 257 } |
| 256 | 258 |
| 257 void ChromeMidiPermissionContext::CancelPendingInfobarRequest( | 259 void ChromeMidiPermissionContext::CancelPendingInfobarRequest( |
| 258 const PermissionRequestID& id) { | 260 const PermissionRequestID& id) { |
| 259 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 261 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 260 if (shutting_down_) | 262 if (shutting_down_) |
| 261 return; | 263 return; |
| 262 // TODO(gbillock): Add support for cancellation to permission bubbles. | 264 // TODO(gbillock): Add support for cancellation to permission bubbles. |
| 263 GetQueueController()->CancelInfoBarRequest(id); | 265 GetQueueController()->CancelInfoBarRequest(id); |
| 264 } | 266 } |
| OLD | NEW |