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 "chrome/browser/chrome_notification_types.h" | |
8 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_finder.h" | 8 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/browser_window.h" | |
11 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" | 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" |
12 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 11 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h" |
13 #include "chrome/browser/ui/views/frame/browser_view.h" | 12 #include "chrome/browser/ui/views/frame/browser_view.h" |
14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" | 13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" |
15 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" | 14 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" |
16 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" | 15 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" |
17 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
18 #include "components/password_manager/core/common/password_manager_ui.h" | |
19 #include "content/public/browser/notification_source.h" | |
20 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.h" |
21 #include "ui/aura/window.h" | 18 #include "ui/aura/window.h" |
22 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
23 #include "ui/base/models/combobox_model.h" | |
24 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
25 #include "ui/compositor/layer_animation_observer.h" | 21 #include "ui/compositor/layer_animation_observer.h" |
26 #include "ui/compositor/scoped_layer_animation_settings.h" | 22 #include "ui/compositor/scoped_layer_animation_settings.h" |
27 #include "ui/gfx/text_utils.h" | |
28 #include "ui/views/controls/button/blue_button.h" | 23 #include "ui/views/controls/button/blue_button.h" |
29 #include "ui/views/controls/button/label_button.h" | 24 #include "ui/views/controls/button/label_button.h" |
30 #include "ui/views/controls/combobox/combobox.h" | 25 #include "ui/views/controls/combobox/combobox.h" |
| 26 #include "ui/views/controls/combobox/combobox_listener.h" |
| 27 #include "ui/views/controls/link.h" |
| 28 #include "ui/views/controls/link_listener.h" |
31 #include "ui/views/controls/styled_label.h" | 29 #include "ui/views/controls/styled_label.h" |
| 30 #include "ui/views/controls/styled_label_listener.h" |
32 #include "ui/views/layout/fill_layout.h" | 31 #include "ui/views/layout/fill_layout.h" |
33 #include "ui/views/layout/grid_layout.h" | 32 #include "ui/views/layout/grid_layout.h" |
34 #include "ui/views/layout/layout_constants.h" | 33 #include "ui/views/layout/layout_constants.h" |
35 | 34 |
36 | 35 |
37 // Helpers -------------------------------------------------------------------- | 36 // Helpers -------------------------------------------------------------------- |
38 | 37 |
39 namespace { | 38 namespace { |
40 | 39 |
41 // The number of seconds the bubble needs to fade out. | 40 // The number of seconds the bubble needs to fade out. |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 password_manager::ui::IsAutomaticDisplayState(controller->state()) | 157 password_manager::ui::IsAutomaticDisplayState(controller->state()) |
159 ? ManagePasswordsBubbleView::AUTOMATIC | 158 ? ManagePasswordsBubbleView::AUTOMATIC |
160 : ManagePasswordsBubbleView::USER_ACTION); | 159 : ManagePasswordsBubbleView::USER_ACTION); |
161 } | 160 } |
162 | 161 |
163 } // namespace chrome | 162 } // namespace chrome |
164 | 163 |
165 | 164 |
166 // ManagePasswordsBubbleView::PendingView ------------------------------------- | 165 // ManagePasswordsBubbleView::PendingView ------------------------------------- |
167 | 166 |
| 167 // A view offering the user the ability to save credentials. Contains a |
| 168 // single ManagePasswordItemView, along with a "Save Passwords" button |
| 169 // and a rejection combobox. |
| 170 class ManagePasswordsBubbleView::PendingView : public views::View, |
| 171 public views::ButtonListener, |
| 172 public views::ComboboxListener { |
| 173 public: |
| 174 explicit PendingView(ManagePasswordsBubbleView* parent); |
| 175 virtual ~PendingView(); |
| 176 |
| 177 private: |
| 178 // views::ButtonListener: |
| 179 virtual void ButtonPressed(views::Button* sender, |
| 180 const ui::Event& event) OVERRIDE; |
| 181 |
| 182 // Handles the event when the user changes an index of a combobox. |
| 183 virtual void OnPerformAction(views::Combobox* source) OVERRIDE; |
| 184 |
| 185 ManagePasswordsBubbleView* parent_; |
| 186 |
| 187 views::BlueButton* save_button_; |
| 188 |
| 189 // The combobox doesn't take ownership of its model. If we created a |
| 190 // combobox we need to ensure that we delete the model here, and because the |
| 191 // combobox uses the model in it's destructor, we need to make sure we |
| 192 // delete the model _after_ the combobox itself is deleted. |
| 193 scoped_ptr<SavePasswordRefusalComboboxModel> combobox_model_; |
| 194 scoped_ptr<views::Combobox> refuse_combobox_; |
| 195 }; |
| 196 |
168 ManagePasswordsBubbleView::PendingView::PendingView( | 197 ManagePasswordsBubbleView::PendingView::PendingView( |
169 ManagePasswordsBubbleView* parent) | 198 ManagePasswordsBubbleView* parent) |
170 : parent_(parent) { | 199 : parent_(parent) { |
171 views::GridLayout* layout = new views::GridLayout(this); | 200 views::GridLayout* layout = new views::GridLayout(this); |
172 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 201 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
173 SetLayoutManager(layout); | 202 SetLayoutManager(layout); |
174 | 203 |
175 // Create the pending credential item, save button and refusal combobox. | 204 // Create the pending credential item, save button and refusal combobox. |
176 ManagePasswordItemView* item = | 205 ManagePasswordItemView* item = |
177 new ManagePasswordItemView(parent->model(), | 206 new ManagePasswordItemView(parent->model(), |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 parent_->Close(); | 258 parent_->Close(); |
230 break; | 259 break; |
231 case SavePasswordRefusalComboboxModel::INDEX_NEVER_FOR_THIS_SITE: | 260 case SavePasswordRefusalComboboxModel::INDEX_NEVER_FOR_THIS_SITE: |
232 parent_->NotifyNeverForThisSiteClicked(); | 261 parent_->NotifyNeverForThisSiteClicked(); |
233 break; | 262 break; |
234 } | 263 } |
235 } | 264 } |
236 | 265 |
237 // ManagePasswordsBubbleView::ConfirmNeverView --------------------------------- | 266 // ManagePasswordsBubbleView::ConfirmNeverView --------------------------------- |
238 | 267 |
| 268 // A view offering the user the ability to undo her decision to never save |
| 269 // passwords for a particular site. |
| 270 class ManagePasswordsBubbleView::ConfirmNeverView |
| 271 : public views::View, |
| 272 public views::ButtonListener { |
| 273 public: |
| 274 explicit ConfirmNeverView(ManagePasswordsBubbleView* parent); |
| 275 virtual ~ConfirmNeverView(); |
| 276 |
| 277 private: |
| 278 // views::ButtonListener: |
| 279 virtual void ButtonPressed(views::Button* sender, |
| 280 const ui::Event& event) OVERRIDE; |
| 281 |
| 282 ManagePasswordsBubbleView* parent_; |
| 283 |
| 284 views::LabelButton* confirm_button_; |
| 285 views::LabelButton* undo_button_; |
| 286 }; |
| 287 |
239 ManagePasswordsBubbleView::ConfirmNeverView::ConfirmNeverView( | 288 ManagePasswordsBubbleView::ConfirmNeverView::ConfirmNeverView( |
240 ManagePasswordsBubbleView* parent) | 289 ManagePasswordsBubbleView* parent) |
241 : parent_(parent) { | 290 : parent_(parent) { |
242 views::GridLayout* layout = new views::GridLayout(this); | 291 views::GridLayout* layout = new views::GridLayout(this); |
243 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 292 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
244 SetLayoutManager(layout); | 293 SetLayoutManager(layout); |
245 | 294 |
246 // Title row. | 295 // Title row. |
247 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 296 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
248 views::Label* title_label = new views::Label(l10n_util::GetStringUTF16( | 297 views::Label* title_label = new views::Label(l10n_util::GetStringUTF16( |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 const ui::Event& event) { | 352 const ui::Event& event) { |
304 DCHECK(sender == confirm_button_ || sender == undo_button_); | 353 DCHECK(sender == confirm_button_ || sender == undo_button_); |
305 if (sender == confirm_button_) | 354 if (sender == confirm_button_) |
306 parent_->NotifyConfirmedNeverForThisSite(); | 355 parent_->NotifyConfirmedNeverForThisSite(); |
307 else | 356 else |
308 parent_->NotifyUndoNeverForThisSite(); | 357 parent_->NotifyUndoNeverForThisSite(); |
309 } | 358 } |
310 | 359 |
311 // ManagePasswordsBubbleView::ManageView -------------------------------------- | 360 // ManagePasswordsBubbleView::ManageView -------------------------------------- |
312 | 361 |
| 362 // A view offering the user a list of her currently saved credentials |
| 363 // for the current page, along with a "Manage passwords" link and a |
| 364 // "Done" button. |
| 365 class ManagePasswordsBubbleView::ManageView : public views::View, |
| 366 public views::ButtonListener, |
| 367 public views::LinkListener { |
| 368 public: |
| 369 explicit ManageView(ManagePasswordsBubbleView* parent); |
| 370 virtual ~ManageView(); |
| 371 |
| 372 private: |
| 373 // views::ButtonListener: |
| 374 virtual void ButtonPressed(views::Button* sender, |
| 375 const ui::Event& event) OVERRIDE; |
| 376 |
| 377 // views::LinkListener: |
| 378 virtual void LinkClicked(views::Link* source, int event_flags) OVERRIDE; |
| 379 |
| 380 ManagePasswordsBubbleView* parent_; |
| 381 |
| 382 views::Link* manage_link_; |
| 383 views::LabelButton* done_button_; |
| 384 }; |
| 385 |
313 ManagePasswordsBubbleView::ManageView::ManageView( | 386 ManagePasswordsBubbleView::ManageView::ManageView( |
314 ManagePasswordsBubbleView* parent) | 387 ManagePasswordsBubbleView* parent) |
315 : parent_(parent) { | 388 : parent_(parent) { |
316 views::GridLayout* layout = new views::GridLayout(this); | 389 views::GridLayout* layout = new views::GridLayout(this); |
317 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 390 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
318 SetLayoutManager(layout); | 391 SetLayoutManager(layout); |
319 | 392 |
320 // Add the title. | 393 // Add the title. |
321 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 394 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
322 AddTitleRow(layout, parent_->model()); | 395 AddTitleRow(layout, parent_->model()); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 | 465 |
393 void ManagePasswordsBubbleView::ManageView::LinkClicked(views::Link* source, | 466 void ManagePasswordsBubbleView::ManageView::LinkClicked(views::Link* source, |
394 int event_flags) { | 467 int event_flags) { |
395 DCHECK_EQ(source, manage_link_); | 468 DCHECK_EQ(source, manage_link_); |
396 parent_->model()->OnManageLinkClicked(); | 469 parent_->model()->OnManageLinkClicked(); |
397 parent_->Close(); | 470 parent_->Close(); |
398 } | 471 } |
399 | 472 |
400 // ManagePasswordsBubbleView::BlacklistedView --------------------------------- | 473 // ManagePasswordsBubbleView::BlacklistedView --------------------------------- |
401 | 474 |
| 475 // A view offering the user the ability to re-enable the password manager for |
| 476 // a specific site after she's decided to "never save passwords". |
| 477 class ManagePasswordsBubbleView::BlacklistedView |
| 478 : public views::View, |
| 479 public views::ButtonListener { |
| 480 public: |
| 481 explicit BlacklistedView(ManagePasswordsBubbleView* parent); |
| 482 virtual ~BlacklistedView(); |
| 483 |
| 484 private: |
| 485 // views::ButtonListener: |
| 486 virtual void ButtonPressed(views::Button* sender, |
| 487 const ui::Event& event) OVERRIDE; |
| 488 |
| 489 ManagePasswordsBubbleView* parent_; |
| 490 |
| 491 views::BlueButton* unblacklist_button_; |
| 492 views::LabelButton* done_button_; |
| 493 }; |
| 494 |
402 ManagePasswordsBubbleView::BlacklistedView::BlacklistedView( | 495 ManagePasswordsBubbleView::BlacklistedView::BlacklistedView( |
403 ManagePasswordsBubbleView* parent) | 496 ManagePasswordsBubbleView* parent) |
404 : parent_(parent) { | 497 : parent_(parent) { |
405 views::GridLayout* layout = new views::GridLayout(this); | 498 views::GridLayout* layout = new views::GridLayout(this); |
406 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 499 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
407 SetLayoutManager(layout); | 500 SetLayoutManager(layout); |
408 | 501 |
409 // Add the title. | 502 // Add the title. |
410 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 503 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
411 AddTitleRow(layout, parent_->model()); | 504 AddTitleRow(layout, parent_->model()); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 parent_->model()->OnDoneClicked(); | 547 parent_->model()->OnDoneClicked(); |
455 else if (sender == unblacklist_button_) | 548 else if (sender == unblacklist_button_) |
456 parent_->model()->OnUnblacklistClicked(); | 549 parent_->model()->OnUnblacklistClicked(); |
457 else | 550 else |
458 NOTREACHED(); | 551 NOTREACHED(); |
459 parent_->Close(); | 552 parent_->Close(); |
460 } | 553 } |
461 | 554 |
462 // ManagePasswordsBubbleView::SaveConfirmationView ---------------------------- | 555 // ManagePasswordsBubbleView::SaveConfirmationView ---------------------------- |
463 | 556 |
| 557 // A view confirming to the user that a password was saved and offering a link |
| 558 // to the Google account manager. |
| 559 class ManagePasswordsBubbleView::SaveConfirmationView |
| 560 : public views::View, |
| 561 public views::ButtonListener, |
| 562 public views::StyledLabelListener { |
| 563 public: |
| 564 explicit SaveConfirmationView(ManagePasswordsBubbleView* parent); |
| 565 virtual ~SaveConfirmationView(); |
| 566 |
| 567 private: |
| 568 // views::ButtonListener: |
| 569 virtual void ButtonPressed(views::Button* sender, |
| 570 const ui::Event& event) OVERRIDE; |
| 571 |
| 572 // views::StyledLabelListener implementation |
| 573 virtual void StyledLabelLinkClicked(const gfx::Range& range, |
| 574 int event_flags) OVERRIDE; |
| 575 |
| 576 ManagePasswordsBubbleView* parent_; |
| 577 |
| 578 views::LabelButton* ok_button_; |
| 579 }; |
| 580 |
464 ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView( | 581 ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView( |
465 ManagePasswordsBubbleView* parent) | 582 ManagePasswordsBubbleView* parent) |
466 : parent_(parent) { | 583 : parent_(parent) { |
467 views::GridLayout* layout = new views::GridLayout(this); | 584 views::GridLayout* layout = new views::GridLayout(this); |
468 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); | 585 layout->set_minimum_size(gfx::Size(kDesiredBubbleWidth, 0)); |
469 SetLayoutManager(layout); | 586 SetLayoutManager(layout); |
470 | 587 |
471 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); | 588 BuildColumnSet(layout, SINGLE_VIEW_COLUMN_SET); |
472 AddTitleRow(layout, parent_->model()); | 589 AddTitleRow(layout, parent_->model()); |
473 | 590 |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
671 screen_bounds.right() - bubble_half_width - kFullscreenPaddingEnd; | 788 screen_bounds.right() - bubble_half_width - kFullscreenPaddingEnd; |
672 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); | 789 SetAnchorRect(gfx::Rect(x_pos, screen_bounds.y(), 0, 0)); |
673 } | 790 } |
674 | 791 |
675 void ManagePasswordsBubbleView::Close() { | 792 void ManagePasswordsBubbleView::Close() { |
676 fadeout_observer_.reset(); | 793 fadeout_observer_.reset(); |
677 mouse_handler_.reset(); | 794 mouse_handler_.reset(); |
678 GetWidget()->Close(); | 795 GetWidget()->Close(); |
679 } | 796 } |
680 | 797 |
681 void ManagePasswordsBubbleView::Init() { | |
682 views::FillLayout* layout = new views::FillLayout(); | |
683 SetLayoutManager(layout); | |
684 | |
685 Refresh(); | |
686 } | |
687 | |
688 void ManagePasswordsBubbleView::WindowClosing() { | |
689 // Close() closes the window asynchronously, so by the time we reach here, | |
690 // |manage_passwords_bubble_| may have already been reset. | |
691 if (manage_passwords_bubble_ == this) | |
692 manage_passwords_bubble_ = NULL; | |
693 } | |
694 | |
695 void ManagePasswordsBubbleView::OnWidgetActivationChanged(views::Widget* widget, | |
696 bool active) { | |
697 if (active && widget == GetWidget()) | |
698 CancelFadingOut(); | |
699 BubbleDelegateView::OnWidgetActivationChanged(widget, active); | |
700 } | |
701 | |
702 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { | |
703 return initially_focused_view_; | |
704 } | |
705 | |
706 void ManagePasswordsBubbleView::OnMouseEntered(const ui::MouseEvent& event) { | |
707 CancelFadingOut(); | |
708 } | |
709 | |
710 void ManagePasswordsBubbleView::Refresh() { | 798 void ManagePasswordsBubbleView::Refresh() { |
711 RemoveAllChildViews(true); | 799 RemoveAllChildViews(true); |
712 initially_focused_view_ = NULL; | 800 initially_focused_view_ = NULL; |
713 if (password_manager::ui::IsPendingState(model()->state())) { | 801 if (password_manager::ui::IsPendingState(model()->state())) { |
714 if (never_save_passwords_) | 802 if (never_save_passwords_) |
715 AddChildView(new ConfirmNeverView(this)); | 803 AddChildView(new ConfirmNeverView(this)); |
716 else | 804 else |
717 AddChildView(new PendingView(this)); | 805 AddChildView(new PendingView(this)); |
718 } else if (model()->state() == password_manager::ui::BLACKLIST_STATE) { | 806 } else if (model()->state() == password_manager::ui::BLACKLIST_STATE) { |
719 AddChildView(new BlacklistedView(this)); | 807 AddChildView(new BlacklistedView(this)); |
(...skipping 19 matching lines...) Expand all Loading... |
739 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { | 827 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { |
740 model()->OnNeverForThisSiteClicked(); | 828 model()->OnNeverForThisSiteClicked(); |
741 Close(); | 829 Close(); |
742 } | 830 } |
743 | 831 |
744 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { | 832 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { |
745 never_save_passwords_ = false; | 833 never_save_passwords_ = false; |
746 Refresh(); | 834 Refresh(); |
747 } | 835 } |
748 | 836 |
| 837 void ManagePasswordsBubbleView::Init() { |
| 838 views::FillLayout* layout = new views::FillLayout(); |
| 839 SetLayoutManager(layout); |
| 840 |
| 841 Refresh(); |
| 842 } |
| 843 |
| 844 void ManagePasswordsBubbleView::WindowClosing() { |
| 845 // Close() closes the window asynchronously, so by the time we reach here, |
| 846 // |manage_passwords_bubble_| may have already been reset. |
| 847 if (manage_passwords_bubble_ == this) |
| 848 manage_passwords_bubble_ = NULL; |
| 849 } |
| 850 |
| 851 void ManagePasswordsBubbleView::OnWidgetActivationChanged(views::Widget* widget, |
| 852 bool active) { |
| 853 if (active && widget == GetWidget()) |
| 854 CancelFadingOut(); |
| 855 BubbleDelegateView::OnWidgetActivationChanged(widget, active); |
| 856 } |
| 857 |
| 858 views::View* ManagePasswordsBubbleView::GetInitiallyFocusedView() { |
| 859 return initially_focused_view_; |
| 860 } |
| 861 |
| 862 void ManagePasswordsBubbleView::OnMouseEntered(const ui::MouseEvent& event) { |
| 863 CancelFadingOut(); |
| 864 } |
| 865 |
749 void ManagePasswordsBubbleView::StartFadingOut() { | 866 void ManagePasswordsBubbleView::StartFadingOut() { |
750 if (fadeout_observer_) | 867 if (fadeout_observer_) |
751 return; | 868 return; |
752 aura::Window* window = GetWidget()->GetNativeView(); | 869 aura::Window* window = GetWidget()->GetNativeView(); |
753 ui::ScopedLayerAnimationSettings animator(window->layer()->GetAnimator()); | 870 ui::ScopedLayerAnimationSettings animator(window->layer()->GetAnimator()); |
754 fadeout_observer_.reset(new FadeOutObserver(this)); | 871 fadeout_observer_.reset(new FadeOutObserver(this)); |
755 animator.AddObserver(fadeout_observer_.get()); | 872 animator.AddObserver(fadeout_observer_.get()); |
756 animator.SetTransitionDuration( | 873 animator.SetTransitionDuration( |
757 base::TimeDelta::FromSeconds(kBubbleFadeDelay)); | 874 base::TimeDelta::FromSeconds(kBubbleFadeDelay)); |
758 window->layer()->SetOpacity(0); | 875 window->layer()->SetOpacity(0); |
759 } | 876 } |
760 | 877 |
761 void ManagePasswordsBubbleView::CancelFadingOut() { | 878 void ManagePasswordsBubbleView::CancelFadingOut() { |
762 if (!fadeout_observer_) | 879 if (!fadeout_observer_) |
763 return; | 880 return; |
764 fadeout_observer_.reset(); | 881 fadeout_observer_.reset(); |
765 aura::Window* window = GetWidget()->GetNativeView(); | 882 aura::Window* window = GetWidget()->GetNativeView(); |
766 window->layer()->SetOpacity(1); | 883 window->layer()->SetOpacity(1); |
767 } | 884 } |
768 | 885 |
769 void ManagePasswordsBubbleView::OnBubbleDisappeared() { | 886 void ManagePasswordsBubbleView::OnBubbleDisappeared() { |
770 Close(); | 887 Close(); |
771 } | 888 } |
OLD | NEW |