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

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

Issue 739793003: Close bubbles not on UpdateToolbar but when the activated tab is changed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 952 matching lines...) Expand 10 before | Expand all | Expand 10 after
963 963
964 //////////////////////////////////////////////////////////////////////////////// 964 ////////////////////////////////////////////////////////////////////////////////
965 // LocationBarView, public OmniboxEditController implementation: 965 // LocationBarView, public OmniboxEditController implementation:
966 966
967 void LocationBarView::Update(const WebContents* contents) { 967 void LocationBarView::Update(const WebContents* contents) {
968 mic_search_view_->SetVisible( 968 mic_search_view_->SetVisible(
969 !GetToolbarModel()->input_in_progress() && browser_ && 969 !GetToolbarModel()->input_in_progress() && browser_ &&
970 browser_->search_model()->voice_search_supported()); 970 browser_->search_model()->voice_search_supported());
971 RefreshContentSettingViews(); 971 RefreshContentSettingViews();
972 generated_credit_card_view_->Update(); 972 generated_credit_card_view_->Update();
973 ZoomBubbleView::CloseBubble();
974 TranslateBubbleView::CloseBubble();
975 RefreshZoomView(); 973 RefreshZoomView();
976 RefreshPageActionViews(); 974 RefreshPageActionViews();
977 RefreshTranslateIcon(); 975 RefreshTranslateIcon();
978 RefreshManagePasswordsIconView(); 976 RefreshManagePasswordsIconView();
979 content::WebContents* web_contents_for_sub_views = 977 content::WebContents* web_contents_for_sub_views =
980 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); 978 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents();
981 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); 979 open_pdf_in_reader_view_->Update(web_contents_for_sub_views);
982 980
983 if (star_view_) 981 if (star_view_)
984 UpdateBookmarkStarVisibility(); 982 UpdateBookmarkStarVisibility();
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
1130 return changed; 1128 return changed;
1131 } 1129 }
1132 1130
1133 bool LocationBarView::RefreshZoomView() { 1131 bool LocationBarView::RefreshZoomView() {
1134 DCHECK(zoom_view_); 1132 DCHECK(zoom_view_);
1135 WebContents* web_contents = GetWebContents(); 1133 WebContents* web_contents = GetWebContents();
1136 if (!web_contents) 1134 if (!web_contents)
1137 return false; 1135 return false;
1138 const bool was_visible = zoom_view_->visible(); 1136 const bool was_visible = zoom_view_->visible();
1139 zoom_view_->Update(ZoomController::FromWebContents(web_contents)); 1137 zoom_view_->Update(ZoomController::FromWebContents(web_contents));
1138 if (!zoom_view_->visible())
1139 ZoomBubbleView::CloseBubble();
1140 return was_visible != zoom_view_->visible(); 1140 return was_visible != zoom_view_->visible();
1141 } 1141 }
1142 1142
1143 void LocationBarView::RefreshTranslateIcon() { 1143 void LocationBarView::RefreshTranslateIcon() {
1144 if (!TranslateService::IsTranslateBubbleEnabled()) 1144 if (!TranslateService::IsTranslateBubbleEnabled())
1145 return; 1145 return;
1146 1146
1147 WebContents* web_contents = GetWebContents(); 1147 WebContents* web_contents = GetWebContents();
1148 if (!web_contents) 1148 if (!web_contents)
1149 return; 1149 return;
1150 translate::LanguageState& language_state = 1150 translate::LanguageState& language_state =
1151 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); 1151 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState();
1152 bool enabled = language_state.translate_enabled(); 1152 bool enabled = language_state.translate_enabled();
1153 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); 1153 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled);
1154 translate_icon_view_->SetVisible(enabled); 1154 translate_icon_view_->SetVisible(enabled);
1155 translate_icon_view_->SetToggled(language_state.IsPageTranslated()); 1155 translate_icon_view_->SetToggled(language_state.IsPageTranslated());
1156 if (!enabled)
1157 TranslateBubbleView::CloseBubble();
1156 } 1158 }
1157 1159
1158 bool LocationBarView::RefreshManagePasswordsIconView() { 1160 bool LocationBarView::RefreshManagePasswordsIconView() {
1159 DCHECK(manage_passwords_icon_view_); 1161 DCHECK(manage_passwords_icon_view_);
1160 WebContents* web_contents = GetWebContents(); 1162 WebContents* web_contents = GetWebContents();
1161 if (!web_contents) 1163 if (!web_contents)
1162 return false; 1164 return false;
1163 const bool was_visible = manage_passwords_icon_view_->visible(); 1165 const bool was_visible = manage_passwords_icon_view_->visible();
1164 ManagePasswordsUIController::FromWebContents( 1166 ManagePasswordsUIController::FromWebContents(
1165 web_contents)->UpdateIconAndBubbleState(manage_passwords_icon_view_); 1167 web_contents)->UpdateIconAndBubbleState(manage_passwords_icon_view_);
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1656 1658
1657 void LocationBarView::ModelChanged(const SearchModel::State& old_state, 1659 void LocationBarView::ModelChanged(const SearchModel::State& old_state,
1658 const SearchModel::State& new_state) { 1660 const SearchModel::State& new_state) {
1659 const bool visible = !GetToolbarModel()->input_in_progress() && 1661 const bool visible = !GetToolbarModel()->input_in_progress() &&
1660 new_state.voice_search_supported; 1662 new_state.voice_search_supported;
1661 if (mic_search_view_->visible() != visible) { 1663 if (mic_search_view_->visible() != visible) {
1662 mic_search_view_->SetVisible(visible); 1664 mic_search_view_->SetVisible(visible);
1663 Layout(); 1665 Layout();
1664 } 1666 }
1665 } 1667 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698