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

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

Issue 413433002: Refactor BubbleDelegateView::use_focuseless() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit + rebase 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 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 web_contents->GetTopLevelNativeWindow()); 531 web_contents->GetTopLevelNativeWindow());
532 } 532 }
533 533
534 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_); 534 views::BubbleDelegateView::CreateBubble(manage_passwords_bubble_);
535 535
536 // Adjust for fullscreen after creation as it relies on the content size. 536 // Adjust for fullscreen after creation as it relies on the content size.
537 if (is_fullscreen) { 537 if (is_fullscreen) {
538 manage_passwords_bubble_->AdjustForFullscreen( 538 manage_passwords_bubble_->AdjustForFullscreen(
539 browser_view->GetBoundsInScreen()); 539 browser_view->GetBoundsInScreen());
540 } 540 }
541 manage_passwords_bubble_->GetWidget()->Show(); 541 manage_passwords_bubble_->GetWidget()->ShowInactive();
542 // set_use_focusless(true) has adverse effect on Windows.
543 // 1) The bubble can't be the active window (which is not desired behavior).
544 // 2) The bubble doesn't get WM_LBUTTONDOWN event. Therefore, all the buttons
545 // get stuck.
546 // TODO(vasilii): remove this line once the bug in infrastructure is resolved.
547 manage_passwords_bubble_->set_use_focusless(false);
548 } 542 }
549 543
550 // static 544 // static
551 void ManagePasswordsBubbleView::CloseBubble() { 545 void ManagePasswordsBubbleView::CloseBubble() {
552 if (manage_passwords_bubble_) 546 if (manage_passwords_bubble_)
553 manage_passwords_bubble_->Close(); 547 manage_passwords_bubble_->Close();
554 } 548 }
555 549
556 // static 550 // static
557 bool ManagePasswordsBubbleView::IsShowing() { 551 bool ManagePasswordsBubbleView::IsShowing() {
558 // The bubble may be in the process of closing. 552 // The bubble may be in the process of closing.
559 return (manage_passwords_bubble_ != NULL) && 553 return (manage_passwords_bubble_ != NULL) &&
560 manage_passwords_bubble_->GetWidget()->IsVisible(); 554 manage_passwords_bubble_->GetWidget()->IsVisible();
561 } 555 }
562 556
563 ManagePasswordsBubbleView::ManagePasswordsBubbleView( 557 ManagePasswordsBubbleView::ManagePasswordsBubbleView(
564 content::WebContents* web_contents, 558 content::WebContents* web_contents,
565 ManagePasswordsIconView* anchor_view, 559 ManagePasswordsIconView* anchor_view,
566 DisplayReason reason) 560 DisplayReason reason)
567 : ManagePasswordsBubble(web_contents, reason), 561 : ManagePasswordsBubble(web_contents, reason),
568 BubbleDelegateView(anchor_view, 562 BubbleDelegateView(anchor_view,
569 anchor_view ? views::BubbleBorder::TOP_RIGHT 563 anchor_view ? views::BubbleBorder::TOP_RIGHT
570 : views::BubbleBorder::NONE), 564 : views::BubbleBorder::NONE),
571 anchor_view_(anchor_view), 565 anchor_view_(anchor_view),
572 never_save_passwords_(false) { 566 never_save_passwords_(false) {
573 // Compensate for built-in vertical padding in the anchor view's image. 567 // Compensate for built-in vertical padding in the anchor view's image.
574 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0)); 568 set_anchor_view_insets(gfx::Insets(5, 0, 5, 0));
575 // Don't focus by default.
576 set_use_focusless(true);
577 if (anchor_view) 569 if (anchor_view)
578 anchor_view->SetActive(true); 570 anchor_view->SetActive(true);
579 } 571 }
580 572
581 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { 573 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {
582 if (anchor_view_) 574 if (anchor_view_)
583 anchor_view_->SetActive(false); 575 anchor_view_->SetActive(false);
584 } 576 }
585 577
586 void ManagePasswordsBubbleView::AdjustForFullscreen( 578 void ManagePasswordsBubbleView::AdjustForFullscreen(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 637
646 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { 638 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() {
647 model()->OnNeverForThisSiteClicked(); 639 model()->OnNeverForThisSiteClicked();
648 Close(); 640 Close();
649 } 641 }
650 642
651 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { 643 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() {
652 never_save_passwords_ = false; 644 never_save_passwords_ = false;
653 Refresh(); 645 Refresh();
654 } 646 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698