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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 1568983002: Close the save card bubble on tab switch. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 15 matching lines...) Expand all
26 #include "chrome/browser/translate/chrome_translate_client.h" 26 #include "chrome/browser/translate/chrome_translate_client.h"
27 #include "chrome/browser/translate/translate_service.h" 27 #include "chrome/browser/translate/translate_service.h"
28 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h" 28 #include "chrome/browser/ui/autofill/save_card_bubble_controller_impl.h"
29 #include "chrome/browser/ui/browser.h" 29 #include "chrome/browser/ui/browser.h"
30 #include "chrome/browser/ui/browser_finder.h" 30 #include "chrome/browser/ui/browser_finder.h"
31 #include "chrome/browser/ui/browser_window.h" 31 #include "chrome/browser/ui/browser_window.h"
32 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" 32 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
33 #include "chrome/browser/ui/layout_constants.h" 33 #include "chrome/browser/ui/layout_constants.h"
34 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" 34 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h"
35 #include "chrome/browser/ui/tabs/tab_strip_model.h" 35 #include "chrome/browser/ui/tabs/tab_strip_model.h"
36 #include "chrome/browser/ui/views/autofill/save_card_bubble_views.h"
36 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h" 37 #include "chrome/browser/ui/views/autofill/save_card_icon_view.h"
37 #include "chrome/browser/ui/views/browser_dialogs.h" 38 #include "chrome/browser/ui/views/browser_dialogs.h"
38 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h" 39 #include "chrome/browser/ui/views/location_bar/background_with_1_px_border.h"
39 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h" 40 #include "chrome/browser/ui/views/location_bar/content_setting_image_view.h"
40 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h" 41 #include "chrome/browser/ui/views/location_bar/keyword_hint_view.h"
41 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h" 42 #include "chrome/browser/ui/views/location_bar/location_bar_layout.h"
42 #include "chrome/browser/ui/views/location_bar/location_icon_view.h" 43 #include "chrome/browser/ui/views/location_bar/location_icon_view.h"
43 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h" 44 #include "chrome/browser/ui/views/location_bar/open_pdf_in_reader_view.h"
44 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h" 45 #include "chrome/browser/ui/views/location_bar/page_action_image_view.h"
45 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h" 46 #include "chrome/browser/ui/views/location_bar/page_action_with_badge_view.h"
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 return false; 983 return false;
983 984
984 const bool was_visible = save_credit_card_icon_view_->visible(); 985 const bool was_visible = save_credit_card_icon_view_->visible();
985 // |controller| may be nullptr due to lazy initialization. 986 // |controller| may be nullptr due to lazy initialization.
986 autofill::SaveCardBubbleControllerImpl* controller = 987 autofill::SaveCardBubbleControllerImpl* controller =
987 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents); 988 autofill::SaveCardBubbleControllerImpl::FromWebContents(web_contents);
988 bool enabled = controller && controller->IsIconVisible(); 989 bool enabled = controller && controller->IsIconVisible();
989 command_updater()->UpdateCommandEnabled(IDC_SAVE_CREDIT_CARD_FOR_PAGE, 990 command_updater()->UpdateCommandEnabled(IDC_SAVE_CREDIT_CARD_FOR_PAGE,
990 enabled); 991 enabled);
991 save_credit_card_icon_view_->SetVisible(enabled); 992 save_credit_card_icon_view_->SetVisible(enabled);
993 if (!enabled)
994 autofill::SaveCardBubbleViews::CloseBubble();
Evan Stade 2016/01/08 03:19:45 save_credit_card_icon_view_->GetBubble()->Hide()?
Justin Donnelly 2016/01/08 18:14:05 Yes, that's very much what I'd prefer to do. The p
992 995
993 return was_visible != save_credit_card_icon_view_->visible(); 996 return was_visible != save_credit_card_icon_view_->visible();
994 } 997 }
995 998
996 void LocationBarView::RefreshTranslateIcon() { 999 void LocationBarView::RefreshTranslateIcon() {
997 WebContents* web_contents = GetWebContents(); 1000 WebContents* web_contents = GetWebContents();
998 if (!web_contents) 1001 if (!web_contents)
999 return; 1002 return;
1000 translate::LanguageState& language_state = 1003 translate::LanguageState& language_state =
1001 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); 1004 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState();
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 // LocationBarView, private TemplateURLServiceObserver implementation: 1375 // LocationBarView, private TemplateURLServiceObserver implementation:
1373 1376
1374 void LocationBarView::OnTemplateURLServiceChanged() { 1377 void LocationBarView::OnTemplateURLServiceChanged() {
1375 template_url_service_->RemoveObserver(this); 1378 template_url_service_->RemoveObserver(this);
1376 template_url_service_ = nullptr; 1379 template_url_service_ = nullptr;
1377 // If the browser is no longer active, let's not show the info bubble, as this 1380 // If the browser is no longer active, let's not show the info bubble, as this
1378 // would make the browser the active window again. 1381 // would make the browser the active window again.
1379 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1382 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1380 ShowFirstRunBubble(); 1383 ShowFirstRunBubble();
1381 } 1384 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698