| 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 |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 #elif defined(USE_AURA) | 146 #elif defined(USE_AURA) |
| 147 const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); | 147 const gfx::NativeTheme* theme = gfx::NativeTheme::instance(); |
| 148 colors[SELECTED][BACKGROUND] = theme->GetSystemColor( | 148 colors[SELECTED][BACKGROUND] = theme->GetSystemColor( |
| 149 gfx::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); | 149 gfx::NativeTheme::kColorId_TextfieldSelectionBackgroundFocused); |
| 150 colors[SELECTED][TEXT] = theme->GetSystemColor( | 150 colors[SELECTED][TEXT] = theme->GetSystemColor( |
| 151 gfx::NativeTheme::kColorId_TextfieldSelectionColor); | 151 gfx::NativeTheme::kColorId_TextfieldSelectionColor); |
| 152 colors[NORMAL][BACKGROUND] = theme->GetSystemColor( | 152 colors[NORMAL][BACKGROUND] = theme->GetSystemColor( |
| 153 gfx::NativeTheme::kColorId_TextfieldDefaultBackground); | 153 gfx::NativeTheme::kColorId_TextfieldDefaultBackground); |
| 154 colors[NORMAL][TEXT] = theme->GetSystemColor( | 154 colors[NORMAL][TEXT] = theme->GetSystemColor( |
| 155 gfx::NativeTheme::kColorId_TextfieldDefaultColor); | 155 gfx::NativeTheme::kColorId_TextfieldDefaultColor); |
| 156 colors[NORMAL][URL] = SkColorSetARGB(0xff, 0x00, 0x99, 0x33); |
| 157 colors[SELECTED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22); |
| 158 colors[HOVERED][URL] = SkColorSetARGB(0xff, 0x00, 0x66, 0x22); |
| 156 #elif defined(TOOLKIT_USES_GTK) | 159 #elif defined(TOOLKIT_USES_GTK) |
| 157 GdkColor bg_color, selected_bg_color, text_color, selected_text_color; | 160 GdkColor bg_color, selected_bg_color, text_color, selected_text_color; |
| 158 gtk_util::GetTextColors( | 161 gtk_util::GetTextColors( |
| 159 &bg_color, &selected_bg_color, &text_color, &selected_text_color); | 162 &bg_color, &selected_bg_color, &text_color, &selected_text_color); |
| 160 colors[NORMAL][BACKGROUND] = gfx::GdkColorToSkColor(bg_color); | 163 colors[NORMAL][BACKGROUND] = gfx::GdkColorToSkColor(bg_color); |
| 161 colors[SELECTED][BACKGROUND] = gfx::GdkColorToSkColor(selected_bg_color); | 164 colors[SELECTED][BACKGROUND] = gfx::GdkColorToSkColor(selected_bg_color); |
| 162 colors[NORMAL][TEXT] = gfx::GdkColorToSkColor(text_color); | 165 colors[NORMAL][TEXT] = gfx::GdkColorToSkColor(text_color); |
| 163 colors[SELECTED][TEXT] = gfx::GdkColorToSkColor(selected_text_color); | 166 colors[SELECTED][TEXT] = gfx::GdkColorToSkColor(selected_text_color); |
| 164 #else | 167 #else |
| 165 // TODO(beng): source from theme provider. | 168 // TODO(beng): source from theme provider. |
| 166 colors[NORMAL][BACKGROUND] = SK_ColorWHITE; | 169 colors[NORMAL][BACKGROUND] = SK_ColorWHITE; |
| 167 colors[SELECTED][BACKGROUND] = SK_ColorBLUE; | 170 colors[SELECTED][BACKGROUND] = SK_ColorBLUE; |
| 168 colors[NORMAL][TEXT] = SK_ColorBLACK; | 171 colors[NORMAL][TEXT] = SK_ColorBLACK; |
| 169 colors[SELECTED][TEXT] = SK_ColorWHITE; | 172 colors[SELECTED][TEXT] = SK_ColorWHITE; |
| 170 #endif | 173 #endif |
| 171 colors[HOVERED][BACKGROUND] = | 174 colors[HOVERED][BACKGROUND] = |
| 172 color_utils::AlphaBlend(colors[SELECTED][BACKGROUND], | 175 color_utils::AlphaBlend(colors[SELECTED][BACKGROUND], |
| 173 colors[NORMAL][BACKGROUND], 64); | 176 colors[NORMAL][BACKGROUND], 64); |
| 174 colors[HOVERED][TEXT] = colors[NORMAL][TEXT]; | 177 colors[HOVERED][TEXT] = colors[NORMAL][TEXT]; |
| 175 for (int i = 0; i < NUM_STATES; ++i) { | 178 for (int i = 0; i < NUM_STATES; ++i) { |
| 176 colors[i][DIMMED_TEXT] = | 179 colors[i][DIMMED_TEXT] = |
| 177 color_utils::AlphaBlend(colors[i][TEXT], colors[i][BACKGROUND], 128); | 180 color_utils::AlphaBlend(colors[i][TEXT], colors[i][BACKGROUND], 128); |
| 181 #if !defined(USE_AURA) |
| 178 colors[i][URL] = color_utils::GetReadableColor(SkColorSetRGB(0, 128, 0), | 182 colors[i][URL] = color_utils::GetReadableColor(SkColorSetRGB(0, 128, 0), |
| 179 colors[i][BACKGROUND]); | 183 colors[i][BACKGROUND]); |
| 184 #endif |
| 180 } | 185 } |
| 181 initialized = true; | 186 initialized = true; |
| 182 } | 187 } |
| 183 | 188 |
| 184 return colors[state][kind]; | 189 return colors[state][kind]; |
| 185 } | 190 } |
| 186 | 191 |
| 187 void AutocompleteResultView::SetMatch(const AutocompleteMatch& match) { | 192 void AutocompleteResultView::SetMatch(const AutocompleteMatch& match) { |
| 188 match_ = match; | 193 match_ = match; |
| 189 animation_->Reset(); | 194 animation_->Reset(); |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 607 PaintMatch(canvas, *match_.associated_keyword.get(), x); | 612 PaintMatch(canvas, *match_.associated_keyword.get(), x); |
| 608 } | 613 } |
| 609 } | 614 } |
| 610 | 615 |
| 611 void AutocompleteResultView::AnimationProgressed( | 616 void AutocompleteResultView::AnimationProgressed( |
| 612 const ui::Animation* animation) { | 617 const ui::Animation* animation) { |
| 613 Layout(); | 618 Layout(); |
| 614 SchedulePaint(); | 619 SchedulePaint(); |
| 615 } | 620 } |
| 616 | 621 |
| OLD | NEW |