| 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/metrics/user_metrics.h" | 8 #include "base/metrics/user_metrics.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/timer/timer.h" | 10 #include "base/timer/timer.h" |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 824 bool ManagePasswordsBubbleView::ShouldShowCloseButton() const { | 824 bool ManagePasswordsBubbleView::ShouldShowCloseButton() const { |
| 825 return model_.state() == password_manager::ui::PENDING_PASSWORD_STATE || | 825 return model_.state() == password_manager::ui::PENDING_PASSWORD_STATE || |
| 826 model_.state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE || | 826 model_.state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE || |
| 827 model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; | 827 model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; |
| 828 } | 828 } |
| 829 | 829 |
| 830 void ManagePasswordsBubbleView::Refresh() { | 830 void ManagePasswordsBubbleView::Refresh() { |
| 831 RemoveAllChildViews(true); | 831 RemoveAllChildViews(true); |
| 832 initially_focused_view_ = NULL; | 832 initially_focused_view_ = NULL; |
| 833 CreateChild(); | 833 CreateChild(); |
| 834 | |
| 835 // Show/hide the close button. | 834 // Show/hide the close button. |
| 836 GetWidget()->non_client_view()->ResetWindowControls(); | 835 GetWidget()->non_client_view()->ResetWindowControls(); |
| 837 GetWidget()->UpdateWindowIcon(); | 836 GetWidget()->UpdateWindowIcon(); |
| 838 GetWidget()->UpdateWindowTitle(); | 837 GetWidget()->UpdateWindowTitle(); |
| 839 SizeToContents(); | 838 if (model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
| 839 // Update the height and keep the existing width. |
| 840 gfx::Rect bubble_bounds = GetWidget()->GetWindowBoundsInScreen(); |
| 841 bubble_bounds.set_height( |
| 842 GetWidget()->GetRootView()->GetHeightForWidth(bubble_bounds.width())); |
| 843 GetWidget()->SetBounds(bubble_bounds); |
| 844 } else { |
| 845 SizeToContents(); |
| 846 } |
| 840 } | 847 } |
| 841 | 848 |
| 842 void ManagePasswordsBubbleView::CreateChild() { | 849 void ManagePasswordsBubbleView::CreateChild() { |
| 843 if (model_.state() == password_manager::ui::PENDING_PASSWORD_STATE) { | 850 if (model_.state() == password_manager::ui::PENDING_PASSWORD_STATE) { |
| 844 AddChildView(new PendingView(this)); | 851 AddChildView(new PendingView(this)); |
| 845 } else if (model_.state() == | 852 } else if (model_.state() == |
| 846 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { | 853 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { |
| 847 AddChildView(new UpdatePendingView(this)); | 854 AddChildView(new UpdatePendingView(this)); |
| 848 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) { | 855 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) { |
| 849 AddChildView(new SaveConfirmationView(this)); | 856 AddChildView(new SaveConfirmationView(this)); |
| 850 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 857 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
| 851 AddChildView(new AutoSigninView(this)); | 858 AddChildView(new AutoSigninView(this)); |
| 852 } else if (model_.state() == | 859 } else if (model_.state() == |
| 853 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { | 860 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { |
| 854 AddChildView(new SignInPromoView(this)); | 861 AddChildView(new SignInPromoView(this)); |
| 855 #if defined(OS_WIN) | 862 #if defined(OS_WIN) |
| 856 } else if (model_.state() == | 863 } else if (model_.state() == |
| 857 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 864 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
| 858 AddChildView(new DesktopIOSPromotionBubbleView( | 865 AddChildView(new DesktopIOSPromotionBubbleView( |
| 859 model_.GetProfile(), | 866 model_.GetProfile(), |
| 860 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 867 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
| 861 #endif | 868 #endif |
| 862 } else { | 869 } else { |
| 863 AddChildView(new ManageView(this)); | 870 AddChildView(new ManageView(this)); |
| 864 } | 871 } |
| 865 } | 872 } |
| OLD | NEW |