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

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

Issue 9570012: Implement Linux Media Stream Infobar (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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 <algorithm> 5 #include <algorithm>
6 #include <functional> 6 #include <functional>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "chrome/browser/ui/media_stream_infobar_delegate.h" 9 #include "chrome/browser/ui/media_stream_infobar_delegate.h"
10 #include "chrome/browser/ui/gtk/infobars/media_stream_infobar_gtk.h"
macourteau 2012/03/01 14:06:23 Please don't include GTK headers here (see comment
10 #include "content/public/common/media_stream_request.h" 11 #include "content/public/common/media_stream_request.h"
11 #include "grit/theme_resources_standard.h" 12 #include "grit/theme_resources_standard.h"
12 #include "ui/base/resource/resource_bundle.h" 13 #include "ui/base/resource/resource_bundle.h"
13 14
14 namespace { 15 namespace {
15 16
16 // A predicate that checks if a StreamDeviceInfo object has the same ID as the 17 // A predicate that checks if a StreamDeviceInfo object has the same ID as the
17 // device ID specified at construction. 18 // device ID specified at construction.
18 class DeviceIdEquals { 19 class DeviceIdEquals {
19 public: 20 public:
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 content::MediaStreamDevices::const_iterator it = std::find_if( 104 content::MediaStreamDevices::const_iterator it = std::find_if(
104 device_it->second.begin(), device_it->second.end(), DeviceIdEquals(id)); 105 device_it->second.begin(), device_it->second.end(), DeviceIdEquals(id));
105 if (it != device_it->second.end()) 106 if (it != device_it->second.end())
106 devices->push_back(*it); 107 devices->push_back(*it);
107 } 108 }
108 } 109 }
109 110
110 // MediaStreamInfoBarDelegate::CreateInfoBar is implemented in platform-specific 111 // MediaStreamInfoBarDelegate::CreateInfoBar is implemented in platform-specific
111 // files. 112 // files.
112 113
113 #if !defined(TOOLKIT_VIEWS) 114 #if !defined(TOOLKIT_VIEWS)
macourteau 2012/03/01 14:06:23 Please change this to: #if !defined(TOOLKIT_VIEWS)
114 // TODO(macourteau): This section is temporary, until the InfoBar is implemented 115 // TODO(macourteau): This section is temporary, until the InfoBar is implemented
115 // on other platforms, to make sure everything compiles and links. 116 // on other platforms, to make sure everything compiles and links.
116 InfoBar* MediaStreamInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) { 117 InfoBar* MediaStreamInfoBarDelegate::CreateInfoBar(InfoBarTabHelper* owner) {
117 DCHECK(owner); 118 DCHECK(owner);
119 #if defined(OS_LINUX)
macourteau 2012/03/01 14:06:23 Please remove this chunk of code (see my comment a
120 MediaStreamInfoBarGtk* infobar_gtk = new MediaStreamInfoBarGtk(owner, this);
121 return infobar_gtk;
122 #endif // OS_LINUX
118 return NULL; 123 return NULL;
119 } 124 }
120 #endif // !TOOLKIT_VIEWS 125 #endif // !TOOLKIT_VIEWS
121 126
122 void MediaStreamInfoBarDelegate::InfoBarDismissed() { 127 void MediaStreamInfoBarDelegate::InfoBarDismissed() {
123 // Deny the request if the infobar was closed with the 'x' button, since 128 // Deny the request if the infobar was closed with the 'x' button, since
124 // we don't want WebRTC to be waiting for an answer that will never come. 129 // we don't want WebRTC to be waiting for an answer that will never come.
125 Deny(); 130 Deny();
126 } 131 }
127 132
128 gfx::Image* MediaStreamInfoBarDelegate::GetIcon() const { 133 gfx::Image* MediaStreamInfoBarDelegate::GetIcon() const {
129 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(has_video_ ? 134 return &ResourceBundle::GetSharedInstance().GetNativeImageNamed(has_video_ ?
130 IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC); 135 IDR_INFOBAR_MEDIA_STREAM_CAMERA : IDR_INFOBAR_MEDIA_STREAM_MIC);
131 } 136 }
132 137
133 InfoBarDelegate::Type MediaStreamInfoBarDelegate::GetInfoBarType() const { 138 InfoBarDelegate::Type MediaStreamInfoBarDelegate::GetInfoBarType() const {
134 return PAGE_ACTION_TYPE; 139 return PAGE_ACTION_TYPE;
135 } 140 }
136 141
137 MediaStreamInfoBarDelegate* 142 MediaStreamInfoBarDelegate*
138 MediaStreamInfoBarDelegate::AsMediaStreamInfobarDelegate() { 143 MediaStreamInfoBarDelegate::AsMediaStreamInfobarDelegate() {
139 return this; 144 return this;
140 } 145 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698