| 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_recognition_bubble.h" | 5 #include "chrome/browser/speech/speech_recognition_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 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 } else if (source == try_again_) { | 221 } else if (source == try_again_) { |
| 222 delegate_->InfoBubbleButtonClicked( | 222 delegate_->InfoBubbleButtonClicked( |
| 223 SpeechRecognitionBubble::BUTTON_TRY_AGAIN); | 223 SpeechRecognitionBubble::BUTTON_TRY_AGAIN); |
| 224 } else { | 224 } else { |
| 225 NOTREACHED() << "Unknown button"; | 225 NOTREACHED() << "Unknown button"; |
| 226 } | 226 } |
| 227 } | 227 } |
| 228 | 228 |
| 229 void SpeechRecognitionBubbleView::LinkClicked(views::Link* source, | 229 void SpeechRecognitionBubbleView::LinkClicked(views::Link* source, |
| 230 int event_flags) { | 230 int event_flags) { |
| 231 DCHECK_EQ(source, mic_settings_); | 231 DCHECK_EQ(mic_settings_, source); |
| 232 content::SpeechRecognitionManager::GetInstance()->ShowAudioInputSettings(); | 232 content::SpeechRecognitionManager::GetInstance()->ShowAudioInputSettings(); |
| 233 } | 233 } |
| 234 | 234 |
| 235 gfx::Size SpeechRecognitionBubbleView::GetPreferredSize() { | 235 gfx::Size SpeechRecognitionBubbleView::GetPreferredSize() { |
| 236 int width = heading_->GetPreferredSize().width(); | 236 int width = heading_->GetPreferredSize().width(); |
| 237 int control_width = cancel_->GetPreferredSize().width(); | 237 int control_width = cancel_->GetPreferredSize().width(); |
| 238 if (try_again_->visible()) { | 238 if (try_again_->visible()) { |
| 239 control_width += try_again_->GetPreferredSize().width() + | 239 control_width += try_again_->GetPreferredSize().width() + |
| 240 views::kRelatedButtonHSpacing; | 240 views::kRelatedButtonHSpacing; |
| 241 } | 241 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 } | 387 } |
| 388 | 388 |
| 389 } // namespace | 389 } // namespace |
| 390 | 390 |
| 391 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( | 391 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( |
| 392 WebContents* web_contents, | 392 WebContents* web_contents, |
| 393 SpeechRecognitionBubble::Delegate* delegate, | 393 SpeechRecognitionBubble::Delegate* delegate, |
| 394 const gfx::Rect& element_rect) { | 394 const gfx::Rect& element_rect) { |
| 395 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); | 395 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); |
| 396 } | 396 } |
| OLD | NEW |