| 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/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 11 matching lines...) Expand all Loading... |
| 22 #include "ui/views/bubble/bubble_delegate.h" | 22 #include "ui/views/bubble/bubble_delegate.h" |
| 23 #include "ui/views/controls/button/text_button.h" | 23 #include "ui/views/controls/button/text_button.h" |
| 24 #include "ui/views/controls/image_view.h" | 24 #include "ui/views/controls/image_view.h" |
| 25 #include "ui/views/controls/label.h" | 25 #include "ui/views/controls/label.h" |
| 26 #include "ui/views/controls/link.h" | 26 #include "ui/views/controls/link.h" |
| 27 #include "ui/views/controls/link_listener.h" | 27 #include "ui/views/controls/link_listener.h" |
| 28 #include "ui/views/layout/layout_constants.h" | 28 #include "ui/views/layout/layout_constants.h" |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // TODO(msw): Get color from theme/window color. | |
| 33 const SkColor kColor = SK_ColorWHITE; | |
| 34 | |
| 35 const int kBubbleHorizMargin = 6; | 32 const int kBubbleHorizMargin = 6; |
| 36 const int kBubbleVertMargin = 4; | 33 const int kBubbleVertMargin = 4; |
| 37 const int kBubbleHeadingVertMargin = 6; | 34 const int kBubbleHeadingVertMargin = 6; |
| 38 const int kIconHorizontalOffset = 27; | 35 const int kIconHorizontalOffset = 27; |
| 39 const int kIconVerticalOffset = -7; | 36 const int kIconVerticalOffset = -7; |
| 40 | 37 |
| 41 // This is the SpeechInputBubble content and views bubble delegate. | 38 // This is the SpeechInputBubble content and views bubble delegate. |
| 42 class SpeechInputBubbleView | 39 class SpeechInputBubbleView |
| 43 : public views::BubbleDelegateView, | 40 : public views::BubbleDelegateView, |
| 44 public views::ButtonListener, | 41 public views::ButtonListener, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 const int kIconLayoutMinWidth; | 81 const int kIconLayoutMinWidth; |
| 85 | 82 |
| 86 DISALLOW_COPY_AND_ASSIGN(SpeechInputBubbleView); | 83 DISALLOW_COPY_AND_ASSIGN(SpeechInputBubbleView); |
| 87 }; | 84 }; |
| 88 | 85 |
| 89 SpeechInputBubbleView::SpeechInputBubbleView( | 86 SpeechInputBubbleView::SpeechInputBubbleView( |
| 90 SpeechInputBubbleDelegate* delegate, | 87 SpeechInputBubbleDelegate* delegate, |
| 91 views::View* anchor_view, | 88 views::View* anchor_view, |
| 92 const gfx::Rect& element_rect, | 89 const gfx::Rect& element_rect, |
| 93 TabContents* tab_contents) | 90 TabContents* tab_contents) |
| 94 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT, kColor), | 91 : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), |
| 95 delegate_(delegate), | 92 delegate_(delegate), |
| 96 element_rect_(element_rect), | 93 element_rect_(element_rect), |
| 97 tab_contents_(tab_contents), | 94 tab_contents_(tab_contents), |
| 98 display_mode_(SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP), | 95 display_mode_(SpeechInputBubbleBase::DISPLAY_MODE_WARM_UP), |
| 99 kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetBitmapNamed( | 96 kIconLayoutMinWidth(ResourceBundle::GetSharedInstance().GetBitmapNamed( |
| 100 IDR_SPEECH_INPUT_MIC_EMPTY)->width()) { | 97 IDR_SPEECH_INPUT_MIC_EMPTY)->width()) { |
| 101 // The bubble lifetime is managed by its controller; closing on escape or | 98 // The bubble lifetime is managed by its controller; closing on escape or |
| 102 // explicitly closing on deactivation will cause unexpected behavior. | 99 // explicitly closing on deactivation will cause unexpected behavior. |
| 103 set_close_on_esc(false); | 100 set_close_on_esc(false); |
| 104 set_close_on_deactivate(false); | 101 set_close_on_deactivate(false); |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 } | 367 } |
| 371 | 368 |
| 372 } // namespace | 369 } // namespace |
| 373 | 370 |
| 374 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( | 371 SpeechInputBubble* SpeechInputBubble::CreateNativeBubble( |
| 375 TabContents* tab_contents, | 372 TabContents* tab_contents, |
| 376 SpeechInputBubble::Delegate* delegate, | 373 SpeechInputBubble::Delegate* delegate, |
| 377 const gfx::Rect& element_rect) { | 374 const gfx::Rect& element_rect) { |
| 378 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); | 375 return new SpeechInputBubbleImpl(tab_contents, delegate, element_rect); |
| 379 } | 376 } |
| OLD | NEW |