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 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
375 if (!icon) { | 375 if (!icon) { |
376 // We dont't have an icon to attach to. Manually specify the web contents | 376 // We dont't have an icon to attach to. Manually specify the web contents |
377 // window as the parent. | 377 // window as the parent. |
378 bubble_->set_parent_window( | 378 bubble_->set_parent_window( |
379 web_contents->GetView()->GetTopLevelNativeWindow()); | 379 web_contents->GetView()->GetTopLevelNativeWindow()); |
380 } | 380 } |
381 | 381 |
382 views::BubbleDelegateView::CreateBubble(bubble_); | 382 views::BubbleDelegateView::CreateBubble(bubble_); |
383 UpdateLayout(); | 383 UpdateLayout(); |
384 } | 384 } |
385 bubble_->Show(); | 385 bubble_->GetWidget()->Show(); |
386 } | 386 } |
387 | 387 |
388 void SpeechRecognitionBubbleImpl::Hide() { | 388 void SpeechRecognitionBubbleImpl::Hide() { |
389 if (bubble_) | 389 if (bubble_) |
390 bubble_->GetWidget()->Hide(); | 390 bubble_->GetWidget()->Hide(); |
391 } | 391 } |
392 | 392 |
393 void SpeechRecognitionBubbleImpl::UpdateLayout() { | 393 void SpeechRecognitionBubbleImpl::UpdateLayout() { |
394 if (bubble_) | 394 if (bubble_) |
395 bubble_->UpdateLayout(display_mode(), message_text(), icon_image()); | 395 bubble_->UpdateLayout(display_mode(), message_text(), icon_image()); |
396 } | 396 } |
397 | 397 |
398 void SpeechRecognitionBubbleImpl::UpdateImage() { | 398 void SpeechRecognitionBubbleImpl::UpdateImage() { |
399 if (bubble_) | 399 if (bubble_) |
400 bubble_->SetImage(icon_image()); | 400 bubble_->SetImage(icon_image()); |
401 } | 401 } |
402 | 402 |
403 } // namespace | 403 } // namespace |
404 | 404 |
405 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( | 405 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( |
406 WebContents* web_contents, | 406 WebContents* web_contents, |
407 SpeechRecognitionBubble::Delegate* delegate, | 407 SpeechRecognitionBubble::Delegate* delegate, |
408 const gfx::Rect& element_rect) { | 408 const gfx::Rect& element_rect) { |
409 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); | 409 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); |
410 } | 410 } |
OLD | NEW |