Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: chrome/browser/ui/views/passwords/manage_passwords_bubble_view.cc

Issue 394403003: Close the password bubble on the icon click. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed the unnecessary command Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 DCHECK(ManagePasswordsBubbleView::Bubble()->web_contents() != web_contents);
Mike West 2014/07/22 12:08:40 Can you add a comment about this case? It's not cl
vasilii 2014/07/22 14:18:51 Done.
131 ManagePasswordsBubbleView::CloseBubble();
132 }
129 ManagePasswordsUIController* controller = 133 ManagePasswordsUIController* controller =
130 ManagePasswordsUIController::FromWebContents(web_contents); 134 ManagePasswordsUIController::FromWebContents(web_contents);
131 ManagePasswordsBubbleView::ShowBubble( 135 ManagePasswordsBubbleView::ShowBubble(
132 web_contents, 136 web_contents,
133 controller->state() == 137 controller->state() ==
134 password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE 138 password_manager::ui::PENDING_PASSWORD_AND_BUBBLE_STATE
135 ? ManagePasswordsBubbleView::AUTOMATIC 139 ? ManagePasswordsBubbleView::AUTOMATIC
136 : ManagePasswordsBubbleView::USER_ACTION); 140 : ManagePasswordsBubbleView::USER_ACTION);
137 } 141 }
138 142
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 parent_->Close(); 431 parent_->Close();
428 } 432 }
429 433
430 // ManagePasswordsBubbleView -------------------------------------------------- 434 // ManagePasswordsBubbleView --------------------------------------------------
431 435
432 // static 436 // static
433 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = 437 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ =
434 NULL; 438 NULL;
435 439
436 // static 440 // static
437 const ManagePasswordsBubbleView* ManagePasswordsBubbleView::Bubble() {
438 return ManagePasswordsBubbleView::manage_passwords_bubble_;
439 }
440
441 // static
442 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, 441 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
443 DisplayReason reason) { 442 DisplayReason reason) {
444 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 443 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
445 DCHECK(browser); 444 DCHECK(browser);
446 DCHECK(browser->window()); 445 DCHECK(browser->window());
447 DCHECK(browser->fullscreen_controller()); 446 DCHECK(browser->fullscreen_controller());
448 447
449 if (IsShowing()) 448 if (IsShowing())
450 return; 449 return;
451 450
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
486 manage_passwords_bubble_->Close(); 485 manage_passwords_bubble_->Close();
487 } 486 }
488 487
489 // static 488 // static
490 bool ManagePasswordsBubbleView::IsShowing() { 489 bool ManagePasswordsBubbleView::IsShowing() {
491 // The bubble may be in the process of closing. 490 // The bubble may be in the process of closing.
492 return (manage_passwords_bubble_ != NULL) && 491 return (manage_passwords_bubble_ != NULL) &&
493 manage_passwords_bubble_->GetWidget()->IsVisible(); 492 manage_passwords_bubble_->GetWidget()->IsVisible();
494 } 493 }
495 494
495 // static
496 const ManagePasswordsBubbleView* ManagePasswordsBubbleView::Bubble() {
497 return ManagePasswordsBubbleView::manage_passwords_bubble_;
498 }
499
500 content::WebContents* ManagePasswordsBubbleView::web_contents() const {
501 return model()->web_contents();
502 }
503
496 ManagePasswordsBubbleView::ManagePasswordsBubbleView( 504 ManagePasswordsBubbleView::ManagePasswordsBubbleView(
497 content::WebContents* web_contents, 505 content::WebContents* web_contents,
498 ManagePasswordsIconView* anchor_view, 506 ManagePasswordsIconView* anchor_view,
499 DisplayReason reason) 507 DisplayReason reason)
500 : ManagePasswordsBubble(web_contents, reason), 508 : ManagePasswordsBubble(web_contents, reason),
501 BubbleDelegateView(anchor_view, 509 BubbleDelegateView(anchor_view,
502 anchor_view ? views::BubbleBorder::TOP_RIGHT 510 anchor_view ? views::BubbleBorder::TOP_RIGHT
503 : views::BubbleBorder::NONE), 511 : views::BubbleBorder::NONE),
504 anchor_view_(anchor_view), 512 anchor_view_(anchor_view),
505 never_save_passwords_(false) { 513 never_save_passwords_(false) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 584
577 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { 585 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() {
578 model()->OnNeverForThisSiteClicked(); 586 model()->OnNeverForThisSiteClicked();
579 Close(); 587 Close();
580 } 588 }
581 589
582 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { 590 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() {
583 never_save_passwords_ = false; 591 never_save_passwords_ = false;
584 Refresh(); 592 Refresh();
585 } 593 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698