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

Side by Side Diff: chrome/browser/views/autocomplete/autocomplete_popup_contents_view.cc

Issue 220029: Simplify life for people trying to pick a "readable" foreground color by not ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this
2 // source code is governed by a BSD-style license that can be found in the 2 // source code is governed by a BSD-style license that can be found in the
3 // LICENSE file. 3 // 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 "app/gfx/canvas.h" 7 #include "app/gfx/canvas.h"
8 #include "app/gfx/color_utils.h" 8 #include "app/gfx/color_utils.h"
9 #include "app/gfx/insets.h" 9 #include "app/gfx/insets.h"
10 #include "app/gfx/path.h" 10 #include "app/gfx/path.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // TODO(beng): source from theme provider. 60 // TODO(beng): source from theme provider.
61 colors[NORMAL][BACKGROUND] = SK_ColorWHITE; 61 colors[NORMAL][BACKGROUND] = SK_ColorWHITE;
62 colors[SELECTED][BACKGROUND] = SK_ColorBLUE; 62 colors[SELECTED][BACKGROUND] = SK_ColorBLUE;
63 colors[NORMAL][TEXT] = SK_ColorBLACK; 63 colors[NORMAL][TEXT] = SK_ColorBLACK;
64 colors[SELECTED][TEXT] = SK_ColorWHITE; 64 colors[SELECTED][TEXT] = SK_ColorWHITE;
65 #endif 65 #endif
66 colors[HOVERED][BACKGROUND] = 66 colors[HOVERED][BACKGROUND] =
67 color_utils::AlphaBlend(colors[SELECTED][BACKGROUND], 67 color_utils::AlphaBlend(colors[SELECTED][BACKGROUND],
68 colors[NORMAL][BACKGROUND], 64); 68 colors[NORMAL][BACKGROUND], 64);
69 colors[HOVERED][TEXT] = colors[NORMAL][TEXT]; 69 colors[HOVERED][TEXT] = colors[NORMAL][TEXT];
70 const SkColor kDarkURL = SkColorSetRGB(0, 128, 0);
71 const SkColor kLightURL = SkColorSetRGB(128, 255, 128);
72 for (int i = 0; i < NUM_STATES; ++i) { 70 for (int i = 0; i < NUM_STATES; ++i) {
73 colors[i][DIMMED_TEXT] = 71 colors[i][DIMMED_TEXT] =
74 color_utils::AlphaBlend(colors[i][TEXT], colors[i][BACKGROUND], 128); 72 color_utils::AlphaBlend(colors[i][TEXT], colors[i][BACKGROUND], 128);
75 colors[i][URL] = color_utils::PickMoreReadableColor(kDarkURL, kLightURL, 73 colors[i][URL] = color_utils::GetReadableColor(SkColorSetRGB(0, 128, 0),
76 colors[i][BACKGROUND]); 74 colors[i][BACKGROUND]);
77 } 75 }
78 initialized = true; 76 initialized = true;
79 } 77 }
80 78
81 return colors[state][kind]; 79 return colors[state][kind];
82 } 80 }
83 81
84 const SkAlpha kGlassPopupAlpha = 240; 82 const SkAlpha kGlassPopupAlpha = 240;
85 const SkAlpha kOpaquePopupAlpha = 255; 83 const SkAlpha kOpaquePopupAlpha = 255;
86 // The minimum distance between the top and bottom of the icon and the top or 84 // The minimum distance between the top and bottom of the icon and the top or
(...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after
870 // static 868 // static
871 AutocompletePopupView* AutocompletePopupView::CreatePopupView( 869 AutocompletePopupView* AutocompletePopupView::CreatePopupView(
872 const gfx::Font& font, 870 const gfx::Font& font,
873 AutocompleteEditView* edit_view, 871 AutocompleteEditView* edit_view,
874 AutocompleteEditModel* edit_model, 872 AutocompleteEditModel* edit_model,
875 Profile* profile, 873 Profile* profile,
876 const BubblePositioner* bubble_positioner) { 874 const BubblePositioner* bubble_positioner) {
877 return new AutocompletePopupContentsView(font, edit_view, edit_model, 875 return new AutocompletePopupContentsView(font, edit_view, edit_model,
878 profile, bubble_positioner); 876 profile, bubble_positioner);
879 } 877 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698