diff options
author | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 10:13:43 +0000 |
---|---|---|
committer | mukai@chromium.org <mukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-02-06 10:13:43 +0000 |
commit | 7c7a517bcf66778a0fee4e53194541207385fc8e (patch) | |
tree | 561958b27a93131bb84e1a16da71b0563396d8e1 /ui/app_list | |
parent | 0136658c65a42d5885af26e4ae427bf001cc4259 (diff) | |
download | chromium_src-7c7a517bcf66778a0fee4e53194541207385fc8e.zip chromium_src-7c7a517bcf66778a0fee4e53194541207385fc8e.tar.gz chromium_src-7c7a517bcf66778a0fee4e53194541207385fc8e.tar.bz2 |
Loads the logo image to the speech UI in app-list.
BUG=313904
R=xiyuan@chromium.org, oshima@chromium.org
TEST=manually
Review URL: https://codereview.chromium.org/146643004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@249328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/app_list')
-rw-r--r-- | ui/app_list/speech_ui_model.h | 6 | ||||
-rw-r--r-- | ui/app_list/views/speech_view.cc | 19 | ||||
-rw-r--r-- | ui/app_list/views/speech_view.h | 2 |
3 files changed, 24 insertions, 3 deletions
diff --git a/ui/app_list/speech_ui_model.h b/ui/app_list/speech_ui_model.h index e5a9a7a..c89c4ba 100644 --- a/ui/app_list/speech_ui_model.h +++ b/ui/app_list/speech_ui_model.h @@ -10,6 +10,7 @@ #include "base/strings/string16.h" #include "ui/app_list/app_list_export.h" #include "ui/app_list/speech_ui_model_observer.h" +#include "ui/gfx/image/image_skia.h" namespace app_list { @@ -30,6 +31,8 @@ class APP_LIST_EXPORT SpeechUIModel { bool is_final() const { return is_final_; } int16 sound_level() const { return sound_level_; } SpeechRecognitionState state() const { return state_; } + const gfx::ImageSkia& logo() const { return logo_; } + void set_logo(const gfx::ImageSkia& logo) { logo_ = logo; } private: base::string16 result_; @@ -37,6 +40,9 @@ class APP_LIST_EXPORT SpeechUIModel { int16 sound_level_; SpeechRecognitionState state_; + // The logo image which the speech UI will show at the top-left. + gfx::ImageSkia logo_; + // The sound level range to compute visible sound-level. int16 minimum_sound_level_; int16 maximum_sound_level_; diff --git a/ui/app_list/views/speech_view.cc b/ui/app_list/views/speech_view.cc index 00d24aa3..85398e5 100644 --- a/ui/app_list/views/speech_view.cc +++ b/ui/app_list/views/speech_view.cc @@ -16,6 +16,7 @@ #include "ui/views/animation/bounds_animator.h" #include "ui/views/background.h" #include "ui/views/controls/button/image_button.h" +#include "ui/views/controls/image_view.h" #include "ui/views/controls/label.h" #include "ui/views/layout/fill_layout.h" #include "ui/views/shadow_border.h" @@ -29,6 +30,10 @@ const int kShadowBlur = 4; const int kSpeechViewMaxHeight = 300; const int kMicButtonMargin = 12; const int kTextMargin = 32; +const int kLogoMarginLeft = 30; +const int kLogoMarginTop = 28; +const int kLogoWidth = 104; +const int kLogoHeight = 36; const int kIndicatorRadiusMax = 100; const int kIndicatorAnimationDuration = 100; const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0); @@ -92,7 +97,8 @@ bool MicButton::HitTestRect(const gfx::Rect& rect) const { // static SpeechView::SpeechView(AppListViewDelegate* delegate) - : delegate_(delegate) { + : delegate_(delegate), + logo_(NULL) { SetBorder(scoped_ptr<views::Border>( new views::ShadowBorder(kShadowBlur, kShadowColor, @@ -106,7 +112,13 @@ SpeechView::SpeechView(AppListViewDelegate* delegate) container->set_background( views::Background::CreateSolidBackground(SK_ColorWHITE)); - // TODO(mukai): add Google logo. + const gfx::ImageSkia& logo_image = delegate_->GetSpeechUI()->logo(); + if (!logo_image.isNull()) { + logo_ = new views::ImageView(); + logo_->SetImage(&logo_image); + container->AddChildView(logo_); + } + indicator_ = new SoundLevelIndicator(); indicator_->SetVisible(false); container->AddChildView(indicator_); @@ -157,8 +169,9 @@ void SpeechView::Layout() { container->SetBoundsRect(GetContentsBounds()); // Because container is a pure View, this class should layout its children. - // TODO(mukai): arrange Google logo. const gfx::Rect contents_bounds = container->GetContentsBounds(); + if (logo_) + logo_->SetBounds(kLogoMarginLeft, kLogoMarginTop, kLogoWidth, kLogoHeight); gfx::Size mic_size = mic_button_->GetPreferredSize(); gfx::Point mic_origin( contents_bounds.right() - kMicButtonMargin - mic_size.width(), diff --git a/ui/app_list/views/speech_view.h b/ui/app_list/views/speech_view.h index 9817282..dc775dc 100644 --- a/ui/app_list/views/speech_view.h +++ b/ui/app_list/views/speech_view.h @@ -12,6 +12,7 @@ namespace views { class BoundsAnimator; class ImageButton; +class ImageView; class Label; } @@ -51,6 +52,7 @@ class SpeechView : public views::View, AppListViewDelegate* delegate_; + views::ImageView* logo_; views::View* indicator_; views::ImageButton* mic_button_; views::Label* speech_result_; |