summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjiayl@chromium.org <jiayl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-28 20:29:12 +0000
committerjiayl@chromium.org <jiayl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-28 20:29:12 +0000
commitbf194225d67dde6571680e557554866357ec9210 (patch)
tree1a7aea118a776a29214f456763b185a0bdcf49c5
parent67ae93c46f0efc8b23ed5b1eee2c8ad1788c4db5 (diff)
downloadchromium_src-bf194225d67dde6571680e557554866357ec9210.zip
chromium_src-bf194225d67dde6571680e557554866357ec9210.tar.gz
chromium_src-bf194225d67dde6571680e557554866357ec9210.tar.bz2
Enables screen cast for individual monitors.
BUG=https://code.google.com/p/webrtc/issues/detail?id=2787 Review URL: https://codereview.chromium.org/135733007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247492 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/app/generated_resources.grd23
-rw-r--r--chrome/browser/media/native_desktop_media_list.cc24
-rw-r--r--chrome/browser/media/native_desktop_media_list_unittest.cc8
-rw-r--r--content/browser/renderer_host/media/desktop_capture_device.cc7
4 files changed, 42 insertions, 20 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd
index 3c53c11..92b9465 100644
--- a/chrome/app/generated_resources.grd
+++ b/chrome/app/generated_resources.grd
@@ -10454,7 +10454,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_TOOLTIP_PHONE_NUMBER" desc="A tooltip explaining why the user must enter a phone number.">
Merchants often need this in case there are problems shipping your order.
</message>
-
+
<!-- On Android, we use Google Play Services to handle all the UI for the Autofill Dialog -->
<if expr="not is_android">
<!-- Autofill dialog: title bar -->
@@ -10479,7 +10479,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_GOOGLE_WALLET" desc="The menu item that allows a user to select Google Wallet as their payment backend.">
Google Wallet
</message>
-
+
<!-- Autofill dialog: notification area -->
<message name="IDS_AUTOFILL_DIALOG_USE_WALLET" desc="Text that shows on top of the autofill dialog when using data Google Wallet already knows about the user.">
Protect my payment with Google Wallet.
@@ -10511,7 +10511,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_CHOOSE_DIFFERENT_WALLET_INSTRUMENT" desc="Text asking the user to choose a different payment method or address when using wallet.">
More information is needed to complete this purchase.
</message>
-
+
<!--- Autofill dialog: Wallet interstitials -->
<message name="IDS_AUTOFILL_DIALOG_LOADING" desc="A message to let the users know that Chrome is waiting on a network response. This is followed by an ellipsis, as in 'Loading...'">
Loading payment details
@@ -10522,7 +10522,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_CARD_GENERATION_DONE" desc="Text the user sees after the wallet servers respond with a generated card number.">
Your Virtual Card is ready.
</message>
-
+
<!--- Autofill dialog: Wallet error messages -->
<message name="IDS_AUTOFILL_WALLET_BUYER_ACCOUNT_ERROR" desc="Text explaining that the user's Wallet account cannot be used.">
There's something wrong with your Google Wallet account.
@@ -10545,7 +10545,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_WALLET_ERROR_CODE_TOOLTIP" desc="Text shown in a (?) tooltip to explain which error Chrome encountered when trying to communicate with Online Wallet.">
Error code: <ph name="ERROR_CODE">$1<ex>54</ex></ph>
</message>
-
+
<!-- Autofill dialog: detail section -->
<message name="IDS_AUTOFILL_DIALOG_EDIT" desc="Text of link in autofill dialog which allows user to edit address + payment info.">
Edit
@@ -10571,7 +10571,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_VERIFY_BUTTON" desc="Button text for verifying user details.">
Verify
</message>
-
+
<!-- Autofill dialog: combobox menu items -->
<message name="IDS_AUTOFILL_DIALOG_ADD_CREDIT_CARD" desc="Menu item for adding a new credit card in the autofill dialog.">
New credit card...
@@ -10600,7 +10600,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_USE_BILLING_FOR_SHIPPING" desc="Menu Item label that asks whether the billing info should also be used for shipping info.">
Use billing address for shipping
</message>
-
+
<!-- Autofill dialog: legal documents -->
<message name="IDS_AUTOFILL_DIALOG_LOCATION_DISCLOSURE" desc="Text at the bottom of the autofill dialog which stands alone to inform the user that they'll be sharing their location with Google Wallet if they choose to proceed.">
By clicking Continue you agree to use Google Wallet. To protect you from fraud, information about your computer (including its location) will be shared with Google Wallet.
@@ -10623,7 +10623,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_LEGAL_LINKS_6" desc="Label at the bottom of the autofill dialog that is shown when a user needs to accept legal documents (ex: Privacy Policy, Terms Of Service).">
By clicking Continue you agree to the <ph name="LEGAL_DOC_LINK_TEXT_1">$1<ex>Google Wallet Terms Of Service</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_2">$2<ex>Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_3">$3<ex>Further Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_4">$4<ex>Further Terms of Use</ex></ph>, <ph name="LEGAL_DOC_LINK_TEXT_5">$5<ex>Further Terms of Use</ex></ph>, and <ph name="LEGAL_DOC_LINK_TEXT_6">$6<ex>Privacy Policy</ex></ph>.
</message>
-
+
<!-- Autofill dialog: validation messages -->
<message name="IDS_AUTOFILL_DIALOG_VALIDATION_WALLET_REQUIRES_TWO_NAMES" desc="Message displayed to user when card holder name validation for Wallet fails.">
Google Wallet requires at least a first and last name.
@@ -10652,7 +10652,7 @@ Would you like to start <ph name="CONTROL_PANEL_APPLET_NAME">$1<ex>Add/Remove Pr
<message name="IDS_AUTOFILL_DIALOG_VALIDATION_MISSING_VALUE" desc="Message displayed to user when one of the required fields is left empty.">
Field is required
</message>
-
+
<!-- Autofill dialog post-submit bubbles -->
<message name="IDS_AUTOFILL_GENERATED_CREDIT_CARD_BUBBLE_TITLE" desc="Title of a bubble shown directly after a new card has been generated via Online Wallet using the Autofill dialog.">
Google Wallet is protecting your card
@@ -14605,9 +14605,12 @@ Do you accept?
<message name="IDS_DESKTOP_MEDIA_PICKER_TEXT" desc="Text for the window picker dialog shown when desktop capture is requrested by an app.">
<ph name="APP_NAME">$1<ex>Google Hangouts</ex></ph> requested to share content of your desktop. Please select a window or the whole screen to share.
</message>
- <message name="IDS_DESKTOP_MEDIA_PICKER_SCREEN_NAME" desc="Name for screens in the desktop media picker UI.">
+ <message name="IDS_DESKTOP_MEDIA_PICKER_SINGLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there is only one monitor.">
Screen
</message>
+ <message name="IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME" desc="Name for screens in the desktop media picker UI when there are multiple monitors.">
+ Screen <ph name="SCREEN_INDEX">$1<ex>1</ex></ph>
+ </message>
<!-- About network UI display strings -->
<if expr="pp_ifdef('chromeos')">
diff --git a/chrome/browser/media/native_desktop_media_list.cc b/chrome/browser/media/native_desktop_media_list.cc
index 7f5128b..3e48f90 100644
--- a/chrome/browser/media/native_desktop_media_list.cc
+++ b/chrome/browser/media/native_desktop_media_list.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/media/native_desktop_media_list.h"
#include <map>
+#include <sstream>
#include "base/hash.h"
#include "base/logging.h"
@@ -134,10 +135,23 @@ void NativeDesktopMediaList::Worker::Refresh(
std::vector<SourceDescription> sources;
if (screen_capturer_) {
- // TODO(sergeyu): Enumerate each screen when ScreenCapturer supports it.
- sources.push_back(SourceDescription(DesktopMediaID(
- DesktopMediaID::TYPE_SCREEN, 0),
- l10n_util::GetStringUTF16(IDS_DESKTOP_MEDIA_PICKER_SCREEN_NAME)));
+ webrtc::ScreenCapturer::ScreenList screens;
+ if (screen_capturer_->GetScreenList(&screens)) {
+ bool mutiple_screens = screens.size() > 1;
+ base::string16 title;
+ for (size_t i = 0; i < screens.size(); ++i) {
+ if (mutiple_screens) {
+ title = l10n_util::GetStringFUTF16Int(
+ IDS_DESKTOP_MEDIA_PICKER_MULTIPLE_SCREEN_NAME,
+ static_cast<int>(i + 1));
+ } else {
+ title = l10n_util::GetStringUTF16(
+ IDS_DESKTOP_MEDIA_PICKER_SINGLE_SCREEN_NAME);
+ }
+ sources.push_back(SourceDescription(DesktopMediaID(
+ DesktopMediaID::TYPE_SCREEN, screens[i].id), title));
+ }
+ }
}
if (window_capturer_) {
@@ -171,6 +185,8 @@ void NativeDesktopMediaList::Worker::Refresh(
SourceDescription& source = sources[i];
switch (source.id.type) {
case DesktopMediaID::TYPE_SCREEN:
+ if (!screen_capturer_->SelectScreen(source.id.id))
+ continue;
screen_capturer_->Capture(webrtc::DesktopRegion());
DCHECK(current_frame_);
break;
diff --git a/chrome/browser/media/native_desktop_media_list_unittest.cc b/chrome/browser/media/native_desktop_media_list_unittest.cc
index 4610ac3..83c6c42 100644
--- a/chrome/browser/media/native_desktop_media_list_unittest.cc
+++ b/chrome/browser/media/native_desktop_media_list_unittest.cc
@@ -52,11 +52,15 @@ class FakeScreenCapturer : public webrtc::ScreenCapturer {
}
virtual bool GetScreenList(ScreenList* screens) OVERRIDE {
- return false;
+ webrtc::ScreenCapturer::Screen screen;
+ screen.id = 0;
+ screens->push_back(screen);
+ return true;
}
virtual bool SelectScreen(webrtc::ScreenId id) OVERRIDE {
- return false;
+ EXPECT_EQ(0, id);
+ return true;
}
protected:
diff --git a/content/browser/renderer_host/media/desktop_capture_device.cc b/content/browser/renderer_host/media/desktop_capture_device.cc
index 7c78df0..74ecd80 100644
--- a/content/browser/renderer_host/media/desktop_capture_device.cc
+++ b/content/browser/renderer_host/media/desktop_capture_device.cc
@@ -366,13 +366,12 @@ scoped_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create(
switch (source.type) {
case DesktopMediaID::TYPE_SCREEN: {
- scoped_ptr<webrtc::DesktopCapturer> screen_capturer;
+ scoped_ptr<webrtc::ScreenCapturer> screen_capturer;
screen_capturer.reset(webrtc::ScreenCapturer::Create(options));
- if (screen_capturer) {
+ if (screen_capturer && screen_capturer->SelectScreen(source.id)) {
capturer.reset(new webrtc::DesktopAndCursorComposer(
screen_capturer.release(),
- webrtc::MouseCursorMonitor::CreateForScreen(
- options, webrtc::kFullDesktopScreenId)));
+ webrtc::MouseCursorMonitor::CreateForScreen(options, source.id)));
}
break;
}