| 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 // For WinDDK ATL compatibility, these ATL headers must come first. | 5 // For WinDDK ATL compatibility, these ATL headers must come first. |
| 6 #include "build/build_config.h" | 6 #include "build/build_config.h" |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 #include <atlbase.h> // NOLINT | 8 #include <atlbase.h> // NOLINT |
| 9 #include <atlwin.h> // NOLINT | 9 #include <atlwin.h> // NOLINT |
| 10 #endif | 10 #endif |
| 11 | 11 |
| 12 #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h" | 12 #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view.h" |
| 13 | 13 |
| 14 #include <algorithm> // NOLINT | 14 #include <algorithm> // NOLINT |
| 15 | 15 |
| 16 #include "base/i18n/bidi_line_iterator.h" | 16 #include "base/i18n/bidi_line_iterator.h" |
| 17 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" | 17 #include "chrome/browser/autocomplete/autocomplete_popup_model.h" |
| 18 #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h" | 18 #include "chrome/browser/ui/views/autocomplete/autocomplete_result_view_model.h" |
| 19 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 19 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
| 20 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 21 #include "grit/theme_resources.h" | 21 #include "grit/theme_resources.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/native_theme/native_theme.h" | |
| 24 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/base/text/text_elider.h" | 24 #include "ui/base/text/text_elider.h" |
| 26 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
| 27 #include "ui/gfx/color_utils.h" | 26 #include "ui/gfx/color_utils.h" |
| 27 #include "ui/gfx/native_theme.h" |
| 28 | 28 |
| 29 namespace { | 29 namespace { |
| 30 | 30 |
| 31 const char16 kEllipsis[] = { 0x2026, 0x0 }; | 31 const char16 kEllipsis[] = { 0x2026, 0x0 }; |
| 32 | 32 |
| 33 // The minimum distance between the top and bottom of the {icon|text} and the | 33 // The minimum distance between the top and bottom of the {icon|text} and the |
| 34 // top or bottom of the row. | 34 // top or bottom of the row. |
| 35 const int kMinimumIconVerticalPadding = 2; | 35 const int kMinimumIconVerticalPadding = 2; |
| 36 const int kMinimumTextVerticalPadding = 3; | 36 const int kMinimumTextVerticalPadding = 3; |
| 37 | 37 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 ColorKind kind) { | 132 ColorKind kind) { |
| 133 static bool initialized = false; | 133 static bool initialized = false; |
| 134 static SkColor colors[NUM_STATES][NUM_KINDS]; | 134 static SkColor colors[NUM_STATES][NUM_KINDS]; |
| 135 if (!initialized) { | 135 if (!initialized) { |
| 136 #if defined(OS_WIN) | 136 #if defined(OS_WIN) |
| 137 colors[NORMAL][BACKGROUND] = color_utils::GetSysSkColor(COLOR_WINDOW); | 137 colors[NORMAL][BACKGROUND] = color_utils::GetSysSkColor(COLOR_WINDOW); |
| 138 colors[SELECTED][BACKGROUND] = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); | 138 colors[SELECTED][BACKGROUND] = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); |
| 139 colors[NORMAL][TEXT] = color_utils::GetSysSkColor(COLOR_WINDOWTEXT); | 139 colors[NORMAL][TEXT] = color_utils::GetSysSkColor(COLOR_WINDOWTEXT); |
| 140 colors[SELECTED][TEXT] = color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT); | 140 colors[SELECTED][TEXT] = color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT); |
| 141 #elif defined(USE_AURA) | 141 #elif defined(USE_AURA) |
| 142 const ui::NativeTheme* theme = ui::NativeTheme::instance(); | 142 const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); |
| 143 colors[SELECTED][BACKGROUND] = theme->GetSystemColor( | 143 colors[SELECTED][BACKGROUND] = theme->GetSystemColor( |
| 144 ui::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); | 144 gfx::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); |
| 145 colors[NORMAL][BACKGROUND] = theme->GetSystemColor( | 145 colors[NORMAL][BACKGROUND] = theme->GetSystemColor( |
| 146 ui::NativeTheme::kColorId_TextfieldDefaultBackground); | 146 gfx::NativeTheme::kColorId_TextfieldDefaultBackground); |
| 147 colors[NORMAL][URL] = SkColorSetARGB(0xff, 0x00, 0x99, 0x33); | 147 colors[NORMAL][URL] = SkColorSetARGB(0xff, 0x00, 0x99, 0x33); |
| 148 colors[SELECTED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22); | 148 colors[SELECTED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22); |
| 149 colors[HOVERED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22); | 149 colors[HOVERED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22); |
| 150 #else | 150 #else |
| 151 // TODO(beng): source from theme provider. | 151 // TODO(beng): source from theme provider. |
| 152 colors[NORMAL][BACKGROUND] = SK_ColorWHITE; | 152 colors[NORMAL][BACKGROUND] = SK_ColorWHITE; |
| 153 colors[SELECTED][BACKGROUND] = SK_ColorBLUE; | 153 colors[SELECTED][BACKGROUND] = SK_ColorBLUE; |
| 154 colors[NORMAL][TEXT] = SK_ColorBLACK; | 154 colors[NORMAL][TEXT] = SK_ColorBLACK; |
| 155 colors[SELECTED][TEXT] = SK_ColorWHITE; | 155 colors[SELECTED][TEXT] = SK_ColorWHITE; |
| 156 #endif | 156 #endif |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 625 mirroring_context_->Initialize(x, keyword_text_bounds_.width()); | 625 mirroring_context_->Initialize(x, keyword_text_bounds_.width()); |
| 626 PaintMatch(canvas, *match_.associated_keyword.get(), x); | 626 PaintMatch(canvas, *match_.associated_keyword.get(), x); |
| 627 } | 627 } |
| 628 } | 628 } |
| 629 | 629 |
| 630 void AutocompleteResultView::AnimationProgressed( | 630 void AutocompleteResultView::AnimationProgressed( |
| 631 const ui::Animation* animation) { | 631 const ui::Animation* animation) { |
| 632 Layout(); | 632 Layout(); |
| 633 SchedulePaint(); | 633 SchedulePaint(); |
| 634 } | 634 } |
| OLD | NEW |