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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 11421204: Use native theme colors for textfields; etc. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and rebase, add a blank line between includes. Created 8 years 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) 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 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 const int kBorderCornerRadius = 2; 113 const int kBorderCornerRadius = 2;
114 114
115 const int kDesktopItemPadding = 3; 115 const int kDesktopItemPadding = 3;
116 const int kDesktopEdgeItemPadding = kDesktopItemPadding; 116 const int kDesktopEdgeItemPadding = kDesktopItemPadding;
117 const int kDesktopScriptBadgeItemPadding = 9; 117 const int kDesktopScriptBadgeItemPadding = 9;
118 const int kDesktopScriptBadgeEdgeItemPadding = kDesktopScriptBadgeItemPadding; 118 const int kDesktopScriptBadgeEdgeItemPadding = kDesktopScriptBadgeItemPadding;
119 119
120 const int kTouchItemPadding = 8; 120 const int kTouchItemPadding = 8;
121 const int kTouchEdgeItemPadding = kTouchItemPadding; 121 const int kTouchEdgeItemPadding = kTouchItemPadding;
122 122
123 #if defined(OS_CHROMEOS)
124 const SkColor kOmniboxBackgroundColor = SkColorSetARGB(0, 255, 255, 255);
125 #else
126 const SkColor kOmniboxBackgroundColor = SkColorSetARGB(255, 255, 255, 255);
127 #endif
128
129 } // namespace 123 } // namespace
130 124
131 // static 125 // static
132 const int LocationBarView::kNormalHorizontalEdgeThickness = 2; 126 const int LocationBarView::kNormalHorizontalEdgeThickness = 2;
133 const int LocationBarView::kVerticalEdgeThickness = 3; 127 const int LocationBarView::kVerticalEdgeThickness = 3;
134 const int LocationBarView::kIconInternalPadding = 2; 128 const int LocationBarView::kIconInternalPadding = 2;
135 const int LocationBarView::kBubbleHorizontalPadding = 1; 129 const int LocationBarView::kBubbleHorizontalPadding = 1;
136 const char LocationBarView::kViewClassName[] = 130 const char LocationBarView::kViewClassName[] =
137 "browser/ui/views/location_bar/LocationBarView"; 131 "browser/ui/views/location_bar/LocationBarView";
138 132
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 319
326 OnChanged(); 320 OnChanged();
327 } 321 }
328 322
329 bool LocationBarView::IsInitialized() const { 323 bool LocationBarView::IsInitialized() const {
330 return location_entry_view_ != NULL; 324 return location_entry_view_ != NULL;
331 } 325 }
332 326
333 SkColor LocationBarView::GetColor(ToolbarModel::SecurityLevel security_level, 327 SkColor LocationBarView::GetColor(ToolbarModel::SecurityLevel security_level,
334 ColorKind kind) const { 328 ColorKind kind) const {
335 #if defined(OS_WIN) 329 const ui::NativeTheme* native_theme = GetNativeTheme();
336 if (GetNativeTheme() == ui::NativeThemeWin::instance()) { 330 switch (kind) {
337 switch (kind) { 331 case BACKGROUND:
338 case BACKGROUND: 332 #if defined(OS_CHROMEOS)
339 return color_utils::GetSysSkColor(COLOR_WINDOW); 333 // Chrome OS requires a transparent omnibox background color.
340 case TEXT: 334 return SkColorSetARGB(0, 255, 255, 255);
341 return color_utils::GetSysSkColor(COLOR_WINDOWTEXT); 335 #else
342 case SELECTED_TEXT: 336 return native_theme->GetSystemColor(
343 return color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT); 337 ui::NativeTheme::kColorId_TextfieldDefaultBackground);
344 default:
345 // Other cases are handled below.
346 break;
347 }
348 }
349 #endif 338 #endif
350 switch (kind) { 339
351 // TODO(beng): source from theme provider. 340 case TEXT:
352 case BACKGROUND: return kOmniboxBackgroundColor; 341 return native_theme->GetSystemColor(
353 case TEXT: return SK_ColorBLACK; 342 ui::NativeTheme::kColorId_TextfieldDefaultColor);
354 case SELECTED_TEXT: return SK_ColorWHITE; 343
344 case SELECTED_TEXT:
345 return native_theme->GetSystemColor(
346 ui::NativeTheme::kColorId_TextfieldSelectionColor);
355 347
356 case DEEMPHASIZED_TEXT: 348 case DEEMPHASIZED_TEXT:
357 return color_utils::AlphaBlend( 349 return color_utils::AlphaBlend(
358 GetColor(security_level, TEXT), 350 GetColor(security_level, TEXT),
359 GetColor(security_level, BACKGROUND), 351 GetColor(security_level, BACKGROUND),
360 128); 352 128);
361 353
362 case SECURITY_TEXT: { 354 case SECURITY_TEXT: {
363 SkColor color; 355 SkColor color;
364 switch (security_level) { 356 switch (security_level) {
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1571 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1563 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1572 int total_height = 1564 int total_height =
1573 use_preferred_size ? GetPreferredSize().height() : height(); 1565 use_preferred_size ? GetPreferredSize().height() : height();
1574 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1566 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1575 } 1567 }
1576 1568
1577 bool LocationBarView::HasValidSuggestText() const { 1569 bool LocationBarView::HasValidSuggestText() const {
1578 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1570 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1579 !suggested_text_view_->text().empty(); 1571 !suggested_text_view_->text().empty();
1580 } 1572 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.h ('k') | chrome/browser/ui/views/omnibox/omnibox_view_views.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698