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

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

Issue 2408253002: [Mac] Fix Animation Issue With the Security State Decoration (Closed)
Patch Set: Fixed something with the tab Created 4 years, 2 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
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #import "base/mac/mac_util.h" 9 #import "base/mac/mac_util.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 523
524 // Don't change the label if the bubble is in the process of animating 524 // Don't change the label if the bubble is in the process of animating
525 // out the old one. 525 // out the old one.
526 base::string16 label(GetToolbarModel()->GetSecureVerboseText()); 526 base::string16 label(GetToolbarModel()->GetSecureVerboseText());
527 if (!security_state_bubble_decoration_->AnimatingOut()) { 527 if (!security_state_bubble_decoration_->AnimatingOut()) {
528 security_state_bubble_decoration_->SetFullLabel( 528 security_state_bubble_decoration_->SetFullLabel(
529 base::SysUTF16ToNSString(label)); 529 base::SysUTF16ToNSString(label));
530 } 530 }
531 } 531 }
532 532
533 if (!security_state_bubble_decoration_->IsVisible())
534 security_state_bubble_decoration_->ResetAnimation();
535
533 // These need to change anytime the layout changes. 536 // These need to change anytime the layout changes.
534 // TODO(shess): Anytime the field editor might have changed, the 537 // TODO(shess): Anytime the field editor might have changed, the
535 // cursor rects almost certainly should have changed. The tooltips 538 // cursor rects almost certainly should have changed. The tooltips
536 // might change even when the rects don't change. 539 // might change even when the rects don't change.
537 OnDecorationsChanged(); 540 OnDecorationsChanged();
538 } 541 }
539 542
540 void LocationBarViewMac::RedrawDecoration(LocationBarDecoration* decoration) { 543 void LocationBarViewMac::RedrawDecoration(LocationBarDecoration* decoration) {
541 AutocompleteTextFieldCell* cell = [field_ cell]; 544 AutocompleteTextFieldCell* cell = [field_ cell];
542 NSRect frame = [cell frameForDecoration:decoration 545 NSRect frame = [cell frameForDecoration:decoration
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 887
885 // If there's enough space, but the secure state decoration had animated 888 // If there's enough space, but the secure state decoration had animated
886 // out, animate it back in. Otherwise, if the security state has changed, 889 // out, animate it back in. Otherwise, if the security state has changed,
887 // animate the decoration if animation is enabled and the state changed is 890 // animate the decoration if animation is enabled and the state changed is
888 // not from a tab switch. 891 // not from a tab switch.
889 if (is_width_available_for_security_verbose_) { 892 if (is_width_available_for_security_verbose_) {
890 bool is_animated = 893 bool is_animated =
891 (is_new_level_secure && should_animate_secure_verbose_) || 894 (is_new_level_secure && should_animate_secure_verbose_) ||
892 (!is_new_level_secure && should_animate_nonsecure_verbose_); 895 (!is_new_level_secure && should_animate_nonsecure_verbose_);
893 896
894 if (security_state_bubble_decoration_->HasAnimatedOut()) 897 if (!tab_changed && security_state_bubble_decoration_->HasAnimatedOut())
895 security_state_bubble_decoration_->AnimateIn(false); 898 security_state_bubble_decoration_->AnimateIn(false);
896 else if (tab_changed || !is_animated) 899 else if (tab_changed || !is_animated)
897 security_state_bubble_decoration_->ShowWithoutAnimation(); 900 security_state_bubble_decoration_->ShowWithoutAnimation();
898 else if (is_new_security_level) 901 else if (is_new_security_level)
899 security_state_bubble_decoration_->AnimateIn(); 902 security_state_bubble_decoration_->AnimateIn();
900 } else { 903 } else {
901 // Animate the decoration out if there's not enough space. 904 // Animate the decoration out if there's not enough space.
902 security_state_bubble_decoration_->AnimateOut(); 905 security_state_bubble_decoration_->AnimateOut();
903 } 906 }
904 } 907 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 OnDecorationsChanged(); 942 OnDecorationsChanged();
940 } 943 }
941 944
942 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { 945 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() {
943 std::vector<LocationBarDecoration*> decorations = GetDecorations(); 946 std::vector<LocationBarDecoration*> decorations = GetDecorations();
944 std::vector<NSView*> views; 947 std::vector<NSView*> views;
945 for (auto* decoration : decorations) 948 for (auto* decoration : decorations)
946 views.push_back(decoration->GetAccessibilityView()); 949 views.push_back(decoration->GetAccessibilityView());
947 return views; 950 return views;
948 } 951 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698