| 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" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "chrome/browser/ui/browser_finder.h" | 12 #include "chrome/browser/ui/browser_finder.h" |
| 13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" | 13 #include "chrome/browser/ui/exclusive_access/fullscreen_controller.h" |
| 14 #include "chrome/browser/ui/passwords/passwords_model_delegate.h" |
| 14 #include "chrome/browser/ui/views/frame/browser_view.h" | 15 #include "chrome/browser/ui/views/frame/browser_view.h" |
| 15 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" | 16 #include "chrome/browser/ui/views/passwords/credentials_item_view.h" |
| 16 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" | 17 #include "chrome/browser/ui/views/passwords/credentials_selection_view.h" |
| 17 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" | 18 #include "chrome/browser/ui/views/passwords/manage_password_items_view.h" |
| 18 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" | 19 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h" |
| 19 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
| 20 #include "content/public/browser/user_metrics.h" | 21 #include "content/public/browser/user_metrics.h" |
| 21 #include "grit/components_strings.h" | 22 #include "grit/components_strings.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "ui/base/material_design/material_design_controller.h" | 24 #include "ui/base/material_design/material_design_controller.h" |
| (...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 764 } | 765 } |
| 765 | 766 |
| 766 // static | 767 // static |
| 767 void ManagePasswordsBubbleView::ActivateBubble() { | 768 void ManagePasswordsBubbleView::ActivateBubble() { |
| 768 DCHECK(manage_passwords_bubble_); | 769 DCHECK(manage_passwords_bubble_); |
| 769 DCHECK(manage_passwords_bubble_->GetWidget()->IsVisible()); | 770 DCHECK(manage_passwords_bubble_->GetWidget()->IsVisible()); |
| 770 manage_passwords_bubble_->GetWidget()->Activate(); | 771 manage_passwords_bubble_->GetWidget()->Activate(); |
| 771 } | 772 } |
| 772 | 773 |
| 773 content::WebContents* ManagePasswordsBubbleView::web_contents() const { | 774 content::WebContents* ManagePasswordsBubbleView::web_contents() const { |
| 774 return model_.web_contents(); | 775 return model_.GetWebContents(); |
| 775 } | 776 } |
| 776 | 777 |
| 777 ManagePasswordsBubbleView::ManagePasswordsBubbleView( | 778 ManagePasswordsBubbleView::ManagePasswordsBubbleView( |
| 778 content::WebContents* web_contents, | 779 content::WebContents* web_contents, |
| 779 views::View* anchor_view, | 780 views::View* anchor_view, |
| 780 DisplayReason reason) | 781 DisplayReason reason) |
| 781 : LocationBarBubbleDelegateView(anchor_view, web_contents), | 782 : LocationBarBubbleDelegateView(anchor_view, web_contents), |
| 782 model_(web_contents, | 783 model_(PasswordsModelDelegateFromWebContents(web_contents), |
| 783 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC | 784 reason == AUTOMATIC ? ManagePasswordsBubbleModel::AUTOMATIC |
| 784 : ManagePasswordsBubbleModel::USER_ACTION), | 785 : ManagePasswordsBubbleModel::USER_ACTION), |
| 785 initially_focused_view_(nullptr) { | 786 initially_focused_view_(nullptr) { |
| 786 mouse_handler_.reset(new WebContentMouseHandler(this, this->web_contents())); | 787 mouse_handler_.reset(new WebContentMouseHandler(this, this->web_contents())); |
| 787 } | 788 } |
| 788 | 789 |
| 789 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { | 790 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { |
| 790 if (manage_passwords_bubble_ == this) | 791 if (manage_passwords_bubble_ == this) |
| 791 manage_passwords_bubble_ = NULL; | 792 manage_passwords_bubble_ = NULL; |
| 792 } | 793 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 843 AddChildView(new SaveConfirmationView(this)); | 844 AddChildView(new SaveConfirmationView(this)); |
| 844 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 845 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
| 845 AddChildView(new AutoSigninView(this)); | 846 AddChildView(new AutoSigninView(this)); |
| 846 } else if (model_.state() == | 847 } else if (model_.state() == |
| 847 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { | 848 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { |
| 848 AddChildView(new SignInPromoView(this)); | 849 AddChildView(new SignInPromoView(this)); |
| 849 } else { | 850 } else { |
| 850 AddChildView(new ManageView(this)); | 851 AddChildView(new ManageView(this)); |
| 851 } | 852 } |
| 852 } | 853 } |
| OLD | NEW |