summaryrefslogtreecommitdiffstats
path: root/chrome/browser/media
diff options
context:
space:
mode:
authorxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 11:43:24 +0000
committerxians@chromium.org <xians@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-15 11:43:24 +0000
commit55ac3dd53c7e966815d617a4d64a1ac96c8f1eda (patch)
treeae0b637e7b88d31a1bb7983df61f2e823f83de98 /chrome/browser/media
parent3d41de33117f516abfa1ea7db5af65995bde5b9f (diff)
downloadchromium_src-55ac3dd53c7e966815d617a4d64a1ac96c8f1eda.zip
chromium_src-55ac3dd53c7e966815d617a4d64a1ac96c8f1eda.tar.gz
chromium_src-55ac3dd53c7e966815d617a4d64a1ac96c8f1eda.tar.bz2
#1 we should use a red mic or red camera icon in the infobar.
#2 same icon for the status tray, and we will show mic icon when only microphone is being used, camera icon is shown as long as camera is used. #3 Change "Devices" to "Options" in the infobar. BUG=132770,132955 test=manual test by goto https://apprtc.appspot.com Review URL: https://chromiumcodereview.appspot.com/10541174 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@142378 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/media')
-rw-r--r--chrome/browser/media/media_stream_capture_indicator.cc49
-rw-r--r--chrome/browser/media/media_stream_capture_indicator.h19
2 files changed, 41 insertions, 27 deletions
diff --git a/chrome/browser/media/media_stream_capture_indicator.cc b/chrome/browser/media/media_stream_capture_indicator.cc
index 55f6751..d4dae2b 100644
--- a/chrome/browser/media/media_stream_capture_indicator.cc
+++ b/chrome/browser/media/media_stream_capture_indicator.cc
@@ -20,6 +20,7 @@
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "grit/theme_resources.h"
+#include "grit/theme_resources_standard.h"
#include "net/base/net_util.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
@@ -39,7 +40,10 @@ bool MediaStreamCaptureIndicator::TabEquals::operator() (
}
MediaStreamCaptureIndicator::MediaStreamCaptureIndicator()
- : status_icon_(NULL) {
+ : status_icon_(NULL),
+ mic_image_(NULL),
+ camera_image_(NULL),
+ balloon_image_(NULL) {
}
MediaStreamCaptureIndicator::~MediaStreamCaptureIndicator() {
@@ -149,23 +153,26 @@ void MediaStreamCaptureIndicator::CreateStatusTray() {
status_icon_ = status_tray->CreateStatusIcon();
- EnsureStatusTrayIcon();
- DCHECK(!tray_image_.empty());
- DCHECK(!balloon_image_.empty());
-
- status_icon_->SetImage(tray_image_);
+ EnsureStatusTrayIconResources();
}
-void MediaStreamCaptureIndicator::EnsureStatusTrayIcon() {
+void MediaStreamCaptureIndicator::EnsureStatusTrayIconResources() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- if (tray_image_.empty()) {
- tray_image_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
- IDR_MEDIA_STREAM_CAPTURE_LED);
+ if (!mic_image_) {
+ mic_image_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_INFOBAR_MEDIA_STREAM_MIC);
+ }
+ if (!camera_image_) {
+ camera_image_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ IDR_INFOBAR_MEDIA_STREAM_CAMERA);
}
- if (balloon_image_.empty()) {
- balloon_image_ = *ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
+ if (!balloon_image_) {
+ balloon_image_ = ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
IDR_PRODUCT_LOGO_32);
}
+ DCHECK(mic_image_);
+ DCHECK(camera_image_);
+ DCHECK(balloon_image_);
}
void MediaStreamCaptureIndicator::ShowBalloon(
@@ -186,7 +193,7 @@ void MediaStreamCaptureIndicator::ShowBalloon(
string16 body = l10n_util::GetStringFUTF16(
message_id, GetSecurityOrigin(render_process_id, render_view_id));
- status_icon_->DisplayBalloon(balloon_image_, title, body);
+ status_icon_->DisplayBalloon(*balloon_image_, title, body);
}
void MediaStreamCaptureIndicator::Hide() {
@@ -241,18 +248,24 @@ void MediaStreamCaptureIndicator::UpdateStatusTrayIconContextMenu() {
// The icon will take the ownership of the passed context menu.
status_icon_->SetContextMenu(menu.release());
- UpdateStatusTrayIconTooltip(audio, video);
+ UpdateStatusTrayIconDisplay(audio, video);
}
-void MediaStreamCaptureIndicator::UpdateStatusTrayIconTooltip(
+void MediaStreamCaptureIndicator::UpdateStatusTrayIconDisplay(
bool audio, bool video) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK(audio || video);
- int message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_AND_VIDEO;
- if (audio && !video)
+ int message_id = 0;
+ if (audio && video) {
+ message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_AND_VIDEO;
+ status_icon_->SetImage(*camera_image_);
+ } else if (audio && !video) {
message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_AUDIO_ONLY;
- else if (!audio && video)
+ status_icon_->SetImage(*mic_image_);
+ } else if (!audio && video) {
message_id = IDS_MEDIA_STREAM_STATUS_TRAY_TEXT_VIDEO_ONLY;
+ status_icon_->SetImage(*camera_image_);
+ }
status_icon_->SetToolTip(l10n_util::GetStringFUTF16(
message_id, l10n_util::GetStringUTF16(IDS_PRODUCT_NAME)));
diff --git a/chrome/browser/media/media_stream_capture_indicator.h b/chrome/browser/media/media_stream_capture_indicator.h
index 588707a..cd117ac 100644
--- a/chrome/browser/media/media_stream_capture_indicator.h
+++ b/chrome/browser/media/media_stream_capture_indicator.h
@@ -88,8 +88,8 @@ class MediaStreamCaptureIndicator
// Creates the status tray if it has not been created.
void CreateStatusTray();
- // Makes sure we have done one-time initialization of the |icon_image_|.
- void EnsureStatusTrayIcon();
+ // Makes sure we have done one-time initialization of the images.
+ void EnsureStatusTrayIconResources();
// Adds the new tab to the device usage list.
void AddCaptureDeviceTab(int render_process_id,
@@ -121,18 +121,19 @@ class MediaStreamCaptureIndicator
// triggered by both AddCaptureDeviceTab() and RemoveCaptureDeviceTab().
void UpdateStatusTrayIconContextMenu();
- // Updates the status tray tooltip with the new device list. This function is
- // called by UpdateStatusTrayIconContextMenu().
- void UpdateStatusTrayIconTooltip(bool audio, bool video);
+ // Updates the status tray tooltip and image according to which kind of
+ // devices are being used. This function is called by
+ // UpdateStatusTrayIconContextMenu().
+ void UpdateStatusTrayIconDisplay(bool audio, bool video);
// Reference to our status icon - owned by the StatusTray. If null,
// the platform doesn't support status icons.
StatusIcon* status_icon_;
- // Icon to be displayed on the status tray.
- gfx::ImageSkia tray_image_;
-
- gfx::ImageSkia balloon_image_;
+ // These images are owned by ResourceBundle and need not be destroyed.
+ gfx::ImageSkia* mic_image_;
+ gfx::ImageSkia* camera_image_;
+ gfx::ImageSkia* balloon_image_;
// A list that contains the usage information of the opened capture devices.
typedef std::vector<CaptureDeviceTab> CaptureDeviceTabs;