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 "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/browser_window.h" | 10 #include "chrome/browser/ui/browser_window.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 } | 119 } |
| 120 | 120 |
| 121 } // namespace | 121 } // namespace |
| 122 | 122 |
| 123 | 123 |
| 124 // Globals -------------------------------------------------------------------- | 124 // Globals -------------------------------------------------------------------- |
| 125 | 125 |
| 126 namespace chrome { | 126 namespace chrome { |
| 127 | 127 |
| 128 void ShowManagePasswordsBubble(content::WebContents* web_contents) { | 128 void ShowManagePasswordsBubble(content::WebContents* web_contents) { |
| 129 if (ManagePasswordsBubbleView::IsShowing()) { | |
|
Peter Kasting
2014/07/23 17:58:23
Nit: No {}
You might want a brief note about why
vasilii
2014/07/24 15:43:18
Done.
| |
| 130 ManagePasswordsBubbleView::CloseBubble(); | |
| 131 } | |
| 129 ManagePasswordsUIController* controller = | 132 ManagePasswordsUIController* controller = |
| 130 ManagePasswordsUIController::FromWebContents(web_contents); | 133 ManagePasswordsUIController::FromWebContents(web_contents); |
| 131 ManagePasswordsBubbleView::ShowBubble( | 134 ManagePasswordsBubbleView::ShowBubble( |
| 132 web_contents, | 135 web_contents, |
| 133 controller->state() == | 136 controller->state() == |
| 134 password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE | 137 password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE |
| 135 ? ManagePasswordsBubbleView::AUTOMATIC | 138 ? ManagePasswordsBubbleView::AUTOMATIC |
| 136 : ManagePasswordsBubbleView::USER_ACTION); | 139 : ManagePasswordsBubbleView::USER_ACTION); |
| 137 } | 140 } |
| 138 | 141 |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 427 parent_->Close(); | 430 parent_->Close(); |
| 428 } | 431 } |
| 429 | 432 |
| 430 // ManagePasswordsBubbleView -------------------------------------------------- | 433 // ManagePasswordsBubbleView -------------------------------------------------- |
| 431 | 434 |
| 432 // static | 435 // static |
| 433 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = | 436 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = |
| 434 NULL; | 437 NULL; |
| 435 | 438 |
| 436 // static | 439 // static |
| 437 const ManagePasswordsBubbleView* ManagePasswordsBubbleView::Bubble() { | |
| 438 return ManagePasswordsBubbleView::manage_passwords_bubble_; | |
| 439 } | |
| 440 | |
| 441 // static | |
| 442 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, | 440 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, |
| 443 DisplayReason reason) { | 441 DisplayReason reason) { |
| 444 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 442 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
| 445 DCHECK(browser); | 443 DCHECK(browser); |
| 446 DCHECK(browser->window()); | 444 DCHECK(browser->window()); |
| 447 DCHECK(browser->fullscreen_controller()); | 445 DCHECK(browser->fullscreen_controller()); |
| 448 | 446 |
| 449 if (IsShowing()) | 447 if (IsShowing()) |
| 450 return; | 448 return; |
| 451 | 449 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 486 manage_passwords_bubble_->Close(); | 484 manage_passwords_bubble_->Close(); |
| 487 } | 485 } |
| 488 | 486 |
| 489 // static | 487 // static |
| 490 bool ManagePasswordsBubbleView::IsShowing() { | 488 bool ManagePasswordsBubbleView::IsShowing() { |
| 491 // The bubble may be in the process of closing. | 489 // The bubble may be in the process of closing. |
| 492 return (manage_passwords_bubble_ != NULL) && | 490 return (manage_passwords_bubble_ != NULL) && |
| 493 manage_passwords_bubble_->GetWidget()->IsVisible(); | 491 manage_passwords_bubble_->GetWidget()->IsVisible(); |
| 494 } | 492 } |
| 495 | 493 |
| 494 // static | |
| 495 const ManagePasswordsBubbleView* ManagePasswordsBubbleView::Bubble() { | |
| 496 return ManagePasswordsBubbleView::manage_passwords_bubble_; | |
|
Peter Kasting
2014/07/23 17:58:23
Nit: This is a simple getter, so it should probabl
vasilii
2014/07/24 15:43:18
Done.
| |
| 497 } | |
| 498 | |
| 496 ManagePasswordsBubbleView::ManagePasswordsBubbleView( | 499 ManagePasswordsBubbleView::ManagePasswordsBubbleView( |
| 497 content::WebContents* web_contents, | 500 content::WebContents* web_contents, |
| 498 ManagePasswordsIconView* anchor_view, | 501 ManagePasswordsIconView* anchor_view, |
| 499 DisplayReason reason) | 502 DisplayReason reason) |
| 500 : ManagePasswordsBubble(web_contents, reason), | 503 : ManagePasswordsBubble(web_contents, reason), |
| 501 BubbleDelegateView(anchor_view, | 504 BubbleDelegateView(anchor_view, |
| 502 anchor_view ? views::BubbleBorder::TOP_RIGHT | 505 anchor_view ? views::BubbleBorder::TOP_RIGHT |
| 503 : views::BubbleBorder::NONE), | 506 : views::BubbleBorder::NONE), |
| 504 anchor_view_(anchor_view), | 507 anchor_view_(anchor_view), |
| 505 never_save_passwords_(false) { | 508 never_save_passwords_(false) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 576 | 579 |
| 577 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { | 580 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { |
| 578 model()->OnNeverForThisSiteClicked(); | 581 model()->OnNeverForThisSiteClicked(); |
| 579 Close(); | 582 Close(); |
| 580 } | 583 } |
| 581 | 584 |
| 582 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { | 585 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { |
| 583 never_save_passwords_ = false; | 586 never_save_passwords_ = false; |
| 584 Refresh(); | 587 Refresh(); |
| 585 } | 588 } |
| OLD | NEW |