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 15 matching lines...) Expand all Loading... |
26 #include "chrome/grit/generated_resources.h" | 26 #include "chrome/grit/generated_resources.h" |
27 #include "components/password_manager/core/common/password_manager_features.h" | 27 #include "components/password_manager/core/common/password_manager_features.h" |
28 #include "components/strings/grit/components_strings.h" | 28 #include "components/strings/grit/components_strings.h" |
29 #include "ui/base/l10n/l10n_util.h" | 29 #include "ui/base/l10n/l10n_util.h" |
30 #include "ui/base/material_design/material_design_controller.h" | 30 #include "ui/base/material_design/material_design_controller.h" |
31 #include "ui/base/resource/resource_bundle.h" | 31 #include "ui/base/resource/resource_bundle.h" |
32 #include "ui/base/ui_features.h" | 32 #include "ui/base/ui_features.h" |
33 #include "ui/gfx/color_palette.h" | 33 #include "ui/gfx/color_palette.h" |
34 #include "ui/gfx/image/image_skia.h" | 34 #include "ui/gfx/image/image_skia.h" |
35 #include "ui/native_theme/native_theme.h" | 35 #include "ui/native_theme/native_theme.h" |
| 36 #include "ui/views/bubble/bubble_frame_view.h" |
36 #include "ui/views/controls/button/blue_button.h" | 37 #include "ui/views/controls/button/blue_button.h" |
37 #include "ui/views/controls/button/md_text_button.h" | 38 #include "ui/views/controls/button/md_text_button.h" |
38 #include "ui/views/controls/link.h" | 39 #include "ui/views/controls/link.h" |
39 #include "ui/views/controls/link_listener.h" | 40 #include "ui/views/controls/link_listener.h" |
40 #include "ui/views/controls/separator.h" | 41 #include "ui/views/controls/separator.h" |
41 #include "ui/views/controls/styled_label.h" | 42 #include "ui/views/controls/styled_label.h" |
42 #include "ui/views/controls/styled_label_listener.h" | |
43 #include "ui/views/layout/fill_layout.h" | 43 #include "ui/views/layout/fill_layout.h" |
44 #include "ui/views/layout/grid_layout.h" | 44 #include "ui/views/layout/grid_layout.h" |
45 #include "ui/views/widget/widget.h" | 45 #include "ui/views/widget/widget.h" |
46 | 46 |
47 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) | 47 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) |
48 #include "chrome/browser/ui/views/frame/browser_view.h" | 48 #include "chrome/browser/ui/views/frame/browser_view.h" |
49 #endif | 49 #endif |
50 | 50 |
51 #if defined(OS_WIN) | 51 #if defined(OS_WIN) |
52 #include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bu
bble_view.h" | 52 #include "chrome/browser/ui/views/desktop_ios_promotion/desktop_ios_promotion_bu
bble_view.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 break; | 164 break; |
165 } | 165 } |
166 } | 166 } |
167 | 167 |
168 views::StyledLabel::RangeStyleInfo GetLinkStyle() { | 168 views::StyledLabel::RangeStyleInfo GetLinkStyle() { |
169 auto result = views::StyledLabel::RangeStyleInfo::CreateForLink(); | 169 auto result = views::StyledLabel::RangeStyleInfo::CreateForLink(); |
170 result.disable_line_wrapping = false; | 170 result.disable_line_wrapping = false; |
171 return result; | 171 return result; |
172 } | 172 } |
173 | 173 |
174 // If a special title is required (i.e. one that contains links), creates a | |
175 // title view and a row for it in |layout|. | |
176 // TODO(estade): this should be removed and a replaced by a normal title (via | |
177 // GetWindowTitle). | |
178 void AddTitleRowWithLink(views::GridLayout* layout, | |
179 ManagePasswordsBubbleModel* model, | |
180 views::StyledLabelListener* listener) { | |
181 if (model->title_brand_link_range().is_empty()) | |
182 return; | |
183 | |
184 views::StyledLabel* title_label = | |
185 new views::StyledLabel(model->title(), listener); | |
186 title_label->SetBaseFontList(views::style::GetFont( | |
187 views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY)); | |
188 title_label->AddStyleRange(model->title_brand_link_range(), GetLinkStyle()); | |
189 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | |
190 layout->AddView(title_label); | |
191 layout->AddPaddingRow(0, ChromeLayoutProvider::Get() | |
192 ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS) | |
193 .top()); | |
194 } | |
195 | |
196 } // namespace | 174 } // namespace |
197 | 175 |
198 // ManagePasswordsBubbleView::AutoSigninView ---------------------------------- | 176 // ManagePasswordsBubbleView::AutoSigninView ---------------------------------- |
199 | 177 |
200 // A view containing just one credential that was used for for automatic signing | 178 // A view containing just one credential that was used for for automatic signing |
201 // in. | 179 // in. |
202 class ManagePasswordsBubbleView::AutoSigninView | 180 class ManagePasswordsBubbleView::AutoSigninView |
203 : public views::View, | 181 : public views::View, |
204 public views::ButtonListener, | 182 public views::ButtonListener, |
205 public views::WidgetObserver { | 183 public views::WidgetObserver { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 void ManagePasswordsBubbleView::AutoSigninView::OnTimer() { | 262 void ManagePasswordsBubbleView::AutoSigninView::OnTimer() { |
285 parent_->model()->OnAutoSignInToastTimeout(); | 263 parent_->model()->OnAutoSignInToastTimeout(); |
286 parent_->CloseBubble(); | 264 parent_->CloseBubble(); |
287 } | 265 } |
288 | 266 |
289 // ManagePasswordsBubbleView::PendingView ------------------------------------- | 267 // ManagePasswordsBubbleView::PendingView ------------------------------------- |
290 | 268 |
291 // A view offering the user the ability to save credentials. Contains a | 269 // A view offering the user the ability to save credentials. Contains a |
292 // single ManagePasswordItemsView, along with a "Save Passwords" button, | 270 // single ManagePasswordItemsView, along with a "Save Passwords" button, |
293 // a "Never" button and an "Edit" button to edit username field. | 271 // a "Never" button and an "Edit" button to edit username field. |
294 class ManagePasswordsBubbleView::PendingView | 272 class ManagePasswordsBubbleView::PendingView : public views::View, |
295 : public views::View, | 273 public views::ButtonListener { |
296 public views::ButtonListener, | |
297 public views::StyledLabelListener { | |
298 public: | 274 public: |
299 explicit PendingView(ManagePasswordsBubbleView* parent); | 275 explicit PendingView(ManagePasswordsBubbleView* parent); |
300 ~PendingView() override; | 276 ~PendingView() override; |
301 | 277 |
302 private: | 278 private: |
303 // views::ButtonListener: | 279 // views::ButtonListener: |
304 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 280 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
305 | 281 |
306 // views::StyledLabelListener: | |
307 void StyledLabelLinkClicked(views::StyledLabel* label, | |
308 const gfx::Range& range, | |
309 int event_flags) override; | |
310 | |
311 ManagePasswordsBubbleView* parent_; | 282 ManagePasswordsBubbleView* parent_; |
312 | 283 |
313 views::Button* edit_button_; | 284 views::Button* edit_button_; |
314 views::Button* save_button_; | 285 views::Button* save_button_; |
315 views::Button* never_button_; | 286 views::Button* never_button_; |
316 | 287 |
317 DISALLOW_COPY_AND_ASSIGN(PendingView); | 288 DISALLOW_COPY_AND_ASSIGN(PendingView); |
318 }; | 289 }; |
319 | 290 |
320 ManagePasswordsBubbleView::PendingView::PendingView( | 291 ManagePasswordsBubbleView::PendingView::PendingView( |
(...skipping 13 matching lines...) Expand all Loading... |
334 password_manager::features::kEnableUsernameCorrection)) { | 305 password_manager::features::kEnableUsernameCorrection)) { |
335 edit_button_ = views::MdTextButton::CreateSecondaryUiButton( | 306 edit_button_ = views::MdTextButton::CreateSecondaryUiButton( |
336 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EDIT_BUTTON)); | 307 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EDIT_BUTTON)); |
337 } | 308 } |
338 save_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( | 309 save_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( |
339 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); | 310 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_SAVE_BUTTON)); |
340 never_button_ = views::MdTextButton::CreateSecondaryUiButton( | 311 never_button_ = views::MdTextButton::CreateSecondaryUiButton( |
341 this, | 312 this, |
342 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); | 313 l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_BUBBLE_BLACKLIST_BUTTON)); |
343 | 314 |
344 // Title row. | |
345 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 315 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
346 AddTitleRowWithLink(layout, parent_->model(), this); | |
347 | 316 |
348 // Credential row. | 317 // Credential row. |
349 if (item) { | 318 if (item) { |
350 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 319 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
351 layout->AddView(item); | 320 layout->AddView(item); |
352 layout->AddPaddingRow(0, | 321 layout->AddPaddingRow(0, |
353 ChromeLayoutProvider::Get() | 322 ChromeLayoutProvider::Get() |
354 ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS) | 323 ->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS) |
355 .bottom()); | 324 .bottom()); |
356 } | 325 } |
(...skipping 29 matching lines...) Expand all Loading... |
386 } | 355 } |
387 } else if (sender == never_button_) { | 356 } else if (sender == never_button_) { |
388 parent_->model()->OnNeverForThisSiteClicked(); | 357 parent_->model()->OnNeverForThisSiteClicked(); |
389 } else { | 358 } else { |
390 NOTREACHED(); | 359 NOTREACHED(); |
391 } | 360 } |
392 | 361 |
393 parent_->CloseBubble(); | 362 parent_->CloseBubble(); |
394 } | 363 } |
395 | 364 |
396 void ManagePasswordsBubbleView::PendingView::StyledLabelLinkClicked( | |
397 views::StyledLabel* label, | |
398 const gfx::Range& range, | |
399 int event_flags) { | |
400 DCHECK_EQ(range, parent_->model()->title_brand_link_range()); | |
401 parent_->model()->OnBrandLinkClicked(); | |
402 } | |
403 | |
404 // ManagePasswordsBubbleView::ManageView -------------------------------------- | 365 // ManagePasswordsBubbleView::ManageView -------------------------------------- |
405 | 366 |
406 // A view offering the user a list of their currently saved credentials | 367 // A view offering the user a list of their currently saved credentials |
407 // for the current page, along with a "Manage passwords" link and a | 368 // for the current page, along with a "Manage passwords" link and a |
408 // "Done" button. | 369 // "Done" button. |
409 class ManagePasswordsBubbleView::ManageView : public views::View, | 370 class ManagePasswordsBubbleView::ManageView : public views::View, |
410 public views::ButtonListener, | 371 public views::ButtonListener, |
411 public views::LinkListener { | 372 public views::LinkListener { |
412 public: | 373 public: |
413 explicit ManageView(ManagePasswordsBubbleView* parent); | 374 explicit ManageView(ManagePasswordsBubbleView* parent); |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
634 } | 595 } |
635 | 596 |
636 // ManagePasswordsBubbleView::UpdatePendingView ------------------------------- | 597 // ManagePasswordsBubbleView::UpdatePendingView ------------------------------- |
637 | 598 |
638 // A view offering the user the ability to update credentials. Contains a | 599 // A view offering the user the ability to update credentials. Contains a |
639 // single ManagePasswordItemsView (in case of one credentials) or | 600 // single ManagePasswordItemsView (in case of one credentials) or |
640 // CredentialsSelectionView otherwise, along with a "Update Passwords" button | 601 // CredentialsSelectionView otherwise, along with a "Update Passwords" button |
641 // and a rejection button. | 602 // and a rejection button. |
642 class ManagePasswordsBubbleView::UpdatePendingView | 603 class ManagePasswordsBubbleView::UpdatePendingView |
643 : public views::View, | 604 : public views::View, |
644 public views::ButtonListener, | 605 public views::ButtonListener { |
645 public views::StyledLabelListener { | |
646 public: | 606 public: |
647 explicit UpdatePendingView(ManagePasswordsBubbleView* parent); | 607 explicit UpdatePendingView(ManagePasswordsBubbleView* parent); |
648 ~UpdatePendingView() override; | 608 ~UpdatePendingView() override; |
649 | 609 |
650 private: | 610 private: |
651 // views::ButtonListener: | 611 // views::ButtonListener: |
652 void ButtonPressed(views::Button* sender, const ui::Event& event) override; | 612 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
653 | 613 |
654 // views::StyledLabelListener: | |
655 void StyledLabelLinkClicked(views::StyledLabel* label, | |
656 const gfx::Range& range, | |
657 int event_flags) override; | |
658 | |
659 ManagePasswordsBubbleView* parent_; | 614 ManagePasswordsBubbleView* parent_; |
660 | 615 |
661 CredentialsSelectionView* selection_view_; | 616 CredentialsSelectionView* selection_view_; |
662 | 617 |
663 views::Button* update_button_; | 618 views::Button* update_button_; |
664 views::Button* nope_button_; | 619 views::Button* nope_button_; |
665 | 620 |
666 DISALLOW_COPY_AND_ASSIGN(UpdatePendingView); | 621 DISALLOW_COPY_AND_ASSIGN(UpdatePendingView); |
667 }; | 622 }; |
668 | 623 |
(...skipping 13 matching lines...) Expand all Loading... |
682 } else { | 637 } else { |
683 item = new ManagePasswordItemsView(parent_->model(), | 638 item = new ManagePasswordItemsView(parent_->model(), |
684 &parent->model()->pending_password()); | 639 &parent->model()->pending_password()); |
685 } | 640 } |
686 nope_button_ = views::MdTextButton::CreateSecondaryUiButton( | 641 nope_button_ = views::MdTextButton::CreateSecondaryUiButton( |
687 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); | 642 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_CANCEL_BUTTON)); |
688 | 643 |
689 update_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( | 644 update_button_ = views::MdTextButton::CreateSecondaryUiBlueButton( |
690 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON)); | 645 this, l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_UPDATE_BUTTON)); |
691 | 646 |
692 // Title row. | |
693 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 647 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
694 AddTitleRowWithLink(layout, parent_->model(), this); | |
695 | 648 |
696 // Credential row. | 649 // Credential row. |
697 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); | 650 layout->StartRow(0, SINGLE_VIEW_COLUMN_SET); |
698 layout->AddView(item); | 651 layout->AddView(item); |
699 layout->AddPaddingRow( | 652 layout->AddPaddingRow( |
700 0, | 653 0, |
701 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS).bottom()); | 654 layout_provider->GetInsetsMetric(views::INSETS_DIALOG_CONTENTS).bottom()); |
702 | 655 |
703 // Button row. | 656 // Button row. |
704 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); | 657 BuildColumnSet(layout, DOUBLE_BUTTON_COLUMN_SET); |
(...skipping 19 matching lines...) Expand all Loading... |
724 *selection_view_->GetSelectedCredentials()); | 677 *selection_view_->GetSelectedCredentials()); |
725 } else { | 678 } else { |
726 parent_->model()->OnUpdateClicked(parent_->model()->pending_password()); | 679 parent_->model()->OnUpdateClicked(parent_->model()->pending_password()); |
727 } | 680 } |
728 } else { | 681 } else { |
729 parent_->model()->OnNopeUpdateClicked(); | 682 parent_->model()->OnNopeUpdateClicked(); |
730 } | 683 } |
731 parent_->CloseBubble(); | 684 parent_->CloseBubble(); |
732 } | 685 } |
733 | 686 |
734 void ManagePasswordsBubbleView::UpdatePendingView::StyledLabelLinkClicked( | |
735 views::StyledLabel* label, | |
736 const gfx::Range& range, | |
737 int event_flags) { | |
738 DCHECK_EQ(range, parent_->model()->title_brand_link_range()); | |
739 parent_->model()->OnBrandLinkClicked(); | |
740 } | |
741 | |
742 // ManagePasswordsBubbleView -------------------------------------------------- | 687 // ManagePasswordsBubbleView -------------------------------------------------- |
743 | 688 |
744 // static | 689 // static |
745 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = | 690 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = |
746 NULL; | 691 NULL; |
747 | 692 |
748 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) | 693 #if !defined(OS_MACOSX) || BUILDFLAG(MAC_VIEWS_BROWSER) |
749 // static | 694 // static |
750 void ManagePasswordsBubbleView::ShowBubble( | 695 void ManagePasswordsBubbleView::ShowBubble( |
751 content::WebContents* web_contents, | 696 content::WebContents* web_contents, |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 SetLayoutManager(new views::FillLayout); | 786 SetLayoutManager(new views::FillLayout); |
842 | 787 |
843 CreateChild(); | 788 CreateChild(); |
844 } | 789 } |
845 | 790 |
846 void ManagePasswordsBubbleView::CloseBubble() { | 791 void ManagePasswordsBubbleView::CloseBubble() { |
847 mouse_handler_.reset(); | 792 mouse_handler_.reset(); |
848 LocationBarBubbleDelegateView::CloseBubble(); | 793 LocationBarBubbleDelegateView::CloseBubble(); |
849 } | 794 } |
850 | 795 |
| 796 void ManagePasswordsBubbleView::AddedToWidget() { |
| 797 auto title_view = |
| 798 base::MakeUnique<views::StyledLabel>(base::string16(), this); |
| 799 title_view->SetBaseFontList(views::style::GetFont( |
| 800 views::style::CONTEXT_DIALOG_TITLE, views::style::STYLE_PRIMARY)); |
| 801 UpdateTitleText(title_view.get()); |
| 802 GetBubbleFrameView()->SetTitleView(std::move(title_view)); |
| 803 } |
| 804 |
| 805 void ManagePasswordsBubbleView::UpdateTitleText( |
| 806 views::StyledLabel* title_view) { |
| 807 title_view->SetText(GetWindowTitle()); |
| 808 if (!model_.title_brand_link_range().is_empty()) |
| 809 title_view->AddStyleRange(model_.title_brand_link_range(), GetLinkStyle()); |
| 810 } |
| 811 |
851 base::string16 ManagePasswordsBubbleView::GetWindowTitle() const { | 812 base::string16 ManagePasswordsBubbleView::GetWindowTitle() const { |
852 return model_.title(); | 813 return model_.title(); |
853 } | 814 } |
854 | 815 |
855 gfx::ImageSkia ManagePasswordsBubbleView::GetWindowIcon() { | 816 gfx::ImageSkia ManagePasswordsBubbleView::GetWindowIcon() { |
856 #if defined(OS_WIN) | 817 #if defined(OS_WIN) |
857 if (model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 818 if (model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
858 return desktop_ios_promotion::GetPromoImage( | 819 return desktop_ios_promotion::GetPromoImage( |
859 GetNativeTheme()->GetSystemColor( | 820 GetNativeTheme()->GetSystemColor( |
860 ui::NativeTheme::kColorId_TextfieldDefaultColor)); | 821 ui::NativeTheme::kColorId_TextfieldDefaultColor)); |
861 } | 822 } |
862 #endif | 823 #endif |
863 return gfx::ImageSkia(); | 824 return gfx::ImageSkia(); |
864 } | 825 } |
865 | 826 |
866 bool ManagePasswordsBubbleView::ShouldShowWindowTitle() const { | |
867 // Since bubble titles don't support links, fall back to a custom title view | |
868 // if we need to show a link. Only use the normal title path if there's no | |
869 // link. | |
870 return model_.title_brand_link_range().is_empty(); | |
871 } | |
872 | |
873 bool ManagePasswordsBubbleView::ShouldShowWindowIcon() const { | 827 bool ManagePasswordsBubbleView::ShouldShowWindowIcon() const { |
874 return model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; | 828 return model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; |
875 } | 829 } |
876 | 830 |
877 bool ManagePasswordsBubbleView::ShouldShowCloseButton() const { | 831 bool ManagePasswordsBubbleView::ShouldShowCloseButton() const { |
878 return model_.state() == password_manager::ui::PENDING_PASSWORD_STATE || | 832 return model_.state() == password_manager::ui::PENDING_PASSWORD_STATE || |
879 model_.state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE || | 833 model_.state() == password_manager::ui::CHROME_SIGN_IN_PROMO_STATE || |
880 model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; | 834 model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE; |
881 } | 835 } |
882 | 836 |
| 837 void ManagePasswordsBubbleView::StyledLabelLinkClicked( |
| 838 views::StyledLabel* label, |
| 839 const gfx::Range& range, |
| 840 int event_flags) { |
| 841 DCHECK_EQ(model_.title_brand_link_range(), range); |
| 842 model_.OnBrandLinkClicked(); |
| 843 } |
| 844 |
883 void ManagePasswordsBubbleView::Refresh() { | 845 void ManagePasswordsBubbleView::Refresh() { |
884 RemoveAllChildViews(true); | 846 RemoveAllChildViews(true); |
885 initially_focused_view_ = NULL; | 847 initially_focused_view_ = NULL; |
886 CreateChild(); | 848 CreateChild(); |
887 // Show/hide the close button. | 849 // Show/hide the close button. |
888 GetWidget()->non_client_view()->ResetWindowControls(); | 850 GetWidget()->non_client_view()->ResetWindowControls(); |
889 GetWidget()->UpdateWindowIcon(); | 851 GetWidget()->UpdateWindowIcon(); |
890 GetWidget()->UpdateWindowTitle(); | 852 UpdateTitleText( |
| 853 static_cast<views::StyledLabel*>(GetBubbleFrameView()->title())); |
891 if (model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 854 if (model_.state() == password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
892 // Update the height and keep the existing width. | 855 // Update the height and keep the existing width. |
893 gfx::Rect bubble_bounds = GetWidget()->GetWindowBoundsInScreen(); | 856 gfx::Rect bubble_bounds = GetWidget()->GetWindowBoundsInScreen(); |
894 bubble_bounds.set_height( | 857 bubble_bounds.set_height( |
895 GetWidget()->GetRootView()->GetHeightForWidth(bubble_bounds.width())); | 858 GetWidget()->GetRootView()->GetHeightForWidth(bubble_bounds.width())); |
896 GetWidget()->SetBounds(bubble_bounds); | 859 GetWidget()->SetBounds(bubble_bounds); |
897 } else { | 860 } else { |
898 SizeToContents(); | 861 SizeToContents(); |
899 } | 862 } |
900 } | 863 } |
(...skipping 15 matching lines...) Expand all Loading... |
916 } else if (model_.state() == | 879 } else if (model_.state() == |
917 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { | 880 password_manager::ui::CHROME_DESKTOP_IOS_PROMO_STATE) { |
918 AddChildView(new DesktopIOSPromotionBubbleView( | 881 AddChildView(new DesktopIOSPromotionBubbleView( |
919 model_.GetProfile(), | 882 model_.GetProfile(), |
920 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); | 883 desktop_ios_promotion::PromotionEntryPoint::SAVE_PASSWORD_BUBBLE)); |
921 #endif | 884 #endif |
922 } else { | 885 } else { |
923 AddChildView(new ManageView(this)); | 886 AddChildView(new ManageView(this)); |
924 } | 887 } |
925 } | 888 } |
OLD | NEW |