Index: chrome/browser/media/media_capture_devices_dispatcher.cc |
diff --git a/chrome/browser/media/media_capture_devices_dispatcher.cc b/chrome/browser/media/media_capture_devices_dispatcher.cc |
index 29c7afbec8d820c24b7dbcf33b752af116bfd7db..38196d3c8b410ca04d714bd24f4672bec203804e 100644 |
--- a/chrome/browser/media/media_capture_devices_dispatcher.cc |
+++ b/chrome/browser/media/media_capture_devices_dispatcher.cc |
@@ -105,6 +105,30 @@ bool IsOriginWhitelistedForScreenCapture(const GURL& origin) { |
#endif |
} |
+#if defined(OS_CHROMEOS) |
+// Returns true of the security origin is associated with casting. |
+bool IsOriginForCasting(const GURL& origin) { |
+#if defined(OFFICIAL_BUILD) |
+ // Whitelisted tab casting extensions. |
+ if (origin.spec() == "chrome-extension://pkedcjkdefgpdelpbcmbmeomcjbeemfm/" || |
+ origin.spec() == "chrome-extension://fmfcbgogabcbclcofgocippekhfcmgfj/" || |
+ origin.spec() == "chrome-extension://hfaagokkkhdbgiakmmlclaapfelnkoah/") { |
+ return true; |
+ } |
+ // Check against hashed origins. |
+ const std::string origin_hash = base::SHA1HashString(origin.spec()); |
+ DCHECK_EQ(origin_hash.length(), base::kSHA1Length); |
+ const std::string hexencoded_origin_hash = |
+ base::HexEncode(origin_hash.data(), origin_hash.length()); |
+ return |
+ hexencoded_origin_hash == "3C2705BC432E7C51CA8553FDC5BEE873FF2468EE" || |
+ hexencoded_origin_hash == "50F02B8A668CAB274527D58356F07C2143080FCC"; |
+#else |
+ return false; |
+#endif |
+} |
+#endif |
+ |
// Helper to get title of the calling application shown in the screen capture |
// notification. |
base::string16 GetApplicationTitle(content::WebContents* web_contents, |
@@ -395,7 +419,7 @@ void MediaCaptureDevicesDispatcher::ProcessScreenCaptureAccessRequest( |
// display the notification for stream capture. |
bool display_notification = !component_extension; |
- ui = GetDevicesForDesktopCapture(devices, screen_id, capture_audio, |
+ ui = GetDevicesForDesktopCapture(devices, screen_id, capture_audio, |
display_notification, application_title); |
} |
} |
@@ -755,6 +779,18 @@ void MediaCaptureDevicesDispatcher::UpdateMediaRequestStateOnUIThread( |
} |
} |
+#if defined(OS_CHROMEOS) |
+ if (IsOriginForCasting(device.security_origin) && |
+ IsVideoMediaType(device.type)) { |
+ // Notify ash that casting state has changed. |
+ if (state == content::MEDIA_REQUEST_STATE_DONE) { |
+ ash::Shell::GetInstance()->OnCastingStateChanged(true); |
+ } else if (state == content::MEDIA_REQUEST_STATE_CLOSING) { |
+ ash::Shell::GetInstance()->OnCastingStateChanged(false); |
+ } |
+ } |
+#endif |
+ |
FOR_EACH_OBSERVER(Observer, observers_, |
OnRequestUpdate(render_process_id, |
render_view_id, |