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

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

Issue 2477463003: Replace ui::AXViewState with AXNodeData and AXActionData (Closed)
Patch Set: Fix test Created 4 years, 1 month 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"
11 #include "chrome/browser/themes/theme_properties.h" 11 #include "chrome/browser/themes/theme_properties.h"
12 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h" 12 #include "chrome/browser/ui/bookmarks/bookmark_bar_instructions_delegate.h"
13 #include "chrome/grit/generated_resources.h" 13 #include "chrome/grit/generated_resources.h"
14 #include "ui/accessibility/ax_view_state.h" 14 #include "ui/accessibility/ax_node_data.h"
15 #include "ui/base/l10n/l10n_util.h" 15 #include "ui/base/l10n/l10n_util.h"
16 #include "ui/base/theme_provider.h" 16 #include "ui/base/theme_provider.h"
17 #include "ui/native_theme/native_theme.h" 17 #include "ui/native_theme/native_theme.h"
18 #include "ui/views/controls/label.h" 18 #include "ui/views/controls/label.h"
19 #include "ui/views/controls/link.h" 19 #include "ui/views/controls/link.h"
20 20
21 namespace { 21 namespace {
22 22
23 // Horizontal padding, in pixels, between the link and label. 23 // Horizontal padding, in pixels, between the link and label.
24 int GetViewPadding() { 24 int GetViewPadding() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 void BookmarkBarInstructionsView::OnThemeChanged() { 87 void BookmarkBarInstructionsView::OnThemeChanged() {
88 UpdateColors(); 88 UpdateColors();
89 } 89 }
90 90
91 void BookmarkBarInstructionsView::ViewHierarchyChanged( 91 void BookmarkBarInstructionsView::ViewHierarchyChanged(
92 const ViewHierarchyChangedDetails& details) { 92 const ViewHierarchyChangedDetails& details) {
93 if (!updated_colors_ && details.is_add && GetWidget()) 93 if (!updated_colors_ && details.is_add && GetWidget())
94 UpdateColors(); 94 UpdateColors();
95 } 95 }
96 96
97 void BookmarkBarInstructionsView::GetAccessibleState( 97 void BookmarkBarInstructionsView::GetAccessibleNodeData(
98 ui::AXViewState* state) { 98 ui::AXNodeData* node_data) {
99 instructions_->GetAccessibleState(state); 99 instructions_->GetAccessibleNodeData(node_data);
100 } 100 }
101 101
102 void BookmarkBarInstructionsView::LinkClicked(views::Link* source, 102 void BookmarkBarInstructionsView::LinkClicked(views::Link* source,
103 int event_flags) { 103 int event_flags) {
104 delegate_->OnImportBookmarks(); 104 delegate_->OnImportBookmarks();
105 } 105 }
106 106
107 void BookmarkBarInstructionsView::ShowContextMenuForView( 107 void BookmarkBarInstructionsView::ShowContextMenuForView(
108 views::View* source, 108 views::View* source,
109 const gfx::Point& point, 109 const gfx::Point& point,
(...skipping 19 matching lines...) Expand all
129 // underline to make it obvious it's a link. The default color readability 129 // underline to make it obvious it's a link. The default color readability
130 // code (which only adjusts luminance) doesn't work well in this case. 130 // code (which only adjusts luminance) doesn't work well in this case.
131 SkColor bg = theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR); 131 SkColor bg = theme_provider->GetColor(ThemeProperties::COLOR_TOOLBAR);
132 SkColor link_color = 132 SkColor link_color =
133 GetNativeTheme()->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled); 133 GetNativeTheme()->GetSystemColor(ui::NativeTheme::kColorId_LinkEnabled);
134 bool link_has_contrast = color_utils::GetContrastRatio(link_color, bg) >= 134 bool link_has_contrast = color_utils::GetContrastRatio(link_color, bg) >=
135 color_utils::kMinimumReadableContrastRatio; 135 color_utils::kMinimumReadableContrastRatio;
136 import_link_->SetUnderline(!link_has_contrast); 136 import_link_->SetUnderline(!link_has_contrast);
137 import_link_->SetEnabledColor(link_has_contrast ? link_color : text_color); 137 import_link_->SetEnabledColor(link_has_contrast ? link_color : text_color);
138 } 138 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698