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

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

Issue 565673002: Close the password bubble when navigating between tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove debug code Created 6 years, 3 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
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/ui/browser.h" 7 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/browser_finder.h" 8 #include "chrome/browser/ui/browser_finder.h"
9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h" 9 #include "chrome/browser/ui/passwords/manage_passwords_bubble_model.h"
10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 10 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
11 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h" 11 #include "chrome/browser/ui/passwords/save_password_refusal_combobox_model.h"
12 #include "chrome/browser/ui/tabs/tab_strip_model.h"
12 #include "chrome/browser/ui/views/frame/browser_view.h" 13 #include "chrome/browser/ui/views/frame/browser_view.h"
13 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 14 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
14 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h" 15 #include "chrome/browser/ui/views/passwords/manage_password_item_view.h"
15 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h" 16 #include "chrome/browser/ui/views/passwords/manage_passwords_icon_view.h"
16 #include "chrome/grit/generated_resources.h" 17 #include "chrome/grit/generated_resources.h"
17 #include "content/public/browser/render_view_host.h" 18 #include "content/public/browser/render_view_host.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 #include "ui/aura/window.h" 20 #include "ui/aura/window.h"
20 #include "ui/base/l10n/l10n_util.h" 21 #include "ui/base/l10n/l10n_util.h"
21 #include "ui/base/resource/resource_bundle.h" 22 #include "ui/base/resource/resource_bundle.h"
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
751 manage_passwords_bubble_->GetWidget()->Show(); 752 manage_passwords_bubble_->GetWidget()->Show();
752 } 753 }
753 754
754 // static 755 // static
755 void ManagePasswordsBubbleView::CloseBubble() { 756 void ManagePasswordsBubbleView::CloseBubble() {
756 if (manage_passwords_bubble_) 757 if (manage_passwords_bubble_)
757 manage_passwords_bubble_->Close(); 758 manage_passwords_bubble_->Close();
758 } 759 }
759 760
760 // static 761 // static
762 void ManagePasswordsBubbleView::CloseBubbleForInactiveTab() {
763 if (!IsShowing())
764 return;
765 content::WebContents* web_contents =
766 manage_passwords_bubble_->model()->web_contents();
767 Browser* browser = chrome::FindBrowserWithWebContents(web_contents);
768 if (web_contents != browser->tab_strip_model()->GetActiveWebContents())
769 CloseBubble();
770 }
771
772 // static
761 void ManagePasswordsBubbleView::ActivateBubble() { 773 void ManagePasswordsBubbleView::ActivateBubble() {
762 if (!IsShowing()) 774 if (!IsShowing())
763 return; 775 return;
764 manage_passwords_bubble_->GetWidget()->Activate(); 776 manage_passwords_bubble_->GetWidget()->Activate();
765 } 777 }
766 778
767 // static 779 // static
768 bool ManagePasswordsBubbleView::IsShowing() { 780 bool ManagePasswordsBubbleView::IsShowing() {
769 // The bubble may be in the process of closing. 781 // The bubble may be in the process of closing.
770 return (manage_passwords_bubble_ != NULL) && 782 return (manage_passwords_bubble_ != NULL) &&
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 if (!fadeout_observer_) 911 if (!fadeout_observer_)
900 return; 912 return;
901 fadeout_observer_.reset(); 913 fadeout_observer_.reset();
902 aura::Window* window = GetWidget()->GetNativeView(); 914 aura::Window* window = GetWidget()->GetNativeView();
903 window->layer()->SetOpacity(1); 915 window->layer()->SetOpacity(1);
904 } 916 }
905 917
906 void ManagePasswordsBubbleView::OnBubbleDisappeared() { 918 void ManagePasswordsBubbleView::OnBubbleDisappeared() {
907 Close(); 919 Close();
908 } 920 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698