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" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/browser/ui/browser_finder.h" | 9 #include "chrome/browser/ui/browser_finder.h" |
10 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 10 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // ManagePasswordsBubbleView::PendingView ------------------------------------- | 174 // ManagePasswordsBubbleView::PendingView ------------------------------------- |
175 | 175 |
176 // A view offering the user the ability to save credentials. Contains a | 176 // A view offering the user the ability to save credentials. Contains a |
177 // single ManagePasswordItemView, along with a "Save Passwords" button | 177 // single ManagePasswordItemView, along with a "Save Passwords" button |
178 // and a rejection combobox. | 178 // and a rejection combobox. |
179 class ManagePasswordsBubbleView::PendingView : public views::View, | 179 class ManagePasswordsBubbleView::PendingView : public views::View, |
180 public views::ButtonListener, | 180 public views::ButtonListener, |
181 public views::ComboboxListener { | 181 public views::ComboboxListener { |
182 public: | 182 public: |
183 explicit PendingView(ManagePasswordsBubbleView* parent); | 183 explicit PendingView(ManagePasswordsBubbleView* parent); |
184 virtual ~PendingView(); | 184 ~PendingView() override; |
185 | 185 |
186 private: | 186 private: |
187 // views::ButtonListener: | 187 // views::ButtonListener: |
188 virtual void ButtonPressed(views::Button* sender, | 188 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
189 const ui::Event& event) override; | |
190 | 189 |
191 // Handles the event when the user changes an index of a combobox. | 190 // Handles the event when the user changes an index of a combobox. |
192 virtual void OnPerformAction(views::Combobox* source) override; | 191 void OnPerformAction(views::Combobox* source) override; |
193 | 192 |
194 ManagePasswordsBubbleView* parent_; | 193 ManagePasswordsBubbleView* parent_; |
195 | 194 |
196 views::BlueButton* save_button_; | 195 views::BlueButton* save_button_; |
197 | 196 |
198 // The combobox doesn't take ownership of its model. If we created a | 197 // The combobox doesn't take ownership of its model. If we created a |
199 // combobox we need to ensure that we delete the model here, and because the | 198 // combobox we need to ensure that we delete the model here, and because the |
200 // combobox uses the model in it's destructor, we need to make sure we | 199 // combobox uses the model in it's destructor, we need to make sure we |
201 // delete the model _after_ the combobox itself is deleted. | 200 // delete the model _after_ the combobox itself is deleted. |
202 scoped_ptr<SavePasswordRefusalComboboxModel> combobox_model_; | 201 scoped_ptr<SavePasswordRefusalComboboxModel> combobox_model_; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
274 | 273 |
275 // ManagePasswordsBubbleView::ConfirmNeverView --------------------------------- | 274 // ManagePasswordsBubbleView::ConfirmNeverView --------------------------------- |
276 | 275 |
277 // A view offering the user the ability to undo her decision to never save | 276 // A view offering the user the ability to undo her decision to never save |
278 // passwords for a particular site. | 277 // passwords for a particular site. |
279 class ManagePasswordsBubbleView::ConfirmNeverView | 278 class ManagePasswordsBubbleView::ConfirmNeverView |
280 : public views::View, | 279 : public views::View, |
281 public views::ButtonListener { | 280 public views::ButtonListener { |
282 public: | 281 public: |
283 explicit ConfirmNeverView(ManagePasswordsBubbleView* parent); | 282 explicit ConfirmNeverView(ManagePasswordsBubbleView* parent); |
284 virtual ~ConfirmNeverView(); | 283 ~ConfirmNeverView() override; |
285 | 284 |
286 private: | 285 private: |
287 // views::ButtonListener: | 286 // views::ButtonListener: |
288 virtual void ButtonPressed(views::Button* sender, | 287 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
289 const ui::Event& event) override; | |
290 | 288 |
291 ManagePasswordsBubbleView* parent_; | 289 ManagePasswordsBubbleView* parent_; |
292 | 290 |
293 views::LabelButton* confirm_button_; | 291 views::LabelButton* confirm_button_; |
294 views::LabelButton* undo_button_; | 292 views::LabelButton* undo_button_; |
295 }; | 293 }; |
296 | 294 |
297 ManagePasswordsBubbleView::ConfirmNeverView::ConfirmNeverView( | 295 ManagePasswordsBubbleView::ConfirmNeverView::ConfirmNeverView( |
298 ManagePasswordsBubbleView* parent) | 296 ManagePasswordsBubbleView* parent) |
299 : parent_(parent) { | 297 : parent_(parent) { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
369 // ManagePasswordsBubbleView::ManageView -------------------------------------- | 367 // ManagePasswordsBubbleView::ManageView -------------------------------------- |
370 | 368 |
371 // A view offering the user a list of her currently saved credentials | 369 // A view offering the user a list of her currently saved credentials |
372 // for the current page, along with a "Manage passwords" link and a | 370 // for the current page, along with a "Manage passwords" link and a |
373 // "Done" button. | 371 // "Done" button. |
374 class ManagePasswordsBubbleView::ManageView : public views::View, | 372 class ManagePasswordsBubbleView::ManageView : public views::View, |
375 public views::ButtonListener, | 373 public views::ButtonListener, |
376 public views::LinkListener { | 374 public views::LinkListener { |
377 public: | 375 public: |
378 explicit ManageView(ManagePasswordsBubbleView* parent); | 376 explicit ManageView(ManagePasswordsBubbleView* parent); |
379 virtual ~ManageView(); | 377 ~ManageView() override; |
380 | 378 |
381 private: | 379 private: |
382 // views::ButtonListener: | 380 // views::ButtonListener: |
383 virtual void ButtonPressed(views::Button* sender, | 381 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
384 const ui::Event& event) override; | |
385 | 382 |
386 // views::LinkListener: | 383 // views::LinkListener: |
387 virtual void LinkClicked(views::Link* source, int event_flags) override; | 384 void LinkClicked(views::Link* source, int event_flags) override; |
388 | 385 |
389 ManagePasswordsBubbleView* parent_; | 386 ManagePasswordsBubbleView* parent_; |
390 | 387 |
391 views::Link* manage_link_; | 388 views::Link* manage_link_; |
392 views::LabelButton* done_button_; | 389 views::LabelButton* done_button_; |
393 }; | 390 }; |
394 | 391 |
395 ManagePasswordsBubbleView::ManageView::ManageView( | 392 ManagePasswordsBubbleView::ManageView::ManageView( |
396 ManagePasswordsBubbleView* parent) | 393 ManagePasswordsBubbleView* parent) |
397 : parent_(parent) { | 394 : parent_(parent) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 478 |
482 // ManagePasswordsBubbleView::BlacklistedView --------------------------------- | 479 // ManagePasswordsBubbleView::BlacklistedView --------------------------------- |
483 | 480 |
484 // A view offering the user the ability to re-enable the password manager for | 481 // A view offering the user the ability to re-enable the password manager for |
485 // a specific site after she's decided to "never save passwords". | 482 // a specific site after she's decided to "never save passwords". |
486 class ManagePasswordsBubbleView::BlacklistedView | 483 class ManagePasswordsBubbleView::BlacklistedView |
487 : public views::View, | 484 : public views::View, |
488 public views::ButtonListener { | 485 public views::ButtonListener { |
489 public: | 486 public: |
490 explicit BlacklistedView(ManagePasswordsBubbleView* parent); | 487 explicit BlacklistedView(ManagePasswordsBubbleView* parent); |
491 virtual ~BlacklistedView(); | 488 ~BlacklistedView() override; |
492 | 489 |
493 private: | 490 private: |
494 // views::ButtonListener: | 491 // views::ButtonListener: |
495 virtual void ButtonPressed(views::Button* sender, | 492 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
496 const ui::Event& event) override; | |
497 | 493 |
498 ManagePasswordsBubbleView* parent_; | 494 ManagePasswordsBubbleView* parent_; |
499 | 495 |
500 views::BlueButton* unblacklist_button_; | 496 views::BlueButton* unblacklist_button_; |
501 views::LabelButton* done_button_; | 497 views::LabelButton* done_button_; |
502 }; | 498 }; |
503 | 499 |
504 ManagePasswordsBubbleView::BlacklistedView::BlacklistedView( | 500 ManagePasswordsBubbleView::BlacklistedView::BlacklistedView( |
505 ManagePasswordsBubbleView* parent) | 501 ManagePasswordsBubbleView* parent) |
506 : parent_(parent) { | 502 : parent_(parent) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 // ManagePasswordsBubbleView::SaveConfirmationView ---------------------------- | 560 // ManagePasswordsBubbleView::SaveConfirmationView ---------------------------- |
565 | 561 |
566 // A view confirming to the user that a password was saved and offering a link | 562 // A view confirming to the user that a password was saved and offering a link |
567 // to the Google account manager. | 563 // to the Google account manager. |
568 class ManagePasswordsBubbleView::SaveConfirmationView | 564 class ManagePasswordsBubbleView::SaveConfirmationView |
569 : public views::View, | 565 : public views::View, |
570 public views::ButtonListener, | 566 public views::ButtonListener, |
571 public views::StyledLabelListener { | 567 public views::StyledLabelListener { |
572 public: | 568 public: |
573 explicit SaveConfirmationView(ManagePasswordsBubbleView* parent); | 569 explicit SaveConfirmationView(ManagePasswordsBubbleView* parent); |
574 virtual ~SaveConfirmationView(); | 570 ~SaveConfirmationView() override; |
575 | 571 |
576 private: | 572 private: |
577 // views::ButtonListener: | 573 // views::ButtonListener: |
578 virtual void ButtonPressed(views::Button* sender, | 574 void ButtonPressed(views::Button* sender, const ui::Event& event) override; |
579 const ui::Event& event) override; | |
580 | 575 |
581 // views::StyledLabelListener implementation | 576 // views::StyledLabelListener implementation |
582 virtual void StyledLabelLinkClicked(const gfx::Range& range, | 577 void StyledLabelLinkClicked(const gfx::Range& range, |
583 int event_flags) override; | 578 int event_flags) override; |
584 | 579 |
585 ManagePasswordsBubbleView* parent_; | 580 ManagePasswordsBubbleView* parent_; |
586 | 581 |
587 views::LabelButton* ok_button_; | 582 views::LabelButton* ok_button_; |
588 }; | 583 }; |
589 | 584 |
590 ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView( | 585 ManagePasswordsBubbleView::SaveConfirmationView::SaveConfirmationView( |
591 ManagePasswordsBubbleView* parent) | 586 ManagePasswordsBubbleView* parent) |
592 : parent_(parent) { | 587 : parent_(parent) { |
593 views::GridLayout* layout = new views::GridLayout(this); | 588 views::GridLayout* layout = new views::GridLayout(this); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
643 } | 638 } |
644 | 639 |
645 // ManagePasswordsBubbleView::WebContentMouseHandler -------------------------- | 640 // ManagePasswordsBubbleView::WebContentMouseHandler -------------------------- |
646 | 641 |
647 // The class listens for WebContentsView events and notifies the bubble if the | 642 // The class listens for WebContentsView events and notifies the bubble if the |
648 // view was clicked on or received keystrokes. | 643 // view was clicked on or received keystrokes. |
649 class ManagePasswordsBubbleView::WebContentMouseHandler | 644 class ManagePasswordsBubbleView::WebContentMouseHandler |
650 : public ui::EventHandler { | 645 : public ui::EventHandler { |
651 public: | 646 public: |
652 explicit WebContentMouseHandler(ManagePasswordsBubbleView* bubble); | 647 explicit WebContentMouseHandler(ManagePasswordsBubbleView* bubble); |
653 virtual ~WebContentMouseHandler(); | 648 ~WebContentMouseHandler() override; |
654 | 649 |
655 virtual void OnKeyEvent(ui::KeyEvent* event) override; | 650 void OnKeyEvent(ui::KeyEvent* event) override; |
656 virtual void OnMouseEvent(ui::MouseEvent* event) override; | 651 void OnMouseEvent(ui::MouseEvent* event) override; |
657 | 652 |
658 private: | 653 private: |
659 aura::Window* GetWebContentsWindow(); | 654 aura::Window* GetWebContentsWindow(); |
660 | 655 |
661 ManagePasswordsBubbleView* bubble_; | 656 ManagePasswordsBubbleView* bubble_; |
662 | 657 |
663 DISALLOW_COPY_AND_ASSIGN(WebContentMouseHandler); | 658 DISALLOW_COPY_AND_ASSIGN(WebContentMouseHandler); |
664 }; | 659 }; |
665 | 660 |
666 ManagePasswordsBubbleView::WebContentMouseHandler::WebContentMouseHandler( | 661 ManagePasswordsBubbleView::WebContentMouseHandler::WebContentMouseHandler( |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
870 | 865 |
871 void ManagePasswordsBubbleView::Observe( | 866 void ManagePasswordsBubbleView::Observe( |
872 int type, | 867 int type, |
873 const content::NotificationSource& source, | 868 const content::NotificationSource& source, |
874 const content::NotificationDetails& details) { | 869 const content::NotificationDetails& details) { |
875 DCHECK_EQ(type, chrome::NOTIFICATION_FULLSCREEN_CHANGED); | 870 DCHECK_EQ(type, chrome::NOTIFICATION_FULLSCREEN_CHANGED); |
876 aura::Window* window = GetWidget()->GetNativeView(); | 871 aura::Window* window = GetWidget()->GetNativeView(); |
877 wm::SetWindowVisibilityAnimationTransition(window, wm::ANIMATE_NONE); | 872 wm::SetWindowVisibilityAnimationTransition(window, wm::ANIMATE_NONE); |
878 CloseBubble(); | 873 CloseBubble(); |
879 } | 874 } |
OLD | NEW |