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

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

Issue 2423193002: [Mac] Fix Animation Issue With the Security State Decoration (Closed)
Patch Set: Change default value 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 new SaveCreditCardDecoration(command_updater)), 115 new SaveCreditCardDecoration(command_updater)),
116 star_decoration_(new StarDecoration(command_updater)), 116 star_decoration_(new StarDecoration(command_updater)),
117 translate_decoration_(new TranslateDecoration(command_updater)), 117 translate_decoration_(new TranslateDecoration(command_updater)),
118 zoom_decoration_(new ZoomDecoration(this)), 118 zoom_decoration_(new ZoomDecoration(this)),
119 keyword_hint_decoration_(new KeywordHintDecoration()), 119 keyword_hint_decoration_(new KeywordHintDecoration()),
120 manage_passwords_decoration_( 120 manage_passwords_decoration_(
121 new ManagePasswordsDecoration(command_updater, this)), 121 new ManagePasswordsDecoration(command_updater, this)),
122 browser_(browser), 122 browser_(browser),
123 location_bar_visible_(true), 123 location_bar_visible_(true),
124 should_show_secure_verbose_(true), 124 should_show_secure_verbose_(true),
125 should_animate_security_verbose_(true), 125 should_animate_security_verbose_(false),
126 is_width_available_for_security_verbose_(false), 126 is_width_available_for_security_verbose_(false),
127 weak_ptr_factory_(this) { 127 weak_ptr_factory_(this) {
128 ScopedVector<ContentSettingImageModel> models = 128 ScopedVector<ContentSettingImageModel> models =
129 ContentSettingImageModel::GenerateContentSettingImageModels(); 129 ContentSettingImageModel::GenerateContentSettingImageModels();
130 for (ContentSettingImageModel* model : models.get()) { 130 for (ContentSettingImageModel* model : models.get()) {
131 // ContentSettingDecoration takes ownership of its model. 131 // ContentSettingDecoration takes ownership of its model.
132 content_setting_decorations_.push_back( 132 content_setting_decorations_.push_back(
133 new ContentSettingDecoration(model, this, profile)); 133 new ContentSettingDecoration(model, this, profile));
134 } 134 }
135 models.weak_clear(); 135 models.weak_clear();
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 520
521 // Don't change the label if the bubble is in the process of animating 521 // Don't change the label if the bubble is in the process of animating
522 // out the old one. 522 // out the old one.
523 base::string16 label(GetToolbarModel()->GetSecureVerboseText()); 523 base::string16 label(GetToolbarModel()->GetSecureVerboseText());
524 if (!security_state_bubble_decoration_->AnimatingOut()) { 524 if (!security_state_bubble_decoration_->AnimatingOut()) {
525 security_state_bubble_decoration_->SetFullLabel( 525 security_state_bubble_decoration_->SetFullLabel(
526 base::SysUTF16ToNSString(label)); 526 base::SysUTF16ToNSString(label));
527 } 527 }
528 } 528 }
529 529
530 if (!security_state_bubble_decoration_->IsVisible())
531 security_state_bubble_decoration_->ResetAnimation();
532
530 // These need to change anytime the layout changes. 533 // These need to change anytime the layout changes.
531 // TODO(shess): Anytime the field editor might have changed, the 534 // TODO(shess): Anytime the field editor might have changed, the
532 // cursor rects almost certainly should have changed. The tooltips 535 // cursor rects almost certainly should have changed. The tooltips
533 // might change even when the rects don't change. 536 // might change even when the rects don't change.
534 OnDecorationsChanged(); 537 OnDecorationsChanged();
535 } 538 }
536 539
537 void LocationBarViewMac::RedrawDecoration(LocationBarDecoration* decoration) { 540 void LocationBarViewMac::RedrawDecoration(LocationBarDecoration* decoration) {
538 AutocompleteTextFieldCell* cell = [field_ cell]; 541 AutocompleteTextFieldCell* cell = [field_ cell];
539 NSRect frame = [cell frameForDecoration:decoration 542 NSRect frame = [cell frameForDecoration:decoration
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 IsSecureConnection(security_level_); 877 IsSecureConnection(security_level_);
875 bool is_new_security_level = 878 bool is_new_security_level =
876 security_level_ != new_security_level && !is_secure_to_secure; 879 security_level_ != new_security_level && !is_secure_to_secure;
877 security_level_ = new_security_level; 880 security_level_ = new_security_level;
878 881
879 // If there's enough space, but the secure state decoration had animated 882 // If there's enough space, but the secure state decoration had animated
880 // out, animate it back in. Otherwise, if the security state has changed, 883 // out, animate it back in. Otherwise, if the security state has changed,
881 // animate the decoration if animation is enabled and the state changed is 884 // animate the decoration if animation is enabled and the state changed is
882 // not from a tab switch. 885 // not from a tab switch.
883 if (is_width_available_for_security_verbose_) { 886 if (is_width_available_for_security_verbose_) {
884 if (security_state_bubble_decoration_->HasAnimatedOut()) 887 if (!tab_changed && security_state_bubble_decoration_->HasAnimatedOut())
885 security_state_bubble_decoration_->AnimateIn(false); 888 security_state_bubble_decoration_->AnimateIn(false);
886 else if (!should_animate_security_verbose_ || tab_changed) 889 else if (!should_animate_security_verbose_ || tab_changed)
887 security_state_bubble_decoration_->ShowWithoutAnimation(); 890 security_state_bubble_decoration_->ShowWithoutAnimation();
888 else if (is_new_security_level) 891 else if (is_new_security_level)
889 security_state_bubble_decoration_->AnimateIn(); 892 security_state_bubble_decoration_->AnimateIn();
890 } else { 893 } else {
891 // Animate the decoration out if there's not enough space. 894 // Animate the decoration out if there's not enough space.
892 security_state_bubble_decoration_->AnimateOut(); 895 security_state_bubble_decoration_->AnimateOut();
893 } 896 }
894 } 897 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 OnDecorationsChanged(); 932 OnDecorationsChanged();
930 } 933 }
931 934
932 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() { 935 std::vector<NSView*> LocationBarViewMac::GetDecorationAccessibilityViews() {
933 std::vector<LocationBarDecoration*> decorations = GetDecorations(); 936 std::vector<LocationBarDecoration*> decorations = GetDecorations();
934 std::vector<NSView*> views; 937 std::vector<NSView*> views;
935 for (auto* decoration : decorations) 938 for (auto* decoration : decorations)
936 views.push_back(decoration->GetAccessibilityView()); 939 views.push_back(decoration->GetAccessibilityView());
937 return views; 940 return views;
938 } 941 }
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