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

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 1518543002: Adds MD ink ripple animations to buttons within location bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adds MD ink ripple animations to buttons within location bar (missing member init) Created 4 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/passwords/manage_passwords_bubble_view.h" 5 #include "chrome/browser/ui/views/passwords/manage_passwords_bubble_view.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/timer/timer.h" 9 #include "base/timer/timer.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 ManagePasswordsIconViews* anchor_view = 745 ManagePasswordsIconViews* anchor_view =
746 is_fullscreen 746 is_fullscreen
747 ? NULL 747 ? NULL
748 : browser_view->GetLocationBarView()->manage_passwords_icon_view(); 748 : browser_view->GetLocationBarView()->manage_passwords_icon_view();
749 manage_passwords_bubble_ = new ManagePasswordsBubbleView( 749 manage_passwords_bubble_ = new ManagePasswordsBubbleView(
750 web_contents, anchor_view, reason); 750 web_contents, anchor_view, reason);
751 751
752 if (is_fullscreen) 752 if (is_fullscreen)
753 manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView()); 753 manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView());
754 754
755 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_); 755 views::Widget* manage_passwords_bubble_widget =
756 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_);
757 if (anchor_view)
758 manage_passwords_bubble_widget->AddObserver(anchor_view);
756 759
757 // Adjust for fullscreen after creation as it relies on the content size. 760 // Adjust for fullscreen after creation as it relies on the content size.
758 if (is_fullscreen) { 761 if (is_fullscreen) {
759 manage_passwords_bubble_->AdjustForFullscreen( 762 manage_passwords_bubble_->AdjustForFullscreen(
760 browser_view->GetBoundsInScreen()); 763 browser_view->GetBoundsInScreen());
761 } 764 }
762 765
763 manage_passwords_bubble_->ShowForReason(reason); 766 manage_passwords_bubble_->ShowForReason(reason);
764 } 767 }
765 768
766 // static 769 // static
767 void ManagePasswordsBubbleView::CloseBubble() { 770 void ManagePasswordsBubbleView::CloseBubble() {
768 if (manage_passwords_bubble_) 771 if (manage_passwords_bubble_)
769 manage_passwords_bubble_->Close(); 772 manage_passwords_bubble_->Close();
770 } 773 }
771 774
772 // static 775 // static
773 void ManagePasswordsBubbleView::ActivateBubble() { 776 void ManagePasswordsBubbleView::ActivateBubble() {
774 DCHECK(manage_passwords_bubble_); 777 DCHECK(manage_passwords_bubble_);
775 DCHECK(manage_passwords_bubble_->GetWidget()->IsVisible()); 778 DCHECK(manage_passwords_bubble_->GetWidget()->IsVisible());
776 manage_passwords_bubble_->GetWidget()->Activate(); 779 manage_passwords_bubble_->GetWidget()->Activate();
777 } 780 }
778 781
779 content::WebContents* ManagePasswordsBubbleView::web_contents() const { 782 content::WebContents* ManagePasswordsBubbleView::web_contents() const {
780 return model_.web_contents(); 783 return model_.web_contents();
781 } 784 }
782 785
783 ManagePasswordsBubbleView::ManagePasswordsBubbleView( 786 ManagePasswordsBubbleView::ManagePasswordsBubbleView(
784 content::WebContents* web_contents, 787 content::WebContents* web_contents,
785 ManagePasswordsIconViews* anchor_view, 788 views::View* anchor_view,
786 DisplayReason reason) 789 DisplayReason reason)
787 : LocationBarBubbleDelegateView(anchor_view, web_contents), 790 : LocationBarBubbleDelegateView(anchor_view, web_contents),
788 model_(web_contents, 791 model_(web_contents,
789 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC 792 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC
790 : ManagePasswordsBubbleModel::USER_ACTION), 793 : ManagePasswordsBubbleModel::USER_ACTION),
791 anchor_view_(anchor_view),
792 initially_focused_view_(nullptr) { 794 initially_focused_view_(nullptr) {
793 // Compensate for built-in vertical padding in the anchor view's image. 795 // Compensate for built-in vertical padding in the anchor view's image.
794 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); 796 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0));
795 797
796 const int top_margin = ShouldShowCloseButton() ? margins().top() 798 const int top_margin = ShouldShowCloseButton() ? margins().top()
797 : views::kPanelVertMargin; 799 : views::kPanelVertMargin;
798 set_margins(gfx::Insets(top_margin, views::kPanelHorizMargin, 800 set_margins(gfx::Insets(top_margin, views::kPanelHorizMargin,
799 views::kPanelVertMargin, views::kPanelHorizMargin)); 801 views::kPanelVertMargin, views::kPanelHorizMargin));
800 mouse_handler_.reset(new WebContentMouseHandler(this)); 802 mouse_handler_.reset(new WebContentMouseHandler(this));
801 } 803 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
835 AddChildView(new UpdatePendingView(this)); 837 AddChildView(new UpdatePendingView(this));
836 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) { 838 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) {
837 AddChildView(new SaveConfirmationView(this)); 839 AddChildView(new SaveConfirmationView(this));
838 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { 840 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) {
839 AddChildView(new AutoSigninView(this)); 841 AddChildView(new AutoSigninView(this));
840 } else { 842 } else {
841 AddChildView(new ManageView(this)); 843 AddChildView(new ManageView(this));
842 } 844 }
843 GetLayoutManager()->Layout(this); 845 GetLayoutManager()->Layout(this);
844 } 846 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698