OLD | NEW |
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 963 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
974 ZoomBubbleView::CloseBubble(); | 974 ZoomBubbleView::CloseBubble(); |
975 TranslateBubbleView::CloseBubble(); | 975 TranslateBubbleView::CloseBubble(); |
976 RefreshZoomView(); | 976 RefreshZoomView(); |
977 RefreshPageActionViews(); | 977 RefreshPageActionViews(); |
978 RefreshTranslateIcon(); | 978 RefreshTranslateIcon(); |
979 RefreshManagePasswordsIconView(); | 979 RefreshManagePasswordsIconView(); |
980 content::WebContents* web_contents_for_sub_views = | 980 content::WebContents* web_contents_for_sub_views = |
981 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); | 981 GetToolbarModel()->input_in_progress() ? NULL : GetWebContents(); |
982 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); | 982 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); |
983 | 983 |
984 if (star_view_) { | 984 if (star_view_) |
985 star_view_->SetVisible( | 985 UpdateBookmarkStarVisibility(); |
986 browser_defaults::bookmarks_enabled && !is_popup_mode_ && | |
987 !GetToolbarModel()->input_in_progress() && | |
988 edit_bookmarks_enabled_.GetValue() && | |
989 !IsBookmarkStarHiddenByExtension()); | |
990 } | |
991 | 986 |
992 if (contents) | 987 if (contents) |
993 omnibox_view_->OnTabChanged(contents); | 988 omnibox_view_->OnTabChanged(contents); |
994 else | 989 else |
995 omnibox_view_->Update(); | 990 omnibox_view_->Update(); |
996 | 991 |
997 OnChanged(); // NOTE: Calls Layout(). | 992 OnChanged(); // NOTE: Calls Layout(). |
998 } | 993 } |
999 | 994 |
1000 void LocationBarView::ShowURL() { | 995 void LocationBarView::ShowURL() { |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 if (RefreshPageActionViews()) { // Changed. | 1288 if (RefreshPageActionViews()) { // Changed. |
1294 Layout(); | 1289 Layout(); |
1295 SchedulePaint(); | 1290 SchedulePaint(); |
1296 } | 1291 } |
1297 } | 1292 } |
1298 | 1293 |
1299 void LocationBarView::InvalidatePageActions() { | 1294 void LocationBarView::InvalidatePageActions() { |
1300 DeletePageActionViews(); | 1295 DeletePageActionViews(); |
1301 } | 1296 } |
1302 | 1297 |
| 1298 void LocationBarView::UpdateBookmarkStarVisibility() { |
| 1299 if (star_view_) { |
| 1300 star_view_->SetVisible( |
| 1301 browser_defaults::bookmarks_enabled && !is_popup_mode_ && |
| 1302 !GetToolbarModel()->input_in_progress() && |
| 1303 edit_bookmarks_enabled_.GetValue() && |
| 1304 !IsBookmarkStarHiddenByExtension()); |
| 1305 } |
| 1306 } |
| 1307 |
1303 bool LocationBarView::ShowPageActionPopup( | 1308 bool LocationBarView::ShowPageActionPopup( |
1304 const extensions::Extension* extension, | 1309 const extensions::Extension* extension, |
1305 bool grant_tab_permissions) { | 1310 bool grant_tab_permissions) { |
1306 ExtensionAction* extension_action = | 1311 ExtensionAction* extension_action = |
1307 extensions::ExtensionActionManager::Get(profile())->GetPageAction( | 1312 extensions::ExtensionActionManager::Get(profile())->GetPageAction( |
1308 *extension); | 1313 *extension); |
1309 DCHECK(extension_action); | 1314 DCHECK(extension_action); |
1310 return GetPageActionView(extension_action)->image_view()->view_controller()-> | 1315 return GetPageActionView(extension_action)->image_view()->view_controller()-> |
1311 ExecuteAction(ExtensionPopup::SHOW, grant_tab_permissions); | 1316 ExecuteAction(ExtensionPopup::SHOW, grant_tab_permissions); |
1312 } | 1317 } |
(...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1652 | 1657 |
1653 void LocationBarView::ModelChanged(const SearchModel::State& old_state, | 1658 void LocationBarView::ModelChanged(const SearchModel::State& old_state, |
1654 const SearchModel::State& new_state) { | 1659 const SearchModel::State& new_state) { |
1655 const bool visible = !GetToolbarModel()->input_in_progress() && | 1660 const bool visible = !GetToolbarModel()->input_in_progress() && |
1656 new_state.voice_search_supported; | 1661 new_state.voice_search_supported; |
1657 if (mic_search_view_->visible() != visible) { | 1662 if (mic_search_view_->visible() != visible) { |
1658 mic_search_view_->SetVisible(visible); | 1663 mic_search_view_->SetVisible(visible); |
1659 Layout(); | 1664 Layout(); |
1660 } | 1665 } |
1661 } | 1666 } |
OLD | NEW |