OLD | NEW |
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/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" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 } else if (source == try_again_) { | 214 } else if (source == try_again_) { |
215 delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_TRY_AGAIN); | 215 delegate_->InfoBubbleButtonClicked(SpeechInputBubble::BUTTON_TRY_AGAIN); |
216 } else { | 216 } else { |
217 NOTREACHED() << "Unknown button"; | 217 NOTREACHED() << "Unknown button"; |
218 } | 218 } |
219 } | 219 } |
220 | 220 |
221 void SpeechInputBubbleView::LinkClicked(views::Link* source, int event_flags) { | 221 void SpeechInputBubbleView::LinkClicked(views::Link* source, int event_flags) { |
222 DCHECK_EQ(source, mic_settings_); | 222 DCHECK_EQ(source, mic_settings_); |
223 speech_input::SpeechInputManager::ShowAudioInputSettingsFromUI( | 223 speech_input::SpeechInputManager::ShowAudioInputSettingsFromUI( |
224 &web_contents_->GetBrowserContext()->GetResourceContext()); | 224 web_contents_->GetBrowserContext()->GetResourceContext()); |
225 } | 225 } |
226 | 226 |
227 gfx::Size SpeechInputBubbleView::GetPreferredSize() { | 227 gfx::Size SpeechInputBubbleView::GetPreferredSize() { |
228 int width = heading_->GetPreferredSize().width(); | 228 int width = heading_->GetPreferredSize().width(); |
229 int control_width = cancel_->GetPreferredSize().width(); | 229 int control_width = cancel_->GetPreferredSize().width(); |
230 if (try_again_->visible()) { | 230 if (try_again_->visible()) { |
231 control_width += try_again_->GetPreferredSize().width() + | 231 control_width += try_again_->GetPreferredSize().width() + |
232 views::kRelatedButtonHSpacing; | 232 views::kRelatedButtonHSpacing; |
233 } | 233 } |
234 width = std::max(width, control_width); | 234 width = std::max(width, control_width); |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 380 } |
381 | 381 |
382 } // namespace | 382 } // namespace |
383 | 383 |
384 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 384 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
385 WebContents* web_contents, | 385 WebContents* web_contents, |
386 SpeechInputBubble::Delegate* delegate, | 386 SpeechInputBubble::Delegate* delegate, |
387 const gfx::Rect& element_rect) { | 387 const gfx::Rect& element_rect) { |
388 return new SpeechInputBubbleImpl(web_contents, delegate, element_rect); | 388 return new SpeechInputBubbleImpl(web_contents, delegate, element_rect); |
389 } | 389 } |
OLD | NEW |