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

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: Nix cursor color; adjust textfield functions; add read-only theme colors. 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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 const int kBorderCornerRadius = 2; 111 const int kBorderCornerRadius = 2;
112 112
113 const int kDesktopItemPadding = 3; 113 const int kDesktopItemPadding = 3;
114 const int kDesktopEdgeItemPadding = kDesktopItemPadding; 114 const int kDesktopEdgeItemPadding = kDesktopItemPadding;
115 const int kDesktopScriptBadgeItemPadding = 9; 115 const int kDesktopScriptBadgeItemPadding = 9;
116 const int kDesktopScriptBadgeEdgeItemPadding = kDesktopScriptBadgeItemPadding; 116 const int kDesktopScriptBadgeEdgeItemPadding = kDesktopScriptBadgeItemPadding;
117 117
118 const int kTouchItemPadding = 8; 118 const int kTouchItemPadding = 8;
119 const int kTouchEdgeItemPadding = kTouchItemPadding; 119 const int kTouchEdgeItemPadding = kTouchItemPadding;
120 120
121 #if defined(OS_CHROMEOS)
msw 2012/12/04 18:40:07 Varun: Is this still needed? It's purpose isn't ex
varunjain 2012/12/04 23:05:31 This was done because we want the omnibox to have
msw 2012/12/05 02:09:56 I in-lined the CrOS case into GetColor, as explain
122 const SkColor kOmniboxBackgroundColor = SkColorSetARGB(0, 255, 255, 255);
123 #else
124 const SkColor kOmniboxBackgroundColor = SkColorSetARGB(255, 255, 255, 255);
125 #endif
126
127 } // namespace 121 } // namespace
128 122
129 // static 123 // static
130 const int LocationBarView::kNormalHorizontalEdgeThickness = 2; 124 const int LocationBarView::kNormalHorizontalEdgeThickness = 2;
131 const int LocationBarView::kVerticalEdgeThickness = 3; 125 const int LocationBarView::kVerticalEdgeThickness = 3;
132 const int LocationBarView::kIconInternalPadding = 2; 126 const int LocationBarView::kIconInternalPadding = 2;
133 const int LocationBarView::kBubbleHorizontalPadding = 1; 127 const int LocationBarView::kBubbleHorizontalPadding = 1;
134 const char LocationBarView::kViewClassName[] = 128 const char LocationBarView::kViewClassName[] =
135 "browser/ui/views/location_bar/LocationBarView"; 129 "browser/ui/views/location_bar/LocationBarView";
136 130
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 312
319 OnChanged(); 313 OnChanged();
320 } 314 }
321 315
322 bool LocationBarView::IsInitialized() const { 316 bool LocationBarView::IsInitialized() const {
323 return location_entry_view_ != NULL; 317 return location_entry_view_ != NULL;
324 } 318 }
325 319
326 SkColor LocationBarView::GetColor(ToolbarModel::SecurityLevel security_level, 320 SkColor LocationBarView::GetColor(ToolbarModel::SecurityLevel security_level,
327 ColorKind kind) const { 321 ColorKind kind) const {
328 #if defined(OS_WIN) 322 const ui::NativeTheme* native_theme = GetNativeTheme();
329 if (GetNativeTheme() == ui::NativeThemeWin::instance()) {
330 switch (kind) {
331 case BACKGROUND:
332 return color_utils::GetSysSkColor(COLOR_WINDOW);
333 case TEXT:
334 return color_utils::GetSysSkColor(COLOR_WINDOWTEXT);
335 case SELECTED_TEXT:
336 return color_utils::GetSysSkColor(COLOR_HIGHLIGHTTEXT);
337 default:
338 // Other cases are handled below.
339 break;
340 }
341 }
342 #endif
343 switch (kind) { 323 switch (kind) {
344 // TODO(beng): source from theme provider. 324 case BACKGROUND:
345 case BACKGROUND: return kOmniboxBackgroundColor; 325 return native_theme->GetSystemColor(
346 case TEXT: return SK_ColorBLACK; 326 ui::NativeTheme::kColorId_TextfieldDefaultBackground);
347 case SELECTED_TEXT: return SK_ColorWHITE; 327
328 case TEXT:
329 return native_theme->GetSystemColor(
330 ui::NativeTheme::kColorId_TextfieldDefaultColor);
331
332 case SELECTED_TEXT:
333 return native_theme->GetSystemColor(
334 ui::NativeTheme::kColorId_TextfieldSelectionColor);
348 335
349 case DEEMPHASIZED_TEXT: 336 case DEEMPHASIZED_TEXT:
350 return color_utils::AlphaBlend( 337 return color_utils::AlphaBlend(
351 GetColor(security_level, TEXT), 338 GetColor(security_level, TEXT),
352 GetColor(security_level, BACKGROUND), 339 GetColor(security_level, BACKGROUND),
353 128); 340 128);
354 341
355 case SECURITY_TEXT: { 342 case SECURITY_TEXT: {
356 SkColor color; 343 SkColor color;
357 switch (security_level) { 344 switch (security_level) {
(...skipping 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 int LocationBarView::GetInternalHeight(bool use_preferred_size) { 1505 int LocationBarView::GetInternalHeight(bool use_preferred_size) {
1519 int total_height = 1506 int total_height =
1520 use_preferred_size ? GetPreferredSize().height() : height(); 1507 use_preferred_size ? GetPreferredSize().height() : height();
1521 return std::max(total_height - (kVerticalEdgeThickness * 2), 0); 1508 return std::max(total_height - (kVerticalEdgeThickness * 2), 0);
1522 } 1509 }
1523 1510
1524 bool LocationBarView::HasValidSuggestText() const { 1511 bool LocationBarView::HasValidSuggestText() const {
1525 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() && 1512 return suggested_text_view_ && !suggested_text_view_->size().IsEmpty() &&
1526 !suggested_text_view_->text().empty(); 1513 !suggested_text_view_->text().empty();
1527 } 1514 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698