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

Side by Side Diff: chrome/browser/media/media_stream_infobar_delegate.cc

Issue 15067008: [InfoBar] Add InfoBarDelegate::GetIconID() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit fixes redux Created 7 years, 7 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 unified diff | Download patch
OLDNEW
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/media_stream_infobar_delegate.h" 5 #include "chrome/browser/media/media_stream_infobar_delegate.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/google/google_util.h" 9 #include "chrome/browser/google/google_util.h"
10 #include "chrome/browser/infobars/infobar_service.h" 10 #include "chrome/browser/infobars/infobar_service.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "content/public/browser/web_contents.h" 12 #include "content/public/browser/web_contents.h"
13 #include "googleurl/src/gurl.h" 13 #include "googleurl/src/gurl.h"
14 #include "grit/generated_resources.h" 14 #include "grit/generated_resources.h"
15 #include "grit/theme_resources.h" 15 #include "grit/theme_resources.h"
16 #include "ui/base/l10n/l10n_util.h" 16 #include "ui/base/l10n/l10n_util.h"
17 #include "ui/base/resource/resource_bundle.h"
18 17
19 MediaStreamInfoBarDelegate::~MediaStreamInfoBarDelegate() {} 18 MediaStreamInfoBarDelegate::~MediaStreamInfoBarDelegate() {}
20 19
21 // static 20 // static
22 bool MediaStreamInfoBarDelegate::Create( 21 bool MediaStreamInfoBarDelegate::Create(
23 content::WebContents* web_contents, 22 content::WebContents* web_contents,
24 const content::MediaStreamRequest& request, 23 const content::MediaStreamRequest& request,
25 const content::MediaResponseCallback& callback) { 24 const content::MediaResponseCallback& callback) {
26 scoped_ptr<MediaStreamDevicesController> controller( 25 scoped_ptr<MediaStreamDevicesController> controller(
27 new MediaStreamDevicesController(web_contents, request, callback)); 26 new MediaStreamDevicesController(web_contents, request, callback));
(...skipping 27 matching lines...) Expand all
55 DCHECK(controller_.get()); 54 DCHECK(controller_.get());
56 DCHECK(controller_->has_audio() || controller_->has_video()); 55 DCHECK(controller_->has_audio() || controller_->has_video());
57 } 56 }
58 57
59 void MediaStreamInfoBarDelegate::InfoBarDismissed() { 58 void MediaStreamInfoBarDelegate::InfoBarDismissed() {
60 // Deny the request if the infobar was closed with the 'x' button, since 59 // Deny the request if the infobar was closed with the 'x' button, since
61 // we don't want WebRTC to be waiting for an answer that will never come. 60 // we don't want WebRTC to be waiting for an answer that will never come.
62 controller_->Deny(false); 61 controller_->Deny(false);
63 } 62 }
64 63
65 gfx::Image* MediaStreamInfoBarDelegate::GetIcon() const { 64 int MediaStreamInfoBarDelegate::GetIconID() const {
66 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed( 65 return controller_->has_video() ?
67 controller_->has_video() ? 66 IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC;
68 IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC);
69 } 67 }
70 68
71 InfoBarDelegate::Type MediaStreamInfoBarDelegate::GetInfoBarType() const { 69 InfoBarDelegate::Type MediaStreamInfoBarDelegate::GetInfoBarType() const {
72 return PAGE_ACTION_TYPE; 70 return PAGE_ACTION_TYPE;
73 } 71 }
74 72
75 MediaStreamInfoBarDelegate* 73 MediaStreamInfoBarDelegate*
76 MediaStreamInfoBarDelegate::AsMediaStreamInfoBarDelegate() { 74 MediaStreamInfoBarDelegate::AsMediaStreamInfoBarDelegate() {
77 return this; 75 return this;
78 } 76 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 google_util::AppendGoogleLocaleParam( 111 google_util::AppendGoogleLocaleParam(
114 GURL(chrome::kMediaAccessLearnMoreUrl)), 112 GURL(chrome::kMediaAccessLearnMoreUrl)),
115 content::Referrer(), 113 content::Referrer(),
116 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition, 114 (disposition == CURRENT_TAB) ? NEW_FOREGROUND_TAB : disposition,
117 content::PAGE_TRANSITION_LINK, 115 content::PAGE_TRANSITION_LINK,
118 false); 116 false);
119 web_contents()->OpenURL(params); 117 web_contents()->OpenURL(params);
120 118
121 return false; // Do not dismiss the info bar. 119 return false; // Do not dismiss the info bar.
122 } 120 }
OLDNEW
« no previous file with comments | « chrome/browser/media/media_stream_infobar_delegate.h ('k') | chrome/browser/notifications/desktop_notification_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698