Chromium Code Reviews| 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/media/webrtc/media_stream_devices_controller.h" | 5 #include "chrome/browser/media/webrtc/media_stream_devices_controller.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 33 #include "components/prefs/scoped_user_pref_update.h" | 33 #include "components/prefs/scoped_user_pref_update.h" |
| 34 #include "components/url_formatter/elide_url.h" | 34 #include "components/url_formatter/elide_url.h" |
| 35 #include "content/public/browser/browser_thread.h" | 35 #include "content/public/browser/browser_thread.h" |
| 36 #include "content/public/browser/render_frame_host.h" | 36 #include "content/public/browser/render_frame_host.h" |
| 37 #include "content/public/browser/render_process_host.h" | 37 #include "content/public/browser/render_process_host.h" |
| 38 #include "content/public/browser/render_widget_host_view.h" | 38 #include "content/public/browser/render_widget_host_view.h" |
| 39 #include "content/public/common/media_stream_request.h" | 39 #include "content/public/common/media_stream_request.h" |
| 40 #include "content/public/common/origin_util.h" | 40 #include "content/public/common/origin_util.h" |
| 41 #include "extensions/common/constants.h" | 41 #include "extensions/common/constants.h" |
| 42 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 43 #include "ui/gfx/vector_icons_public.h" | |
| 43 | 44 |
| 44 #if BUILDFLAG(ANDROID_JAVA_UI) | 45 #if BUILDFLAG(ANDROID_JAVA_UI) |
| 45 #include <vector> | 46 #include <vector> |
| 46 | 47 |
| 47 #include "chrome/browser/android/preferences/pref_service_bridge.h" | 48 #include "chrome/browser/android/preferences/pref_service_bridge.h" |
| 48 #include "chrome/browser/permissions/permission_update_infobar_delegate_android. h" | 49 #include "chrome/browser/permissions/permission_update_infobar_delegate_android. h" |
| 49 #include "content/public/browser/android/content_view_core.h" | 50 #include "content/public/browser/android/content_view_core.h" |
| 50 #include "ui/android/window_android.h" | 51 #include "ui/android/window_android.h" |
| 51 #endif // BUILDFLAG(ANDROID_JAVA_UI) | 52 #endif // BUILDFLAG(ANDROID_JAVA_UI) |
| 52 | 53 |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 268 void MediaStreamDevicesController::ForcePermissionDeniedTemporarily() { | 269 void MediaStreamDevicesController::ForcePermissionDeniedTemporarily() { |
| 269 set_persist(false); | 270 set_persist(false); |
| 270 // TODO(tsergeant): Determine whether it is appropriate to record permission | 271 // TODO(tsergeant): Determine whether it is appropriate to record permission |
| 271 // action metrics here, as this is a different sort of user action. | 272 // action metrics here, as this is a different sort of user action. |
| 272 RunCallback(CONTENT_SETTING_BLOCK, | 273 RunCallback(CONTENT_SETTING_BLOCK, |
| 273 CONTENT_SETTING_BLOCK, | 274 CONTENT_SETTING_BLOCK, |
| 274 content::MEDIA_DEVICE_PERMISSION_DENIED); | 275 content::MEDIA_DEVICE_PERMISSION_DENIED); |
| 275 set_persist(true); | 276 set_persist(true); |
| 276 } | 277 } |
| 277 | 278 |
| 278 int MediaStreamDevicesController::GetIconId() const { | 279 PermissionRequest::IconId MediaStreamDevicesController::GetIconId() const { |
| 279 if (IsAskingForVideo()) | 280 if (IsAskingForVideo()) |
| 280 return IDR_INFOBAR_MEDIA_STREAM_CAMERA; | 281 return gfx::VectorIconId::VIDEOCAM; |
| 281 | 282 |
| 282 return IDR_INFOBAR_MEDIA_STREAM_MIC; | 283 return gfx::VectorIconId::MICROPHONE; |
|
Peter Kasting
2016/10/06 07:10:29
Nit: Shorter:
return IsAskingForVideo() ? gfx::
Evan Stade
2016/10/06 15:33:50
Done.
| |
| 283 } | 284 } |
| 284 | 285 |
| 285 base::string16 MediaStreamDevicesController::GetMessageTextFragment() const { | 286 base::string16 MediaStreamDevicesController::GetMessageTextFragment() const { |
| 286 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO_PERMISSION_FRAGMENT; | 287 int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO_PERMISSION_FRAGMENT; |
| 287 if (!IsAskingForAudio()) | 288 if (!IsAskingForAudio()) |
| 288 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; | 289 message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY_PERMISSION_FRAGMENT; |
| 289 else if (!IsAskingForVideo()) | 290 else if (!IsAskingForVideo()) |
| 290 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; | 291 message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY_PERMISSION_FRAGMENT; |
| 291 return l10n_util::GetStringUTF16(message_id); | 292 return l10n_util::GetStringUTF16(message_id); |
| 292 } | 293 } |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 624 if (android_permission_blocked) | 625 if (android_permission_blocked) |
| 625 return false; | 626 return false; |
| 626 | 627 |
| 627 // Don't approve device requests if the tab was hidden. | 628 // Don't approve device requests if the tab was hidden. |
| 628 // TODO(qinmin): Add a test for this. http://crbug.com/396869. | 629 // TODO(qinmin): Add a test for this. http://crbug.com/396869. |
| 629 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? | 630 // TODO(raymes): Shouldn't this apply to all permissions not just audio/video? |
| 630 return web_contents_->GetRenderWidgetHostView()->IsShowing(); | 631 return web_contents_->GetRenderWidgetHostView()->IsShowing(); |
| 631 #endif | 632 #endif |
| 632 return true; | 633 return true; |
| 633 } | 634 } |
| OLD | NEW |