| 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 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 976 } | 976 } |
| 977 | 977 |
| 978 bool LocationBarView::RefreshZoomView() { | 978 bool LocationBarView::RefreshZoomView() { |
| 979 DCHECK(zoom_view_); | 979 DCHECK(zoom_view_); |
| 980 WebContents* web_contents = GetWebContents(); | 980 WebContents* web_contents = GetWebContents(); |
| 981 if (!web_contents) | 981 if (!web_contents) |
| 982 return false; | 982 return false; |
| 983 const bool was_visible = zoom_view_->visible(); | 983 const bool was_visible = zoom_view_->visible(); |
| 984 zoom_view_->Update(ui_zoom::ZoomController::FromWebContents(web_contents)); | 984 zoom_view_->Update(ui_zoom::ZoomController::FromWebContents(web_contents)); |
| 985 if (!zoom_view_->visible()) | 985 if (!zoom_view_->visible()) |
| 986 ZoomBubbleView::CloseBubble(); | 986 ZoomBubbleView::CloseCurrentBubble(); |
| 987 return was_visible != zoom_view_->visible(); | 987 return was_visible != zoom_view_->visible(); |
| 988 } | 988 } |
| 989 | 989 |
| 990 void LocationBarView::OnDefaultZoomLevelChanged() { | 990 void LocationBarView::OnDefaultZoomLevelChanged() { |
| 991 RefreshZoomView(); | 991 RefreshZoomView(); |
| 992 } | 992 } |
| 993 | 993 |
| 994 bool LocationBarView::RefreshSaveCreditCardIconView() { | 994 bool LocationBarView::RefreshSaveCreditCardIconView() { |
| 995 WebContents* web_contents = GetWebContents(); | 995 WebContents* web_contents = GetWebContents(); |
| 996 if (!web_contents) | 996 if (!web_contents) |
| (...skipping 14 matching lines...) Expand all Loading... |
| 1011 void LocationBarView::RefreshTranslateIcon() { | 1011 void LocationBarView::RefreshTranslateIcon() { |
| 1012 WebContents* web_contents = GetWebContents(); | 1012 WebContents* web_contents = GetWebContents(); |
| 1013 if (!web_contents) | 1013 if (!web_contents) |
| 1014 return; | 1014 return; |
| 1015 translate::LanguageState& language_state = | 1015 translate::LanguageState& language_state = |
| 1016 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); | 1016 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); |
| 1017 bool enabled = language_state.translate_enabled(); | 1017 bool enabled = language_state.translate_enabled(); |
| 1018 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); | 1018 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); |
| 1019 translate_icon_view_->SetVisible(enabled); | 1019 translate_icon_view_->SetVisible(enabled); |
| 1020 if (!enabled) | 1020 if (!enabled) |
| 1021 TranslateBubbleView::CloseBubble(); | 1021 TranslateBubbleView::CloseCurrentBubble(); |
| 1022 } | 1022 } |
| 1023 | 1023 |
| 1024 bool LocationBarView::RefreshManagePasswordsIconView() { | 1024 bool LocationBarView::RefreshManagePasswordsIconView() { |
| 1025 DCHECK(manage_passwords_icon_view_); | 1025 DCHECK(manage_passwords_icon_view_); |
| 1026 WebContents* web_contents = GetWebContents(); | 1026 WebContents* web_contents = GetWebContents(); |
| 1027 if (!web_contents) | 1027 if (!web_contents) |
| 1028 return false; | 1028 return false; |
| 1029 const bool was_visible = manage_passwords_icon_view_->visible(); | 1029 const bool was_visible = manage_passwords_icon_view_->visible(); |
| 1030 ManagePasswordsUIController::FromWebContents( | 1030 ManagePasswordsUIController::FromWebContents( |
| 1031 web_contents)->UpdateIconAndBubbleState(manage_passwords_icon_view_); | 1031 web_contents)->UpdateIconAndBubbleState(manage_passwords_icon_view_); |
| (...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1388 // LocationBarView, private TemplateURLServiceObserver implementation: | 1388 // LocationBarView, private TemplateURLServiceObserver implementation: |
| 1389 | 1389 |
| 1390 void LocationBarView::OnTemplateURLServiceChanged() { | 1390 void LocationBarView::OnTemplateURLServiceChanged() { |
| 1391 template_url_service_->RemoveObserver(this); | 1391 template_url_service_->RemoveObserver(this); |
| 1392 template_url_service_ = nullptr; | 1392 template_url_service_ = nullptr; |
| 1393 // If the browser is no longer active, let's not show the info bubble, as this | 1393 // If the browser is no longer active, let's not show the info bubble, as this |
| 1394 // would make the browser the active window again. | 1394 // would make the browser the active window again. |
| 1395 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) | 1395 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) |
| 1396 ShowFirstRunBubble(); | 1396 ShowFirstRunBubble(); |
| 1397 } | 1397 } |
| OLD | NEW |