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

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

Issue 396973002: Password bubble: Don't focus by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment + test 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 416 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 parent_->Close(); 427 parent_->Close();
428 } 428 }
429 429
430 // ManagePasswordsBubbleView -------------------------------------------------- 430 // ManagePasswordsBubbleView --------------------------------------------------
431 431
432 // static 432 // static
433 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ = 433 ManagePasswordsBubbleView* ManagePasswordsBubbleView::manage_passwords_bubble_ =
434 NULL; 434 NULL;
435 435
436 // static 436 // static
437 const ManagePasswordsBubbleView* ManagePasswordsBubbleView::Bubble() {
438 return ManagePasswordsBubbleView::manage_passwords_bubble_;
439 }
440
441 // static
437 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents, 442 void ManagePasswordsBubbleView::ShowBubble(content::WebContents* web_contents,
438 DisplayReason reason) { 443 DisplayReason reason) {
439 Browser* browser = chrome::FindBrowserWithWebContents(web_contents); 444 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
440 DCHECK(browser); 445 DCHECK(browser);
441 DCHECK(browser->window()); 446 DCHECK(browser->window());
442 DCHECK(browser->fullscreen_controller()); 447 DCHECK(browser->fullscreen_controller());
443 448
444 if (IsShowing()) 449 if (IsShowing())
445 return; 450 return;
446 451
(...skipping 13 matching lines...) Expand all
460 465
461 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_); 466 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_);
462 467
463 // Adjust for fullscreen after creation as it relies on the content size. 468 // Adjust for fullscreen after creation as it relies on the content size.
464 if (is_fullscreen) { 469 if (is_fullscreen) {
465 manage_passwords_bubble_->AdjustForFullscreen( 470 manage_passwords_bubble_->AdjustForFullscreen(
466 browser_view->GetBoundsInScreen()); 471 browser_view->GetBoundsInScreen());
467 } 472 }
468 manage_passwords_bubble_->GetWidget()->Show(); 473 manage_passwords_bubble_->GetWidget()->Show();
469 manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); 474 manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
475 // set_use_focusless(true) has adverse effect on Windows.
476 // 1) The bubble can't be the active window (which is not desired behavior).
477 // 2) The bubble doesn't get WM_LBUTTONDOWN event. Therefore, all the buttons
478 // get stuck.
479 // TODO(vasilii): remove this line once the bug in infrastructure is resolved.
480 manage_passwords_bubble_->set_use_focusless(false);
470 } 481 }
471 482
472 // static 483 // static
473 void ManagePasswordsBubbleView::CloseBubble() { 484 void ManagePasswordsBubbleView::CloseBubble() {
474 if (manage_passwords_bubble_) 485 if (manage_passwords_bubble_)
475 manage_passwords_bubble_->Close(); 486 manage_passwords_bubble_->Close();
476 } 487 }
477 488
478 // static 489 // static
479 bool ManagePasswordsBubbleView::IsShowing() { 490 bool ManagePasswordsBubbleView::IsShowing() {
480 // The bubble may be in the process of closing. 491 // The bubble may be in the process of closing.
481 return (manage_passwords_bubble_ != NULL) && 492 return (manage_passwords_bubble_ != NULL) &&
482 manage_passwords_bubble_->GetWidget()->IsVisible(); 493 manage_passwords_bubble_->GetWidget()->IsVisible();
483 } 494 }
484 495
485 ManagePasswordsBubbleView::ManagePasswordsBubbleView( 496 ManagePasswordsBubbleView::ManagePasswordsBubbleView(
486 content::WebContents* web_contents, 497 content::WebContents* web_contents,
487 ManagePasswordsIconView* anchor_view, 498 ManagePasswordsIconView* anchor_view,
488 DisplayReason reason) 499 DisplayReason reason)
489 : ManagePasswordsBubble(web_contents, reason), 500 : ManagePasswordsBubble(web_contents, reason),
490 BubbleDelegateView(anchor_view, 501 BubbleDelegateView(anchor_view,
491 anchor_view ? views::BubbleBorder::TOP_RIGHT 502 anchor_view ? views::BubbleBorder::TOP_RIGHT
492 : views::BubbleBorder::NONE), 503 : views::BubbleBorder::NONE),
493 anchor_view_(anchor_view), 504 anchor_view_(anchor_view),
494 never_save_passwords_(false) { 505 never_save_passwords_(false) {
495 // Compensate for built-in vertical padding in the anchor view's image. 506 // Compensate for built-in vertical padding in the anchor view's image.
496 set_anchor_view_insets(gfx::Insets(2, 0, 2, 0)); 507 set_anchor_view_insets(gfx::Insets(2, 0, 2, 0));
497 set_notify_enter_exit_on_child(true); 508 // Don't focus by default.
509 set_use_focusless(true);
498 if (anchor_view) 510 if (anchor_view)
499 anchor_view->SetActive(true); 511 anchor_view->SetActive(true);
500 } 512 }
501 513
502 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { 514 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {
503 if (anchor_view_) 515 if (anchor_view_)
504 anchor_view_->SetActive(false); 516 anchor_view_->SetActive(false);
505 } 517 }
506 518
507 void ManagePasswordsBubbleView::AdjustForFullscreen( 519 void ManagePasswordsBubbleView::AdjustForFullscreen(
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 576
565 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { 577 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() {
566 model()->OnNeverForThisSiteClicked(); 578 model()->OnNeverForThisSiteClicked();
567 Close(); 579 Close();
568 } 580 }
569 581
570 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { 582 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() {
571 never_save_passwords_ = false; 583 never_save_passwords_ = false;
572 Refresh(); 584 Refresh();
573 } 585 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698