OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" | 5 #include "chrome/browser/views/autocomplete/autocomplete_popup_contents_view.h" |
6 | 6 |
7 #include "unicode/ubidi.h" | 7 #include "unicode/ubidi.h" |
8 | 8 |
9 #include "app/bidi_line_iterator.h" | 9 #include "app/bidi_line_iterator.h" |
10 #include "app/l10n_util.h" | 10 #include "app/l10n_util.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 #include "views/widget/widget.h" | 27 #include "views/widget/widget.h" |
28 | 28 |
29 #if defined(OS_WIN) | 29 #if defined(OS_WIN) |
30 #include <objidl.h> | 30 #include <objidl.h> |
31 #include <commctrl.h> | 31 #include <commctrl.h> |
32 #include <dwmapi.h> | 32 #include <dwmapi.h> |
33 | 33 |
34 #include "app/win_util.h" | 34 #include "app/win_util.h" |
35 #endif | 35 #endif |
36 | 36 |
| 37 #if defined(OS_LINUX) |
| 38 #include "chrome/browser/gtk/gtk_util.h" |
| 39 #include "gfx/skia_utils_gtk.h" |
| 40 #endif |
| 41 |
37 namespace { | 42 namespace { |
38 | 43 |
39 enum ResultViewState { | 44 enum ResultViewState { |
40 NORMAL = 0, | 45 NORMAL = 0, |
41 SELECTED, | 46 SELECTED, |
42 HOVERED, | 47 HOVERED, |
43 NUM_STATES | 48 NUM_STATES |
44 }; | 49 }; |
45 | 50 |
46 enum ColorKind { | 51 enum ColorKind { |
47 BACKGROUND = 0, | 52 BACKGROUND = 0, |
48 TEXT, | 53 TEXT, |
49 DIMMED_TEXT, | 54 DIMMED_TEXT, |
50 URL, | 55 URL, |
51 NUM_KINDS | 56 NUM_KINDS |
52 }; | 57 }; |
53 | 58 |
54 SkColor GetColor(ResultViewState state, ColorKind kind) { | 59 SkColor GetColor(ResultViewState state, ColorKind kind) { |
55 static bool initialized = false; | 60 static bool initialized = false; |
56 static SkColor colors[NUM_STATES][NUM_KINDS]; | 61 static SkColor colors[NUM_STATES][NUM_KINDS]; |
57 if (!initialized) { | 62 if (!initialized) { |
58 #if defined(OS_WIN) | 63 #if defined(OS_WIN) |
59 colors[NORMAL][BACKGROUND] = color_utils::GetSysSkColor(COLOR_WINDOW); | 64 colors[NORMAL][BACKGROUND] = color_utils::GetSysSkColor(COLOR_WINDOW); |
60 colors[SELECTED][BACKGROUND] = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); | 65 colors[SELECTED][BACKGROUND] = color_utils::GetSysSkColor(COLOR_HIGHLIGHT); |
61 colors[NORMAL][TEXT] = color_utils::GetSysSkColor(COLOR_WINDOWTEXT); | 66 colors[NORMAL][TEXT] = color_utils::GetSysSkColor(COLOR_WINDOWTEXT); |
62 colors[SELECTED][TEXT] = color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT); | 67 colors[SELECTED][TEXT] = color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT); |
| 68 #elif defined(OS_LINUX) |
| 69 GdkColor bg_color, selected_bg_color, text_color, selected_text_color; |
| 70 gtk_util::GetTextColors( |
| 71 &bg_color, &selected_bg_color, &text_color, &selected_text_color); |
| 72 colors[NORMAL][BACKGROUND] = gfx::GdkColorToSkColor(bg_color); |
| 73 colors[SELECTED][BACKGROUND] = gfx::GdkColorToSkColor(selected_bg_color); |
| 74 colors[NORMAL][TEXT] = gfx::GdkColorToSkColor(text_color); |
| 75 colors[SELECTED][TEXT] = gfx::GdkColorToSkColor(selected_text_color); |
63 #else | 76 #else |
64 // TODO(beng): source from theme provider. | 77 // TODO(beng): source from theme provider. |
65 colors[NORMAL][BACKGROUND] = SK_ColorWHITE; | 78 colors[NORMAL][BACKGROUND] = SK_ColorWHITE; |
66 colors[SELECTED][BACKGROUND] = SK_ColorBLUE; | 79 colors[SELECTED][BACKGROUND] = SK_ColorBLUE; |
67 colors[NORMAL][TEXT] = SK_ColorBLACK; | 80 colors[NORMAL][TEXT] = SK_ColorBLACK; |
68 colors[SELECTED][TEXT] = SK_ColorWHITE; | 81 colors[SELECTED][TEXT] = SK_ColorWHITE; |
69 #endif | 82 #endif |
70 colors[HOVERED][BACKGROUND] = | 83 colors[HOVERED][BACKGROUND] = |
71 color_utils::AlphaBlend(colors[SELECTED][BACKGROUND], | 84 color_utils::AlphaBlend(colors[SELECTED][BACKGROUND], |
72 colors[NORMAL][BACKGROUND], 64); | 85 colors[NORMAL][BACKGROUND], 64); |
(...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 // bubble appear at the same height as the Star bubble. | 1016 // bubble appear at the same height as the Star bubble. |
1004 location_bar_bounds.Inset(LocationBarView::kNormalHorizontalEdgeThickness, | 1017 location_bar_bounds.Inset(LocationBarView::kNormalHorizontalEdgeThickness, |
1005 0); | 1018 0); |
1006 } | 1019 } |
1007 gfx::Point location_bar_origin(location_bar_bounds.origin()); | 1020 gfx::Point location_bar_origin(location_bar_bounds.origin()); |
1008 views::View::ConvertPointToScreen(location_bar_, &location_bar_origin); | 1021 views::View::ConvertPointToScreen(location_bar_, &location_bar_origin); |
1009 location_bar_bounds.set_origin(location_bar_origin); | 1022 location_bar_bounds.set_origin(location_bar_origin); |
1010 return bubble_border_->GetBounds( | 1023 return bubble_border_->GetBounds( |
1011 location_bar_bounds, gfx::Size(location_bar_bounds.width(), h)); | 1024 location_bar_bounds, gfx::Size(location_bar_bounds.width(), h)); |
1012 } | 1025 } |
OLD | NEW |