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

Side by Side Diff: chrome/browser/ui/views/bookmarks/bookmark_bar_instructions_view.cc

Issue 1690543004: MacViews: Implement Full Keyboard Access. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
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/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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 instructions_ = new views::Label( 45 instructions_ = new views::Label(
46 l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS)); 46 l10n_util::GetStringUTF16(IDS_BOOKMARKS_NO_ITEMS));
47 instructions_->SetAutoColorReadabilityEnabled(false); 47 instructions_->SetAutoColorReadabilityEnabled(false);
48 instructions_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 48 instructions_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
49 AddChildView(instructions_); 49 AddChildView(instructions_);
50 50
51 if (browser_defaults::kShowImportOnBookmarkBar) { 51 if (browser_defaults::kShowImportOnBookmarkBar) {
52 import_link_ = new views::Link( 52 import_link_ = new views::Link(
53 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK)); 53 l10n_util::GetStringUTF16(IDS_BOOKMARK_BAR_IMPORT_LINK));
54 // We don't want the link to alter tab navigation. 54 // We don't want the link to alter tab navigation.
55 import_link_->SetFocusable(false); 55 import_link_->SetFocusBehavior(views::View::FocusBehavior::NEVER);
56 import_link_->set_listener(this); 56 import_link_->set_listener(this);
57 import_link_->set_context_menu_controller(this); 57 import_link_->set_context_menu_controller(this);
58 import_link_->SetAutoColorReadabilityEnabled(false); 58 import_link_->SetAutoColorReadabilityEnabled(false);
59 import_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT); 59 import_link_->SetHorizontalAlignment(gfx::ALIGN_LEFT);
60 AddChildView(import_link_); 60 AddChildView(import_link_);
61 } 61 }
62 } 62 }
63 63
64 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() const { 64 gfx::Size BookmarkBarInstructionsView::GetPreferredSize() const {
65 int ascent = 0, descent = 0, height = 0, width = 0; 65 int ascent = 0, descent = 0, height = 0, width = 0;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::GetContrastRatio(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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698