OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
757 profile:profile()]; | 757 profile:profile()]; |
758 } | 758 } |
759 | 759 |
760 void LocationBarViewMac::UpdateTranslateDecoration() { | 760 void LocationBarViewMac::UpdateTranslateDecoration() { |
761 if (!TranslateService::IsTranslateBubbleEnabled()) | 761 if (!TranslateService::IsTranslateBubbleEnabled()) |
762 return; | 762 return; |
763 | 763 |
764 WebContents* web_contents = GetWebContents(); | 764 WebContents* web_contents = GetWebContents(); |
765 if (!web_contents) | 765 if (!web_contents) |
766 return; | 766 return; |
767 LanguageState& language_state = | 767 translate::LanguageState& language_state = |
768 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); | 768 ChromeTranslateClient::FromWebContents(web_contents)->GetLanguageState(); |
769 bool enabled = language_state.translate_enabled(); | 769 bool enabled = language_state.translate_enabled(); |
770 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); | 770 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); |
771 translate_decoration_->SetVisible(enabled); | 771 translate_decoration_->SetVisible(enabled); |
772 translate_decoration_->SetLit(language_state.IsPageTranslated()); | 772 translate_decoration_->SetLit(language_state.IsPageTranslated()); |
773 } | 773 } |
774 | 774 |
775 void LocationBarViewMac::UpdateZoomDecoration() { | 775 void LocationBarViewMac::UpdateZoomDecoration() { |
776 WebContents* web_contents = GetWebContents(); | 776 WebContents* web_contents = GetWebContents(); |
777 if (!web_contents) | 777 if (!web_contents) |
778 return; | 778 return; |
779 | 779 |
780 zoom_decoration_->Update(ZoomController::FromWebContents(web_contents)); | 780 zoom_decoration_->Update(ZoomController::FromWebContents(web_contents)); |
781 } | 781 } |
782 | 782 |
783 void LocationBarViewMac::UpdateStarDecorationVisibility() { | 783 void LocationBarViewMac::UpdateStarDecorationVisibility() { |
784 star_decoration_->SetVisible(IsStarEnabled()); | 784 star_decoration_->SetVisible(IsStarEnabled()); |
785 } | 785 } |
786 | 786 |
787 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 787 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
788 bool is_visible = !GetToolbarModel()->input_in_progress() && | 788 bool is_visible = !GetToolbarModel()->input_in_progress() && |
789 browser_->search_model()->voice_search_supported(); | 789 browser_->search_model()->voice_search_supported(); |
790 if (mic_search_decoration_->IsVisible() == is_visible) | 790 if (mic_search_decoration_->IsVisible() == is_visible) |
791 return false; | 791 return false; |
792 mic_search_decoration_->SetVisible(is_visible); | 792 mic_search_decoration_->SetVisible(is_visible); |
793 return true; | 793 return true; |
794 } | 794 } |
OLD | NEW |