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

Side by Side Diff: chrome/browser/speech/speech_input_bubble_views.cc

Issue 8818012: Remove the AudioManager singleton. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Addressing comments from Andrew Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/speech/speech_input_bubble.h" 5 #include "chrome/browser/speech/speech_input_bubble.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/views/frame/browser_view.h" 11 #include "chrome/browser/ui/views/frame/browser_view.h"
12 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 12 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
13 #include "chrome/browser/ui/views/toolbar_view.h" 13 #include "chrome/browser/ui/views/toolbar_view.h"
14 #include "chrome/browser/ui/views/window.h" 14 #include "chrome/browser/ui/views/window.h"
15 #include "content/browser/resource_context.h"
16 #include "content/browser/speech/speech_input_manager.h"
15 #include "content/browser/tab_contents/tab_contents.h" 17 #include "content/browser/tab_contents/tab_contents.h"
16 #include "content/browser/tab_contents/tab_contents_view.h" 18 #include "content/browser/tab_contents/tab_contents_view.h"
17 #include "grit/generated_resources.h" 19 #include "grit/generated_resources.h"
18 #include "grit/theme_resources.h" 20 #include "grit/theme_resources.h"
19 #include "media/audio/audio_manager.h"
20 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
22 #include "ui/views/bubble/bubble_delegate.h" 23 #include "ui/views/bubble/bubble_delegate.h"
23 #include "ui/views/controls/button/text_button.h" 24 #include "ui/views/controls/button/text_button.h"
24 #include "ui/views/controls/image_view.h" 25 #include "ui/views/controls/image_view.h"
25 #include "ui/views/controls/label.h" 26 #include "ui/views/controls/label.h"
26 #include "ui/views/controls/link.h" 27 #include "ui/views/controls/link.h"
27 #include "ui/views/controls/link_listener.h" 28 #include "ui/views/controls/link_listener.h"
28 #include "ui/views/layout/layout_constants.h" 29 #include "ui/views/layout/layout_constants.h"
29 30
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_CANCEL); 201 delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_CANCEL);
201 } else if (source == try_again_) { 202 } else if (source == try_again_) {
202 delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_TRY_AGAIN); 203 delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_TRY_AGAIN);
203 } else { 204 } else {
204 NOTREACHED() << "Unknown button"; 205 NOTREACHED() << "Unknown button";
205 } 206 }
206 } 207 }
207 208
208 void SpeechInputBubbleView::LinkClicked(views::Link* source, int event_flags) { 209 void SpeechInputBubbleView::LinkClicked(views::Link* source, int event_flags) {
209 DCHECK_EQ(source, mic_settings_); 210 DCHECK_EQ(source, mic_settings_);
210 AudioManager::GetAudioManager()->ShowAudioInputSettings(); 211 speech_input::SpeechInputManager::ShowAudioInputSettingsFromUI(
212 &tab_contents_->browser_context()->GetResourceContext());
211 } 213 }
212 214
213 gfx::Size SpeechInputBubbleView::GetPreferredSize() { 215 gfx::Size SpeechInputBubbleView::GetPreferredSize() {
214 int width = heading_->GetPreferredSize().width(); 216 int width = heading_->GetPreferredSize().width();
215 int control_width = cancel_->GetPreferredSize().width(); 217 int control_width = cancel_->GetPreferredSize().width();
216 if (try_again_->IsVisible()) { 218 if (try_again_->IsVisible()) {
217 control_width += try_again_->GetPreferredSize().width() + 219 control_width += try_again_->GetPreferredSize().width() +
218 views::kRelatedButtonHSpacing; 220 views::kRelatedButtonHSpacing;
219 } 221 }
220 width = std::max(width, control_width); 222 width = std::max(width, control_width);
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 } 372 }
371 373
372 } // namespace 374 } // namespace
373 375
374 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( 376 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble(
375 TabContents* tab_contents, 377 TabContents* tab_contents,
376 SpeechInputBubble::Delegate* delegate, 378 SpeechInputBubble::Delegate* delegate,
377 const gfx::Rect& element_rect) { 379 const gfx::Rect& element_rect) {
378 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); 380 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect);
379 } 381 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698