Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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. |
|
varunjain
2012/12/06 18:36:58
I agree that native_theme should not have a separa
msw
2012/12/06 18:54:46
That might be feasible for a follow-up change. It
sky
2012/12/06 20:43:57
Doesn't the transparent background apply to OS_WIN
msw
2012/12/07 02:04:01
Hmm, not afaik; I think this is okay as-is. The ol
sky
2012/12/07 16:35:12
I'm still confused. OS_CHROMEOS and OS_WIN when th
msw
2012/12/07 18:22:28
This change preserves the existing behavior, which
sky
2012/12/07 18:58:02
Ah, ok. I see it now.
| |
| 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 Loading... | |
| 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 } |
| OLD | NEW |