Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5479)

Unified Diff: chrome/browser/ui/media_stream_infobar_delegate.cc

Issue 13926012: Move media_stream_infobar_delegate.* from c/b/ui/ to c/b/media/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/media_stream_infobar_delegate.cc
===================================================================
--- chrome/browser/ui/media_stream_infobar_delegate.cc (revision 194500)
+++ chrome/browser/ui/media_stream_infobar_delegate.cc (working copy)
@@ -1,129 +0,0 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "chrome/browser/ui/media_stream_infobar_delegate.h"
-
-#include "base/logging.h"
-#include "base/utf_string_conversions.h"
-#include "chrome/browser/content_settings/tab_specific_content_settings.h"
-#include "chrome/browser/google/google_util.h"
-#include "chrome/browser/infobars/infobar_service.h"
-#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/url_constants.h"
-#include "content/public/browser/web_contents.h"
-#include "googleurl/src/gurl.h"
-#include "grit/generated_resources.h"
-#include "grit/theme_resources.h"
-#include "ui/base/l10n/l10n_util.h"
-#include "ui/base/resource/resource_bundle.h"
-
-MediaStreamInfoBarDelegate::~MediaStreamInfoBarDelegate() {}
-
-// static
-bool MediaStreamInfoBarDelegate::Create(
- content::WebContents* web_contents,
- const content::MediaStreamRequest& request,
- const content::MediaResponseCallback& callback) {
- Profile* profile =
- Profile::FromBrowserContext(web_contents->GetBrowserContext());
- TabSpecificContentSettings* content_settings =
- TabSpecificContentSettings::FromWebContents(web_contents);
- scoped_ptr<MediaStreamDevicesController> controller(
- new MediaStreamDevicesController(profile, content_settings,
- request, callback));
- if (controller->DismissInfoBarAndTakeActionOnSettings())
- return false;
-
- InfoBarService* infobar_service =
- InfoBarService::FromWebContents(web_contents);
- InfoBarDelegate* old_infobar = NULL;
- for (size_t i = 0; i < infobar_service->GetInfoBarCount(); ++i) {
- old_infobar = infobar_service->GetInfoBarDelegateAt(i)->
- AsMediaStreamInfoBarDelegate();
- if (old_infobar)
- break;
- }
- scoped_ptr<InfoBarDelegate> infobar(
- new MediaStreamInfoBarDelegate(infobar_service, controller.release()));
- if (old_infobar)
- infobar_service->ReplaceInfoBar(old_infobar, infobar.Pass());
- else
- infobar_service->AddInfoBar(infobar.Pass());
-
- return true;
-}
-
-void MediaStreamInfoBarDelegate::InfoBarDismissed() {
- // Deny the request if the infobar was closed with the 'x' button, since
- // we don't want WebRTC to be waiting for an answer that will never come.
- controller_->Deny(false);
-}
-
-gfx::Image* MediaStreamInfoBarDelegate::GetIcon() const {
- return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(
- controller_->has_video() ?
- IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC);
-}
-
-InfoBarDelegate::Type MediaStreamInfoBarDelegate::GetInfoBarType() const {
- return PAGE_ACTION_TYPE;
-}
-
-MediaStreamInfoBarDelegate*
- MediaStreamInfoBarDelegate::AsMediaStreamInfoBarDelegate() {
- return this;
-}
-
-string16 MediaStreamInfoBarDelegate::GetMessageText() const {
- int message_id = IDS_MEDIA_CAPTURE_AUDIO_AND_VIDEO;
- if (!controller_->has_audio())
- message_id = IDS_MEDIA_CAPTURE_VIDEO_ONLY;
- else if (!controller_->has_video())
- message_id = IDS_MEDIA_CAPTURE_AUDIO_ONLY;
- return l10n_util::GetStringFUTF16(
- message_id, UTF8ToUTF16(controller_->GetSecurityOriginSpec()));
-}
-
-string16 MediaStreamInfoBarDelegate::GetButtonLabel(
- InfoBarButton button) const {
- return l10n_util::GetStringUTF16((button == BUTTON_OK) ?
- IDS_MEDIA_CAPTURE_ALLOW : IDS_MEDIA_CAPTURE_DENY);
-}
-
-bool MediaStreamInfoBarDelegate::Accept() {
- controller_->Accept(true);
- return true;
-}
-
-bool MediaStreamInfoBarDelegate::Cancel() {
- controller_->Deny(true);
- return true;
-}
-
-string16 MediaStreamInfoBarDelegate::GetLinkText() const {
- return l10n_util::GetStringUTF16(IDS_LEARN_MORE);
-}
-
-bool MediaStreamInfoBarDelegate::LinkClicked(
- WindowOpenDisposition disposition) {
- content::OpenURLParams params(
- google_util::AppendGoogleLocaleParam(
- GURL(chrome::kMediaAccessLearnMoreUrl)),
- content::Referrer(),
- (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
- content::PAGE_TRANSITION_LINK,
- false);
- owner()->GetWebContents()->OpenURL(params);
-
- return false; // Do not dismiss the info bar.
-}
-
-MediaStreamInfoBarDelegate::MediaStreamInfoBarDelegate(
- InfoBarService* infobar_service,
- MediaStreamDevicesController* controller)
- : ConfirmInfoBarDelegate(infobar_service),
- controller_(controller) {
- DCHECK(controller_.get());
- DCHECK(controller_->has_audio() || controller_->has_video());
-}
« no previous file with comments | « chrome/browser/ui/media_stream_infobar_delegate.h ('k') | chrome/browser/ui/views/external_tab_container_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698