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 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() { | 351 SpeechRecognitionBubbleImpl::~SpeechRecognitionBubbleImpl() { |
352 if (bubble_) { | 352 if (bubble_) { |
353 bubble_->set_notify_delegate_on_activation_change(false); | 353 bubble_->set_notify_delegate_on_activation_change(false); |
354 bubble_->GetWidget()->Close(); | 354 bubble_->GetWidget()->Close(); |
355 } | 355 } |
356 } | 356 } |
357 | 357 |
358 void SpeechRecognitionBubbleImpl::Show() { | 358 void SpeechRecognitionBubbleImpl::Show() { |
359 if (!bubble_) { | 359 if (!bubble_) { |
360 // Anchor to the location icon view, in case |element_rect| is offscreen. | 360 // Anchor to the location icon view, in case |element_rect| is offscreen. |
361 Browser* browser = browser::FindBrowserWithWebContents(GetWebContents()); | 361 Browser* browser = chrome::FindBrowserWithWebContents(GetWebContents()); |
362 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 362 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
363 views::View* icon = browser_view->GetLocationBarView() ? | 363 views::View* icon = browser_view->GetLocationBarView() ? |
364 browser_view->GetLocationBarView()->location_icon_view() : NULL; | 364 browser_view->GetLocationBarView()->location_icon_view() : NULL; |
365 bubble_ = new SpeechRecognitionBubbleView(delegate_, icon, element_rect_, | 365 bubble_ = new SpeechRecognitionBubbleView(delegate_, icon, element_rect_, |
366 GetWebContents()); | 366 GetWebContents()); |
367 views::BubbleDelegateView::CreateBubble(bubble_); | 367 views::BubbleDelegateView::CreateBubble(bubble_); |
368 UpdateLayout(); | 368 UpdateLayout(); |
369 } | 369 } |
370 bubble_->Show(); | 370 bubble_->Show(); |
371 } | 371 } |
(...skipping 14 matching lines...) Expand all Loading... |
386 } | 386 } |
387 | 387 |
388 } // namespace | 388 } // namespace |
389 | 389 |
390 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( | 390 SpeechRecognitionBubble* SpeechRecognitionBubble::CreateNativeBubble( |
391 WebContents* web_contents, | 391 WebContents* web_contents, |
392 SpeechRecognitionBubble::Delegate* delegate, | 392 SpeechRecognitionBubble::Delegate* delegate, |
393 const gfx::Rect& element_rect) { | 393 const gfx::Rect& element_rect) { |
394 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); | 394 return new SpeechRecognitionBubbleImpl(web_contents, delegate, element_rect); |
395 } | 395 } |
OLD | NEW |