| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/app_list/views/speech_view.h" | 5 #include "ui/app_list/views/speech_view.h" |
| 6 | 6 |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "grit/ui_resources.h" | 8 #include "grit/ui_resources.h" |
| 9 #include "grit/ui_strings.h" | 9 #include "grit/ui_strings.h" |
| 10 #include "ui/app_list/app_list_model.h" | 10 #include "ui/app_list/app_list_model.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 // MicButton is an image button with circular hit area. | 70 // MicButton is an image button with circular hit area. |
| 71 class MicButton : public views::ImageButton { | 71 class MicButton : public views::ImageButton { |
| 72 public: | 72 public: |
| 73 explicit MicButton(views::ButtonListener* listener); | 73 explicit MicButton(views::ButtonListener* listener); |
| 74 virtual ~MicButton(); | 74 virtual ~MicButton(); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 // Overridden from views::View: | 77 // Overridden from views::View: |
| 78 virtual bool HitTestRect(const gfx::Rect& rect) const OVERRIDE; | 78 virtual bool HitTestRect(const gfx::RectF& rect) const OVERRIDE; |
| 79 | 79 |
| 80 DISALLOW_COPY_AND_ASSIGN(MicButton); | 80 DISALLOW_COPY_AND_ASSIGN(MicButton); |
| 81 }; | 81 }; |
| 82 | 82 |
| 83 MicButton::MicButton(views::ButtonListener* listener) | 83 MicButton::MicButton(views::ButtonListener* listener) |
| 84 : views::ImageButton(listener) {} | 84 : views::ImageButton(listener) {} |
| 85 | 85 |
| 86 MicButton::~MicButton() {} | 86 MicButton::~MicButton() {} |
| 87 | 87 |
| 88 bool MicButton::HitTestRect(const gfx::Rect& rect) const { | 88 bool MicButton::HitTestRect(const gfx::RectF& rect) const { |
| 89 if (!views::ImageButton::HitTestRect(rect)) | 89 if (!views::ImageButton::HitTestRect(rect)) |
| 90 return false; | 90 return false; |
| 91 | 91 |
| 92 gfx::Rect local_bounds = GetLocalBounds(); | 92 gfx::Rect local_bounds = GetLocalBounds(); |
| 93 int radius = local_bounds.width() / 2; | 93 int radius = local_bounds.width() / 2; |
| 94 return (rect.origin() - local_bounds.CenterPoint()).LengthSquared() < | 94 return (rect.origin() - local_bounds.CenterPoint()).LengthSquared() < |
| 95 radius * radius; | 95 radius * radius; |
| 96 } | 96 } |
| 97 | 97 |
| 98 } // namespace | 98 } // namespace |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 resource_id = IDR_APP_LIST_SPEECH_MIC_ON; | 229 resource_id = IDR_APP_LIST_SPEECH_MIC_ON; |
| 230 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH) | 230 else if (new_state == SPEECH_RECOGNITION_IN_SPEECH) |
| 231 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING; | 231 resource_id = IDR_APP_LIST_SPEECH_MIC_RECORDING; |
| 232 | 232 |
| 233 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); | 233 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); |
| 234 mic_button_->SetImage(views::Button::STATE_NORMAL, | 234 mic_button_->SetImage(views::Button::STATE_NORMAL, |
| 235 bundle.GetImageSkiaNamed(resource_id)); | 235 bundle.GetImageSkiaNamed(resource_id)); |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace app_list | 238 } // namespace app_list |
| OLD | NEW |