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

Side by Side Diff: chrome/browser/views/location_bar_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. 1 // Copyright (c) 2009 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/location_bar_view.h" 5 #include "chrome/browser/views/location_bar_view.h"
6 6
7 #if defined(OS_LINUX) 7 #if defined(OS_LINUX)
8 #include <gtk/gtk.h> 8 #include <gtk/gtk.h>
9 #endif 9 #endif
10 10
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 #endif 231 #endif
232 colors[SECURE][BACKGROUND] = SkColorSetRGB(255, 245, 195); 232 colors[SECURE][BACKGROUND] = SkColorSetRGB(255, 245, 195);
233 colors[SECURE][TEXT] = SkColorSetRGB(0, 0, 0); 233 colors[SECURE][TEXT] = SkColorSetRGB(0, 0, 0);
234 colors[SECURE][SELECTED_TEXT] = 0; // Unused 234 colors[SECURE][SELECTED_TEXT] = 0; // Unused
235 colors[NOT_SECURE][DEEMPHASIZED_TEXT] = 235 colors[NOT_SECURE][DEEMPHASIZED_TEXT] =
236 color_utils::AlphaBlend(colors[NOT_SECURE][TEXT], 236 color_utils::AlphaBlend(colors[NOT_SECURE][TEXT],
237 colors[NOT_SECURE][BACKGROUND], 128); 237 colors[NOT_SECURE][BACKGROUND], 128);
238 colors[SECURE][DEEMPHASIZED_TEXT] = 238 colors[SECURE][DEEMPHASIZED_TEXT] =
239 color_utils::AlphaBlend(colors[SECURE][TEXT], 239 color_utils::AlphaBlend(colors[SECURE][TEXT],
240 colors[SECURE][BACKGROUND], 128); 240 colors[SECURE][BACKGROUND], 128);
241 const SkColor kDarkNotSecureText = SkColorSetRGB(200, 0, 0); 241 colors[NOT_SECURE][SECURITY_TEXT] = color_utils::GetReadableColor(
242 const SkColor kLightNotSecureText = SkColorSetRGB(255, 55, 55); 242 SkColorSetRGB(200, 0, 0), colors[NOT_SECURE][BACKGROUND]);
243 colors[NOT_SECURE][SECURITY_TEXT] =
244 color_utils::PickMoreReadableColor(kDarkNotSecureText,
245 kLightNotSecureText,
246 colors[NOT_SECURE][BACKGROUND]);
247 colors[SECURE][SECURITY_TEXT] = SkColorSetRGB(0, 150, 20); 243 colors[SECURE][SECURITY_TEXT] = SkColorSetRGB(0, 150, 20);
248 colors[NOT_SECURE][SECURITY_INFO_BUBBLE_TEXT] = 244 colors[NOT_SECURE][SECURITY_INFO_BUBBLE_TEXT] =
249 colors[NOT_SECURE][SECURITY_TEXT]; 245 colors[NOT_SECURE][SECURITY_TEXT];
250 const SkColor kDarkSecureInfoBubbleText = SkColorSetRGB(0, 153, 51); 246 colors[SECURE][SECURITY_INFO_BUBBLE_TEXT] = color_utils::GetReadableColor(
251 const SkColor kLightSecureInfoBubbleText = SkColorSetRGB(102, 255, 152); 247 SkColorSetRGB(0, 153, 51), colors[NOT_SECURE][BACKGROUND]);
252 colors[SECURE][SECURITY_INFO_BUBBLE_TEXT] = 248 colors[NOT_SECURE][SCHEME_STRIKEOUT] = color_utils::GetReadableColor(
253 color_utils::PickMoreReadableColor(kDarkSecureInfoBubbleText, 249 SkColorSetRGB(210, 0, 0), colors[NOT_SECURE][BACKGROUND]);
254 kLightSecureInfoBubbleText,
255 colors[NOT_SECURE][BACKGROUND]);
256 const SkColor kDarkSchemeStrikeout = SkColorSetRGB(210, 0, 0);
257 const SkColor kLightSchemeStrikeout = SkColorSetRGB(255, 45, 45);
258 colors[NOT_SECURE][SCHEME_STRIKEOUT] =
259 color_utils::PickMoreReadableColor(kDarkSchemeStrikeout,
260 kLightSchemeStrikeout,
261 colors[NOT_SECURE][BACKGROUND]);
262 colors[SECURE][SCHEME_STRIKEOUT] = 0; // Unused 250 colors[SECURE][SCHEME_STRIKEOUT] = 0; // Unused
263 initialized = true; 251 initialized = true;
264 } 252 }
265 253
266 return colors[is_secure ? SECURE : NOT_SECURE][kind]; 254 return colors[is_secure ? SECURE : NOT_SECURE][kind];
267 } 255 }
268 256
269 void LocationBarView::Update(const TabContents* tab_for_state_restoring) { 257 void LocationBarView::Update(const TabContents* tab_for_state_restoring) {
270 SetSecurityIcon(model_->GetIcon()); 258 SetSecurityIcon(model_->GetIcon());
271 RefreshPageActionViews(); 259 RefreshPageActionViews();
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 } 1314 }
1327 1315
1328 int LocationBarView::PageActionVisibleCount() { 1316 int LocationBarView::PageActionVisibleCount() {
1329 int result = 0; 1317 int result = 0;
1330 for (size_t i = 0; i < page_action_image_views_.size(); i++) { 1318 for (size_t i = 0; i < page_action_image_views_.size(); i++) {
1331 if (page_action_image_views_[i]->IsVisible()) 1319 if (page_action_image_views_[i]->IsVisible())
1332 ++result; 1320 ++result;
1333 } 1321 }
1334 return result; 1322 return result;
1335 } 1323 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698