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

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: Fixed typo 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 manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE); 542 manage_passwords_bubble_->SetArrowPaintType(views::BubbleBorder::PAINT_NONE);
543 // set_use_focusless(true) has adverse effect on Windows.
544 // 1) The bubble can't be the active window (which is not desired behavior).
545 // 2) The bubble doesn't get WM_LBUTTONDOWN event. Therefore, all the buttons
546 // get stuck.
547 // TODO(vasilii): remove this line once the bug in infrastructure is resolved.
548 manage_passwords_bubble_->set_use_focusless(false);
549 } 543 }
550 544
551 // static 545 // static
552 void ManagePasswordsBubbleView::CloseBubble() { 546 void ManagePasswordsBubbleView::CloseBubble() {
553 if (manage_passwords_bubble_) 547 if (manage_passwords_bubble_)
554 manage_passwords_bubble_->Close(); 548 manage_passwords_bubble_->Close();
555 } 549 }
556 550
557 // static 551 // static
558 bool ManagePasswordsBubbleView::IsShowing() { 552 bool ManagePasswordsBubbleView::IsShowing() {
559 // The bubble may be in the process of closing. 553 // The bubble may be in the process of closing.
560 return (manage_passwords_bubble_ != NULL) && 554 return (manage_passwords_bubble_ != NULL) &&
561 manage_passwords_bubble_->GetWidget()->IsVisible(); 555 manage_passwords_bubble_->GetWidget()->IsVisible();
562 } 556 }
563 557
564 ManagePasswordsBubbleView::ManagePasswordsBubbleView( 558 ManagePasswordsBubbleView::ManagePasswordsBubbleView(
565 content::WebContents* web_contents, 559 content::WebContents* web_contents,
566 ManagePasswordsIconView* anchor_view, 560 ManagePasswordsIconView* anchor_view,
567 DisplayReason reason) 561 DisplayReason reason)
568 : ManagePasswordsBubble(web_contents, reason), 562 : ManagePasswordsBubble(web_contents, reason),
569 BubbleDelegateView(anchor_view, 563 BubbleDelegateView(anchor_view,
570 anchor_view ? views::BubbleBorder::TOP_RIGHT 564 anchor_view ? views::BubbleBorder::TOP_RIGHT
571 : views::BubbleBorder::NONE), 565 : views::BubbleBorder::NONE),
572 anchor_view_(anchor_view), 566 anchor_view_(anchor_view),
573 never_save_passwords_(false) { 567 never_save_passwords_(false) {
574 // Compensate for built-in vertical padding in the anchor view's image. 568 // Compensate for built-in vertical padding in the anchor view's image.
575 set_anchor_view_insets(gfx::Insets(2, 0, 2, 0)); 569 set_anchor_view_insets(gfx::Insets(2, 0, 2, 0));
576 // Don't focus by default.
577 set_use_focusless(true);
578 if (anchor_view) 570 if (anchor_view)
579 anchor_view->SetActive(true); 571 anchor_view->SetActive(true);
580 } 572 }
581 573
582 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() { 574 ManagePasswordsBubbleView::~ManagePasswordsBubbleView() {
583 if (anchor_view_) 575 if (anchor_view_)
584 anchor_view_->SetActive(false); 576 anchor_view_->SetActive(false);
585 } 577 }
586 578
587 void ManagePasswordsBubbleView::AdjustForFullscreen( 579 void ManagePasswordsBubbleView::AdjustForFullscreen(
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
646 638
647 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() { 639 void ManagePasswordsBubbleView::NotifyConfirmedNeverForThisSite() {
648 model()->OnNeverForThisSiteClicked(); 640 model()->OnNeverForThisSiteClicked();
649 Close(); 641 Close();
650 } 642 }
651 643
652 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() { 644 void ManagePasswordsBubbleView::NotifyUndoNeverForThisSite() {
653 never_save_passwords_ = false; 645 never_save_passwords_ = false;
654 Refresh(); 646 Refresh();
655 } 647 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698