| OLD | NEW |
| 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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 713 content::WebContents* web_contents, | 713 content::WebContents* web_contents, |
| 714 DisplayReason reason) { | 714 DisplayReason reason) { |
| 715 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 715 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 716 DCHECK(browser); | 716 DCHECK(browser); |
| 717 DCHECK(browser->window()); | 717 DCHECK(browser->window()); |
| 718 DCHECK(!manage_passwords_bubble_ || | 718 DCHECK(!manage_passwords_bubble_ || |
| 719 !manage_passwords_bubble_->GetWidget()->IsVisible()); | 719 !manage_passwords_bubble_->GetWidget()->IsVisible()); |
| 720 | 720 |
| 721 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); | 721 BrowserView* browser_view = BrowserView::GetBrowserViewForBrowser(browser); |
| 722 bool is_fullscreen = browser_view->IsFullscreen(); | 722 bool is_fullscreen = browser_view->IsFullscreen(); |
| 723 ManagePasswordsIconViews* anchor_view = | 723 views::View* anchor_view = nullptr; |
| 724 is_fullscreen | 724 if (!is_fullscreen) { |
| 725 ? NULL | 725 if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { |
| 726 : browser_view->GetLocationBarView()->manage_passwords_icon_view(); | 726 anchor_view = browser_view->GetLocationBarView(); |
| 727 } else { |
| 728 anchor_view = |
| 729 browser_view->GetLocationBarView()->manage_passwords_icon_view(); |
| 730 } |
| 731 } |
| 727 manage_passwords_bubble_ = new ManagePasswordsBubbleView( | 732 manage_passwords_bubble_ = new ManagePasswordsBubbleView( |
| 728 web_contents, anchor_view, reason); | 733 web_contents, anchor_view, reason); |
| 729 | 734 |
| 730 if (is_fullscreen) | 735 if (is_fullscreen) |
| 731 manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView()); | 736 manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView()); |
| 732 | 737 |
| 733 views::Widget* manage_passwords_bubble_widget = | 738 views::Widget* manage_passwords_bubble_widget = |
| 734 views::BubbleDialogDelegateView::CreateBubble(manage_passwords_bubble_); | 739 views::BubbleDialogDelegateView::CreateBubble(manage_passwords_bubble_); |
| 735 if (anchor_view) | 740 if (anchor_view) { |
| 736 manage_passwords_bubble_widget->AddObserver(anchor_view); | 741 manage_passwords_bubble_widget->AddObserver( |
| 742 browser_view->GetLocationBarView()->manage_passwords_icon_view()); |
| 743 } |
| 737 | 744 |
| 738 // Adjust for fullscreen after creation as it relies on the content size. | 745 // Adjust for fullscreen after creation as it relies on the content size. |
| 739 if (is_fullscreen) { | 746 if (is_fullscreen) { |
| 740 manage_passwords_bubble_->AdjustForFullscreen( | 747 manage_passwords_bubble_->AdjustForFullscreen( |
| 741 browser_view->GetBoundsInScreen()); | 748 browser_view->GetBoundsInScreen()); |
| 742 } | 749 } |
| 743 | 750 |
| 744 manage_passwords_bubble_->ShowForReason(reason); | 751 manage_passwords_bubble_->ShowForReason(reason); |
| 745 } | 752 } |
| 746 | 753 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 AddChildView(new SaveConfirmationView(this)); | 837 AddChildView(new SaveConfirmationView(this)); |
| 831 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 838 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
| 832 AddChildView(new AutoSigninView(this)); | 839 AddChildView(new AutoSigninView(this)); |
| 833 } else if (model_.state() == | 840 } else if (model_.state() == |
| 834 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { | 841 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { |
| 835 AddChildView(new SignInPromoView(this)); | 842 AddChildView(new SignInPromoView(this)); |
| 836 } else { | 843 } else { |
| 837 AddChildView(new ManageView(this)); | 844 AddChildView(new ManageView(this)); |
| 838 } | 845 } |
| 839 } | 846 } |
| OLD | NEW |