| OLD | NEW |
| 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" |
| 15 #include "content/browser/tab_contents/tab_contents.h" | 16 #include "content/browser/tab_contents/tab_contents.h" |
| 16 #include "content/browser/tab_contents/tab_contents_view.h" | 17 #include "content/browser/tab_contents/tab_contents_view.h" |
| 17 #include "grit/generated_resources.h" | 18 #include "grit/generated_resources.h" |
| 18 #include "grit/theme_resources.h" | 19 #include "grit/theme_resources.h" |
| 19 #include "media/audio/audio_manager.h" | 20 #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" |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Profile* profile = |
| 212 Profile::FromBrowserContext(tab_contents_->browser_context()); |
| 213 profile->GetResourceContext().audio_manager()->ShowAudioInputSettings(); |
| 211 } | 214 } |
| 212 | 215 |
| 213 gfx::Size SpeechInputBubbleView::GetPreferredSize() { | 216 gfx::Size SpeechInputBubbleView::GetPreferredSize() { |
| 214 int width = heading_->GetPreferredSize().width(); | 217 int width = heading_->GetPreferredSize().width(); |
| 215 int control_width = cancel_->GetPreferredSize().width(); | 218 int control_width = cancel_->GetPreferredSize().width(); |
| 216 if (try_again_->IsVisible()) { | 219 if (try_again_->IsVisible()) { |
| 217 control_width += try_again_->GetPreferredSize().width() + | 220 control_width += try_again_->GetPreferredSize().width() + |
| 218 views::kRelatedButtonHSpacing; | 221 views::kRelatedButtonHSpacing; |
| 219 } | 222 } |
| 220 width = std::max(width, control_width); | 223 width = std::max(width, control_width); |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 373 } |
| 371 | 374 |
| 372 } // namespace | 375 } // namespace |
| 373 | 376 |
| 374 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 377 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
| 375 TabContents* tab_contents, | 378 TabContents* tab_contents, |
| 376 SpeechInputBubble::Delegate* delegate, | 379 SpeechInputBubble::Delegate* delegate, |
| 377 const gfx::Rect& element_rect) { | 380 const gfx::Rect& element_rect) { |
| 378 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); | 381 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); |
| 379 } | 382 } |
| OLD | NEW |