Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: ui/app_list/views/speech_view.cc

Issue 722563002: Add a card background to the app list search result groups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tilv
Patch Set: use constants in speech_view.cc Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/app_list/views/search_result_view.cc ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "third_party/skia/include/core/SkPath.h" 8 #include "third_party/skia/include/core/SkPath.h"
9 #include "ui/app_list/app_list_constants.h"
9 #include "ui/app_list/app_list_model.h" 10 #include "ui/app_list/app_list_model.h"
10 #include "ui/app_list/app_list_view_delegate.h" 11 #include "ui/app_list/app_list_view_delegate.h"
11 #include "ui/app_list/speech_ui_model.h" 12 #include "ui/app_list/speech_ui_model.h"
12 #include "ui/base/l10n/l10n_util.h" 13 #include "ui/base/l10n/l10n_util.h"
13 #include "ui/base/resource/resource_bundle.h" 14 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/gfx/canvas.h" 15 #include "ui/gfx/canvas.h"
15 #include "ui/gfx/path.h" 16 #include "ui/gfx/path.h"
16 #include "ui/resources/grit/ui_resources.h" 17 #include "ui/resources/grit/ui_resources.h"
17 #include "ui/strings/grit/ui_strings.h" 18 #include "ui/strings/grit/ui_strings.h"
18 #include "ui/views/animation/bounds_animator.h" 19 #include "ui/views/animation/bounds_animator.h"
19 #include "ui/views/background.h" 20 #include "ui/views/background.h"
20 #include "ui/views/controls/button/image_button.h" 21 #include "ui/views/controls/button/image_button.h"
21 #include "ui/views/controls/image_view.h" 22 #include "ui/views/controls/image_view.h"
22 #include "ui/views/controls/label.h" 23 #include "ui/views/controls/label.h"
23 #include "ui/views/layout/fill_layout.h" 24 #include "ui/views/layout/fill_layout.h"
24 #include "ui/views/masked_targeter_delegate.h" 25 #include "ui/views/masked_targeter_delegate.h"
25 #include "ui/views/shadow_border.h" 26 #include "ui/views/shadow_border.h"
26 27
27 namespace app_list { 28 namespace app_list {
28 29
29 namespace { 30 namespace {
30 31
31 const int kShadowOffset = 1;
32 const int kShadowBlur = 4;
33 const int kSpeechViewMaxHeight = 300; 32 const int kSpeechViewMaxHeight = 300;
34 const int kMicButtonMargin = 12; 33 const int kMicButtonMargin = 12;
35 const int kTextMargin = 32; 34 const int kTextMargin = 32;
36 const int kLogoMarginLeft = 30; 35 const int kLogoMarginLeft = 30;
37 const int kLogoMarginTop = 28; 36 const int kLogoMarginTop = 28;
38 const int kLogoWidth = 104; 37 const int kLogoWidth = 104;
39 const int kLogoHeight = 36; 38 const int kLogoHeight = 36;
40 const int kIndicatorCenterOffsetY = -1; 39 const int kIndicatorCenterOffsetY = -1;
41 const int kIndicatorRadiusMinOffset = -3; 40 const int kIndicatorRadiusMinOffset = -3;
42 const int kIndicatorRadiusMax = 100; 41 const int kIndicatorRadiusMax = 100;
43 const int kIndicatorAnimationDuration = 100; 42 const int kIndicatorAnimationDuration = 100;
44 const SkColor kShadowColor = SkColorSetARGB(0.3 * 255, 0, 0, 0);
45 const SkColor kHintTextColor = SkColorSetRGB(119, 119, 119); 43 const SkColor kHintTextColor = SkColorSetRGB(119, 119, 119);
46 const SkColor kResultTextColor = SkColorSetRGB(178, 178, 178); 44 const SkColor kResultTextColor = SkColorSetRGB(178, 178, 178);
47 const SkColor kSoundLevelIndicatorColor = SkColorSetRGB(219, 219, 219); 45 const SkColor kSoundLevelIndicatorColor = SkColorSetRGB(219, 219, 219);
48 46
49 class SoundLevelIndicator : public views::View { 47 class SoundLevelIndicator : public views::View {
50 public: 48 public:
51 SoundLevelIndicator(); 49 SoundLevelIndicator();
52 ~SoundLevelIndicator() override; 50 ~SoundLevelIndicator() override;
53 51
54 private: 52 private:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 } 102 }
105 103
106 } // namespace 104 } // namespace
107 105
108 // static 106 // static
109 107
110 SpeechView::SpeechView(AppListViewDelegate* delegate) 108 SpeechView::SpeechView(AppListViewDelegate* delegate)
111 : delegate_(delegate), 109 : delegate_(delegate),
112 logo_(NULL) { 110 logo_(NULL) {
113 SetBorder(scoped_ptr<views::Border>( 111 SetBorder(scoped_ptr<views::Border>(
114 new views::ShadowBorder(kShadowBlur, 112 new views::ShadowBorder(kCardShadowBlur, kCardShadowColor,
115 kShadowColor, 113 kCardShadowYOffset, // Vertical offset.
116 kShadowOffset, // Vertical offset.
117 0))); 114 0)));
118 115
119 // To keep the painting order of the border and the background, this class 116 // To keep the painting order of the border and the background, this class
120 // actually has a single child of 'container' which has white background and 117 // actually has a single child of 'container' which has white background and
121 // contains all components. 118 // contains all components.
122 views::View* container = new views::View(); 119 views::View* container = new views::View();
123 container->set_background( 120 container->set_background(
124 views::Background::CreateSolidBackground(SK_ColorWHITE)); 121 views::Background::CreateSolidBackground(SK_ColorWHITE));
125 122
126 const gfx::ImageSkia& logo_image = delegate_->GetSpeechUI()->logo(); 123 const gfx::ImageSkia& logo_image = delegate_->GetSpeechUI()->logo();
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 } 242 }
246 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id)); 243 speech_result_->SetText(l10n_util::GetStringUTF16(text_resource_id));
247 speech_result_->SetEnabledColor(kHintTextColor); 244 speech_result_->SetEnabledColor(kHintTextColor);
248 245
249 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); 246 ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
250 mic_button_->SetImage(views::Button::STATE_NORMAL, 247 mic_button_->SetImage(views::Button::STATE_NORMAL,
251 bundle.GetImageSkiaNamed(resource_id)); 248 bundle.GetImageSkiaNamed(resource_id));
252 } 249 }
253 250
254 } // namespace app_list 251 } // namespace app_list
OLDNEW
« no previous file with comments | « ui/app_list/views/search_result_view.cc ('k') | ui/app_list/views/start_page_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698