| 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 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 732 is_fullscreen | 732 is_fullscreen |
| 733 ? NULL | 733 ? NULL |
| 734 : browser_view->GetLocationBarView()->manage_passwords_icon_view(); | 734 : browser_view->GetLocationBarView()->manage_passwords_icon_view(); |
| 735 manage_passwords_bubble_ = new ManagePasswordsBubbleView( | 735 manage_passwords_bubble_ = new ManagePasswordsBubbleView( |
| 736 web_contents, anchor_view, reason); | 736 web_contents, anchor_view, reason); |
| 737 | 737 |
| 738 if (is_fullscreen) | 738 if (is_fullscreen) |
| 739 manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView()); | 739 manage_passwords_bubble_->set_parent_window(web_contents->GetNativeView()); |
| 740 | 740 |
| 741 views::Widget* manage_passwords_bubble_widget = | 741 views::Widget* manage_passwords_bubble_widget = |
| 742 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_); | 742 views::BubbleDialogDelegateView::CreateBubble(manage_passwords_bubble_); |
| 743 if (anchor_view) | 743 if (anchor_view) |
| 744 manage_passwords_bubble_widget->AddObserver(anchor_view); | 744 manage_passwords_bubble_widget->AddObserver(anchor_view); |
| 745 | 745 |
| 746 // Adjust for fullscreen after creation as it relies on the content size. | 746 // Adjust for fullscreen after creation as it relies on the content size. |
| 747 if (is_fullscreen) { | 747 if (is_fullscreen) { |
| 748 manage_passwords_bubble_->AdjustForFullscreen( | 748 manage_passwords_bubble_->AdjustForFullscreen( |
| 749 browser_view->GetBoundsInScreen()); | 749 browser_view->GetBoundsInScreen()); |
| 750 } | 750 } |
| 751 | 751 |
| 752 manage_passwords_bubble_->ShowForReason(reason); | 752 manage_passwords_bubble_->ShowForReason(reason); |
| 753 } | 753 } |
| 754 | 754 |
| 755 // static | 755 // static |
| 756 void ManagePasswordsBubbleView::CloseBubble() { | 756 void ManagePasswordsBubbleView::CloseCurrentBubble() { |
| 757 if (manage_passwords_bubble_) | 757 if (manage_passwords_bubble_) |
| 758 manage_passwords_bubble_->Close(); | 758 manage_passwords_bubble_->CloseBubble(); |
| 759 } | 759 } |
| 760 | 760 |
| 761 // static | 761 // static |
| 762 void ManagePasswordsBubbleView::ActivateBubble() { | 762 void ManagePasswordsBubbleView::ActivateBubble() { |
| 763 DCHECK(manage_passwords_bubble_); | 763 DCHECK(manage_passwords_bubble_); |
| 764 DCHECK(manage_passwords_bubble_->GetWidget()->IsVisible()); | 764 DCHECK(manage_passwords_bubble_->GetWidget()->IsVisible()); |
| 765 manage_passwords_bubble_->GetWidget()->Activate(); | 765 manage_passwords_bubble_->GetWidget()->Activate(); |
| 766 } | 766 } |
| 767 | 767 |
| 768 content::WebContents* ManagePasswordsBubbleView::web_contents() const { | 768 content::WebContents* ManagePasswordsBubbleView::web_contents() const { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 793 return initially_focused_view_; | 793 return initially_focused_view_; |
| 794 } | 794 } |
| 795 | 795 |
| 796 void ManagePasswordsBubbleView::Init() { | 796 void ManagePasswordsBubbleView::Init() { |
| 797 views::FillLayout* layout = new views::FillLayout(); | 797 views::FillLayout* layout = new views::FillLayout(); |
| 798 SetLayoutManager(layout); | 798 SetLayoutManager(layout); |
| 799 | 799 |
| 800 Refresh(); | 800 Refresh(); |
| 801 } | 801 } |
| 802 | 802 |
| 803 void ManagePasswordsBubbleView::Close() { | 803 void ManagePasswordsBubbleView::CloseBubble() { |
| 804 mouse_handler_.reset(); | 804 mouse_handler_.reset(); |
| 805 LocationBarBubbleDelegateView::Close(); | 805 LocationBarBubbleDelegateView::CloseBubble(); |
| 806 } | 806 } |
| 807 | 807 |
| 808 base::string16 ManagePasswordsBubbleView::GetWindowTitle() const { | 808 base::string16 ManagePasswordsBubbleView::GetWindowTitle() const { |
| 809 return model_.title(); | 809 return model_.title(); |
| 810 } | 810 } |
| 811 | 811 |
| 812 bool ManagePasswordsBubbleView::ShouldShowWindowTitle() const { | 812 bool ManagePasswordsBubbleView::ShouldShowWindowTitle() const { |
| 813 // Since bubble titles don't support links, fall back to a custom title view | 813 // Since bubble titles don't support links, fall back to a custom title view |
| 814 // if we need to show a link. Only use the normal title path if there's no | 814 // if we need to show a link. Only use the normal title path if there's no |
| 815 // link. | 815 // link. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 832 AddChildView(new SaveConfirmationView(this)); | 832 AddChildView(new SaveConfirmationView(this)); |
| 833 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 833 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
| 834 AddChildView(new AutoSigninView(this)); | 834 AddChildView(new AutoSigninView(this)); |
| 835 } else { | 835 } else { |
| 836 AddChildView(new ManageView(this)); | 836 AddChildView(new ManageView(this)); |
| 837 } | 837 } |
| 838 if (GetWidget()) | 838 if (GetWidget()) |
| 839 GetWidget()->UpdateWindowTitle(); | 839 GetWidget()->UpdateWindowTitle(); |
| 840 GetLayoutManager()->Layout(this); | 840 GetLayoutManager()->Layout(this); |
| 841 } | 841 } |
| OLD | NEW |