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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 2841963002: cocoa: fix a11y labeling & state on search icon (Closed)
Patch Set: Created 3 years, 7 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #import "base/mac/mac_util.h" 8 #import "base/mac/mac_util.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 327
328 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { 328 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const {
329 return [field_ bubblePointForDecoration:GetPageInfoDecoration()]; 329 return [field_ bubblePointForDecoration:GetPageInfoDecoration()];
330 } 330 }
331 331
332 void LocationBarViewMac::OnDecorationsChanged() { 332 void LocationBarViewMac::OnDecorationsChanged() {
333 // TODO(shess): The field-editor frame and cursor rects should not 333 // TODO(shess): The field-editor frame and cursor rects should not
334 // change, here. 334 // change, here.
335 std::vector<LocationBarDecoration*> decorations = GetDecorations(); 335 std::vector<LocationBarDecoration*> decorations = GetDecorations();
336 for (auto* decoration : decorations) 336 for (auto* decoration : decorations)
337 UpdateAccessibilityViewPosition(decoration); 337 UpdateAccessibilityView(decoration);
338 [field_ updateMouseTracking]; 338 [field_ updateMouseTracking];
339 [field_ resetFieldEditorFrameIfNeeded]; 339 [field_ resetFieldEditorFrameIfNeeded];
340 [field_ setNeedsDisplay:YES]; 340 [field_ setNeedsDisplay:YES];
341 } 341 }
342 342
343 // TODO(shess): This function should over time grow to closely match 343 // TODO(shess): This function should over time grow to closely match
344 // the views Layout() function. 344 // the views Layout() function.
345 void LocationBarViewMac::Layout() { 345 void LocationBarViewMac::Layout() {
346 AutocompleteTextFieldCell* cell = [field_ cell]; 346 AutocompleteTextFieldCell* cell = [field_ cell];
347 347
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 (level == security_state::DANGEROUS || 731 (level == security_state::DANGEROUS ||
732 level == security_state::HTTP_SHOW_WARNING); 732 level == security_state::HTTP_SHOW_WARNING);
733 } 733 }
734 734
735 bool LocationBarViewMac::IsSecureConnection( 735 bool LocationBarViewMac::IsSecureConnection(
736 security_state::SecurityLevel level) const { 736 security_state::SecurityLevel level) const {
737 return level == security_state::SECURE || 737 return level == security_state::SECURE ||
738 level == security_state::EV_SECURE; 738 level == security_state::EV_SECURE;
739 } 739 }
740 740
741 void LocationBarViewMac::UpdateAccessibilityViewPosition( 741 void LocationBarViewMac::UpdateAccessibilityView(
742 LocationBarDecoration* decoration) { 742 LocationBarDecoration* decoration) {
743 if (!decoration->IsVisible()) 743 if (!decoration->IsVisible())
744 return; 744 return;
745 NSRect r = 745 NSRect r =
746 [[field_ cell] frameForDecoration:decoration inFrame:[field_ frame]]; 746 [[field_ cell] frameForDecoration:decoration inFrame:[field_ frame]];
747 [decoration->GetAccessibilityView() setFrame:r]; 747 [decoration->GetAccessibilityView() setFrame:r];
748 [decoration->GetAccessibilityView() setNeedsDisplayInRect:r]; 748 [decoration->GetAccessibilityView() setNeedsDisplayInRect:r];
749 decoration->UpdateAccessibilityView();
749 } 750 }
750 751
751 std::vector<LocationBarDecoration*> LocationBarViewMac::GetDecorations() { 752 std::vector<LocationBarDecoration*> LocationBarViewMac::GetDecorations() {
752 std::vector<LocationBarDecoration*> decorations; 753 std::vector<LocationBarDecoration*> decorations;
753 // TODO(ellyjones): content setting decorations aren't included right now, nor 754 // TODO(ellyjones): content setting decorations aren't included right now, nor
754 // are page actions and the keyword hint. 755 // are page actions and the keyword hint.
755 decorations.push_back(location_icon_decoration_.get()); 756 decorations.push_back(location_icon_decoration_.get());
756 decorations.push_back(selected_keyword_decoration_.get()); 757 decorations.push_back(selected_keyword_decoration_.get());
757 decorations.push_back(security_state_bubble_decoration_.get()); 758 decorations.push_back(security_state_bubble_decoration_.get());
758 decorations.push_back(save_credit_card_decoration_.get()); 759 decorations.push_back(save_credit_card_decoration_.get());
759 decorations.push_back(star_decoration_.get()); 760 decorations.push_back(star_decoration_.get());
760 decorations.push_back(translate_decoration_.get()); 761 decorations.push_back(translate_decoration_.get());
761 decorations.push_back(zoom_decoration_.get()); 762 decorations.push_back(zoom_decoration_.get());
762 decorations.push_back(manage_passwords_decoration_.get()); 763 decorations.push_back(manage_passwords_decoration_.get());
763 return decorations; 764 return decorations;
764 } 765 }
765 766
766 void LocationBarViewMac::OnDefaultZoomLevelChanged() { 767 void LocationBarViewMac::OnDefaultZoomLevelChanged() {
767 if (UpdateZoomDecoration(/*default_zoom_changed=*/true)) 768 if (UpdateZoomDecoration(/*default_zoom_changed=*/true))
768 OnDecorationsChanged(); 769 OnDecorationsChanged();
769 } 770 }
770 771
771 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { 772 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() {
772 std::vector<LocationBarDecoration*> decorations = GetDecorations(); 773 std::vector<LocationBarDecoration*> decorations = GetDecorations();
773 std::vector<NSView*> views; 774 std::vector<NSView*> views;
774 for (auto* decoration : decorations) 775 for (auto* decoration : decorations)
775 views.push_back(decoration->GetAccessibilityView()); 776 views.push_back(decoration->GetAccessibilityView());
776 return views; 777 return views;
777 } 778 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698