| 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/bookmarks/bookmark_bar_instructions_view.h" | 5 #include "chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/defaults.h" | 10 #include "chrome/browser/defaults.h" |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 if (!ui::MaterialDesignController::IsModeMaterial()) { | 147 if (!ui::MaterialDesignController::IsModeMaterial()) { |
| 148 import_link_->SetEnabledColor(text_color); | 148 import_link_->SetEnabledColor(text_color); |
| 149 } else { | 149 } else { |
| 150 // For MD, use the default link color if it provides enough contrast. If | 150 // For MD, use the default link color if it provides enough contrast. If |
| 151 // contrast is too low, fall back to the bookmark text color and use an | 151 // contrast is too low, fall back to the bookmark text color and use an |
| 152 // underline to make it obvious it's a link. The default color readability | 152 // underline to make it obvious it's a link. The default color readability |
| 153 // code (which only adjusts luminance) doesn't work well in this case. | 153 // code (which only adjusts luminance) doesn't work well in this case. |
| 154 SkColor bg = theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR); | 154 SkColor bg = theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR); |
| 155 SkColor link_color = | 155 SkColor link_color = |
| 156 GetNativeTheme()->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); | 156 GetNativeTheme()->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); |
| 157 bool link_has_contrast = color_utils::GetContrastRatio(link_color, bg) >= | 157 bool link_has_contrast = color_utils::ContrastRatio(link_color, bg) >= |
| 158 color_utils::kMinimumReadableContrastRatio; | 158 color_utils::kMinimumReadableContrastRatio; |
| 159 import_link_->SetUnderline(!link_has_contrast); | 159 import_link_->SetUnderline(!link_has_contrast); |
| 160 import_link_->SetEnabledColor(link_has_contrast ? link_color : text_color); | 160 import_link_->SetEnabledColor(link_has_contrast ? link_color : text_color); |
| 161 } | 161 } |
| 162 } | 162 } |
| OLD | NEW |