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()) { |
| 130 // The bubble is currently shown for some other tab. We should close it now |
| 131 // and open for |web_contents|. |
| 132 ManagePasswordsBubbleView::CloseBubble(); |
| 133 } |
129 ManagePasswordsUIController* controller = | 134 ManagePasswordsUIController* controller = |
130 ManagePasswordsUIController::FromWebContents(web_contents); | 135 ManagePasswordsUIController::FromWebContents(web_contents); |
131 ManagePasswordsBubbleView::ShowBubble( | 136 ManagePasswordsBubbleView::ShowBubble( |
132 web_contents, | 137 web_contents, |
133 controller->state() == | 138 controller->state() == |
134 password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE | 139 password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE |
135 ? ManagePasswordsBubbleView::AUTOMATIC | 140 ? ManagePasswordsBubbleView::AUTOMATIC |
136 : ManagePasswordsBubbleView::USER_ACTION); | 141 : ManagePasswordsBubbleView::USER_ACTION); |
137 } | 142 } |
138 | 143 |
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 parent_->Close(); | 432 parent_->Close(); |
428 } | 433 } |
429 | 434 |
430 // ManagePasswordsBubbleView -------------------------------------------------- | 435 // ManagePasswordsBubbleView -------------------------------------------------- |
431 | 436 |
432 // static | 437 // static |
433 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = | 438 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = |
434 NULL; | 439 NULL; |
435 | 440 |
436 // static | 441 // static |
437 const ManagePasswordsBubbleView* ManagePasswordsBubbleView::Bubble() { | |
438 return ManagePasswordsBubbleView::manage_passwords_bubble_; | |
439 } | |
440 | |
441 // static | |
442 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, | 442 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, |
443 DisplayReason reason) { | 443 DisplayReason reason) { |
444 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); | 444 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); |
445 DCHECK(browser); | 445 DCHECK(browser); |
446 DCHECK(browser->window()); | 446 DCHECK(browser->window()); |
447 DCHECK(browser->fullscreen_controller()); | 447 DCHECK(browser->fullscreen_controller()); |
448 | 448 |
449 if (IsShowing()) | 449 if (IsShowing()) |
450 return; | 450 return; |
451 | 451 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
576 | 576 |
577 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { | 577 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { |
578 model()->OnNeverForThisSiteClicked(); | 578 model()->OnNeverForThisSiteClicked(); |
579 Close(); | 579 Close(); |
580 } | 580 } |
581 | 581 |
582 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { | 582 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { |
583 never_save_passwords_ = false; | 583 never_save_passwords_ = false; |
584 Refresh(); | 584 Refresh(); |
585 } | 585 } |
OLD | NEW |