| 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/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 359 } | 359 } |
| 360 point.Offset(0, kIconVerticalOffset); | 360 point.Offset(0, kIconVerticalOffset); |
| 361 views::View::ConvertPointToScreen(browser_view->toolbar()->location_bar(), | 361 views::View::ConvertPointToScreen(browser_view->toolbar()->location_bar(), |
| 362 &point); | 362 &point); |
| 363 target_rect = browser_view->toolbar()->location_bar()->bounds(); | 363 target_rect = browser_view->toolbar()->location_bar()->bounds(); |
| 364 target_rect.set_origin(point); | 364 target_rect.set_origin(point); |
| 365 target_rect.set_width(kIconHorizontalOffset); | 365 target_rect.set_width(kIconHorizontalOffset); |
| 366 } | 366 } |
| 367 bubble_ = Bubble::Show(toplevel_widget, | 367 bubble_ = Bubble::Show(toplevel_widget, |
| 368 target_rect, | 368 target_rect, |
| 369 views::BubbleBorder::TOP_LEFT, bubble_content_, | 369 views::BubbleBorder::TOP_LEFT, |
| 370 this); | 370 views::BubbleBorder::ALIGN_ARROW_TO_MID_ANCHOR, |
| 371 bubble_content_, this); |
| 371 // We don't want fade outs when closing because it makes speech recognition | 372 // We don't want fade outs when closing because it makes speech recognition |
| 372 // appear slower than it is. Also setting it to false allows |Close| to | 373 // appear slower than it is. Also setting it to false allows |Close| to |
| 373 // destroy the bubble immediately instead of waiting for the fade animation | 374 // destroy the bubble immediately instead of waiting for the fade animation |
| 374 // to end so the caller can manage this object's life cycle like a normal | 375 // to end so the caller can manage this object's life cycle like a normal |
| 375 // stack based or member variable object. | 376 // stack based or member variable object. |
| 376 bubble_->set_fade_away_on_close(false); | 377 bubble_->set_fade_away_on_close(false); |
| 377 } | 378 } |
| 378 } | 379 } |
| 379 | 380 |
| 380 void SpeechInputBubbleImpl::Hide() { | 381 void SpeechInputBubbleImpl::Hide() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 395 } | 396 } |
| 396 | 397 |
| 397 } // namespace | 398 } // namespace |
| 398 | 399 |
| 399 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 400 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
| 400 TabContents* tab_contents, | 401 TabContents* tab_contents, |
| 401 SpeechInputBubble::Delegate* delegate, | 402 SpeechInputBubble::Delegate* delegate, |
| 402 const gfx::Rect& element_rect) { | 403 const gfx::Rect& element_rect) { |
| 403 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); | 404 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); |
| 404 } | 405 } |
| OLD | NEW |