Chromium Code Reviews| 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 811 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 822 return model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; | 822 return model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; |
| 823 } | 823 } |
| 824 | 824 |
| 825 bool ManagePasswordsBubbleView::ShouldShowCloseButton() const { | 825 bool ManagePasswordsBubbleView::ShouldShowCloseButton() const { |
| 826 return model_.state() == password_manager::ui::PENDING_PASSWORD_STATE || | 826 return model_.state() == password_manager::ui::PENDING_PASSWORD_STATE || |
| 827 model_.state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE || | 827 model_.state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE || |
| 828 model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; | 828 model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; |
| 829 } | 829 } |
| 830 | 830 |
| 831 void ManagePasswordsBubbleView::Refresh() { | 831 void ManagePasswordsBubbleView::Refresh() { |
| 832 gfx::Rect bubble_bounds = GetBubbleBounds(); | |
| 832 RemoveAllChildViews(true); | 833 RemoveAllChildViews(true); |
| 833 initially_focused_view_ = NULL; | 834 initially_focused_view_ = NULL; |
| 834 CreateChild(); | 835 CreateChild(); |
| 835 | |
| 836 // Show/hide the close button. | 836 // Show/hide the close button. |
| 837 GetWidget()->non_client_view()->ResetWindowControls(); | 837 GetWidget()->non_client_view()->ResetWindowControls(); |
| 838 GetWidget()->UpdateWindowIcon(); | 838 GetWidget()->UpdateWindowIcon(); |
| 839 GetWidget()->UpdateWindowTitle(); | 839 GetWidget()->UpdateWindowTitle(); |
| 840 SizeToContents(); | 840 if (model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
| 841 // Update the height and keep the existing width. | |
| 842 bubble_bounds.set_height( | |
| 843 GetWidget()->GetRootView()->GetHeightForWidth(bubble_bounds.width())); | |
| 844 GetWidget()->SetBounds(bubble_bounds); | |
| 845 GetWidget()->GetRootView()->Layout(); | |
|
vasilii
2017/04/18 14:44:25
Is it needed?
mrefaat
2017/04/18 17:01:09
removed.
| |
| 846 } else { | |
| 847 SizeToContents(); | |
| 848 } | |
| 841 } | 849 } |
| 842 | 850 |
| 843 void ManagePasswordsBubbleView::CreateChild() { | 851 void ManagePasswordsBubbleView::CreateChild() { |
| 844 if (model_.state() == password_manager::ui::PENDING_PASSWORD_STATE) { | 852 if (model_.state() == password_manager::ui::PENDING_PASSWORD_STATE) { |
| 845 AddChildView(new PendingView(this)); | 853 AddChildView(new PendingView(this)); |
| 846 } else if (model_.state() == | 854 } else if (model_.state() == |
| 847 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { | 855 password_manager::ui::PENDING_PASSWORD_UPDATE_STATE) { |
| 848 AddChildView(new UpdatePendingView(this)); | 856 AddChildView(new UpdatePendingView(this)); |
| 849 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) { | 857 } else if (model_.state() == password_manager::ui::CONFIRMATION_STATE) { |
| 850 AddChildView(new SaveConfirmationView(this)); | 858 AddChildView(new SaveConfirmationView(this)); |
| 851 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { | 859 } else if (model_.state() == password_manager::ui::AUTO_SIGNIN_STATE) { |
| 852 AddChildView(new AutoSigninView(this)); | 860 AddChildView(new AutoSigninView(this)); |
| 853 } else if (model_.state() == | 861 } else if (model_.state() == |
| 854 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { | 862 password_manager::ui::CHROME_SIGN_IN_PROMO_STATE) { |
| 855 AddChildView(new SignInPromoView(this)); | 863 AddChildView(new SignInPromoView(this)); |
| 856 #if defined(OS_WIN) | 864 #if defined(OS_WIN) |
| 857 } else if (model_.state() == | 865 } else if (model_.state() == |
| 858 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 866 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
| 859 AddChildView(new DesktopIOSPromotionBubbleView( | 867 AddChildView(new DesktopIOSPromotionBubbleView( |
| 860 model_.GetProfile(), | 868 model_.GetProfile(), |
| 861 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 869 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
| 862 #endif | 870 #endif |
| 863 } else { | 871 } else { |
| 864 AddChildView(new ManageView(this)); | 872 AddChildView(new ManageView(this)); |
| 865 } | 873 } |
| 866 } | 874 } |
| OLD | NEW |