| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/search_box_view.h" | 5 #include "ui/app_list/views/search_box_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "ui/app_list/app_list_model.h" | 9 #include "ui/app_list/app_list_model.h" |
| 10 #include "ui/app_list/app_list_switches.h" | 10 #include "ui/app_list/app_list_switches.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); | 38 const SkColor kHintTextColor = SkColorSetRGB(0xA0, 0xA0, 0xA0); |
| 39 | 39 |
| 40 // Menu offset relative to the bottom-right corner of the menu button. | 40 // Menu offset relative to the bottom-right corner of the menu button. |
| 41 const int kMenuYOffsetFromButton = -4; | 41 const int kMenuYOffsetFromButton = -4; |
| 42 const int kMenuXOffsetFromButton = -7; | 42 const int kMenuXOffsetFromButton = -7; |
| 43 | 43 |
| 44 // Experimental app list constants. | 44 // Experimental app list constants. |
| 45 const int kExperimentalSearchBoxHeight = 37; | 45 const int kExperimentalSearchBoxHeight = 37; |
| 46 | 46 |
| 47 const int kBackgroundBorderWidth = 1; | 47 const int kBackgroundBorderWidth = 1; |
| 48 const int kBackgroundBorderBottomWidth = 2; | 48 const int kBackgroundBorderBottomWidth = 1; |
| 49 const int kBackgroundBorderCornerRadius = 2; | 49 const int kBackgroundBorderCornerRadius = 2; |
| 50 const SkColor kBackgroundBorderColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); | 50 const SkColor kBackgroundBorderColor = SkColorSetRGB(0xEE, 0xEE, 0xEE); |
| 51 const SkColor kBackgroundBorderBottomColor = SkColorSetRGB(0xCC, 0xCC, 0xCC); |
| 51 | 52 |
| 52 // A background that paints a solid white rounded rect with a thin grey border. | 53 // A background that paints a solid white rounded rect with a thin grey border. |
| 53 class SearchBoxBackground : public views::Background { | 54 class SearchBoxBackground : public views::Background { |
| 54 public: | 55 public: |
| 55 SearchBoxBackground() {} | 56 SearchBoxBackground() {} |
| 56 virtual ~SearchBoxBackground() {} | 57 virtual ~SearchBoxBackground() {} |
| 57 | 58 |
| 58 private: | 59 private: |
| 59 // views::Background overrides: | 60 // views::Background overrides: |
| 60 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { | 61 virtual void Paint(gfx::Canvas* canvas, views::View* view) const OVERRIDE { |
| 61 gfx::Rect bounds = view->GetContentsBounds(); | 62 gfx::Rect bounds = view->GetContentsBounds(); |
| 62 | 63 |
| 63 SkPaint paint; | 64 SkPaint paint; |
| 64 paint.setFlags(SkPaint::kAntiAlias_Flag); | 65 paint.setFlags(SkPaint::kAntiAlias_Flag); |
| 65 paint.setColor(kBackgroundBorderColor); | 66 paint.setColor(kBackgroundBorderColor); |
| 66 canvas->DrawRoundRect(bounds, kBackgroundBorderCornerRadius, paint); | 67 canvas->DrawRoundRect(bounds, kBackgroundBorderCornerRadius, paint); |
| 67 bounds.Inset(kBackgroundBorderWidth, | 68 bounds.Inset(kBackgroundBorderWidth, |
| 68 kBackgroundBorderWidth, | 69 kBackgroundBorderWidth, |
| 69 kBackgroundBorderWidth, | 70 kBackgroundBorderWidth, |
| 70 kBackgroundBorderBottomWidth); | 71 0); |
| 72 paint.setColor(kBackgroundBorderBottomColor); |
| 73 canvas->DrawRoundRect(bounds, kBackgroundBorderCornerRadius, paint); |
| 74 bounds.Inset(0, 0, 0, kBackgroundBorderBottomWidth); |
| 71 paint.setColor(SK_ColorWHITE); | 75 paint.setColor(SK_ColorWHITE); |
| 72 canvas->DrawRoundRect(bounds, kBackgroundBorderCornerRadius, paint); | 76 canvas->DrawRoundRect(bounds, kBackgroundBorderCornerRadius, paint); |
| 73 } | 77 } |
| 74 | 78 |
| 75 DISALLOW_COPY_AND_ASSIGN(SearchBoxBackground); | 79 DISALLOW_COPY_AND_ASSIGN(SearchBoxBackground); |
| 76 }; | 80 }; |
| 77 | 81 |
| 78 } // namespace | 82 } // namespace |
| 79 | 83 |
| 80 SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate, | 84 SearchBoxView::SearchBoxView(SearchBoxViewDelegate* delegate, |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 NotifyQueryChanged(); | 300 NotifyQueryChanged(); |
| 297 } | 301 } |
| 298 | 302 |
| 299 void SearchBoxView::OnSpeechRecognitionStateChanged( | 303 void SearchBoxView::OnSpeechRecognitionStateChanged( |
| 300 SpeechRecognitionState new_state) { | 304 SpeechRecognitionState new_state) { |
| 301 SpeechRecognitionButtonPropChanged(); | 305 SpeechRecognitionButtonPropChanged(); |
| 302 SchedulePaint(); | 306 SchedulePaint(); |
| 303 } | 307 } |
| 304 | 308 |
| 305 } // namespace app_list | 309 } // namespace app_list |
| OLD | NEW |