| 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 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
| 24 #include "chrome/browser/extensions/location_bar_controller.h" | 24 #include "chrome/browser/extensions/location_bar_controller.h" |
| 25 #include "chrome/browser/extensions/tab_helper.h" | 25 #include "chrome/browser/extensions/tab_helper.h" |
| 26 #include "chrome/browser/profiles/profile.h" | 26 #include "chrome/browser/profiles/profile.h" |
| 27 #include "chrome/browser/search/instant_service.h" | 27 #include "chrome/browser/search/instant_service.h" |
| 28 #include "chrome/browser/search/instant_service_factory.h" | 28 #include "chrome/browser/search/instant_service_factory.h" |
| 29 #include "chrome/browser/search/search.h" | 29 #include "chrome/browser/search/search.h" |
| 30 #include "chrome/browser/search_engines/template_url.h" | 30 #include "chrome/browser/search_engines/template_url.h" |
| 31 #include "chrome/browser/search_engines/template_url_service.h" | 31 #include "chrome/browser/search_engines/template_url_service.h" |
| 32 #include "chrome/browser/search_engines/template_url_service_factory.h" | 32 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 33 #include "chrome/browser/translate/translate_service.h" |
| 33 #include "chrome/browser/translate/translate_tab_helper.h" | 34 #include "chrome/browser/translate/translate_tab_helper.h" |
| 34 #include "chrome/browser/ui/browser_instant_controller.h" | 35 #include "chrome/browser/ui/browser_instant_controller.h" |
| 35 #include "chrome/browser/ui/browser_list.h" | 36 #include "chrome/browser/ui/browser_list.h" |
| 36 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 37 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
| 37 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 38 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
| 38 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" | 39 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" |
| 39 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 40 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| 40 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 41 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 41 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" | 42 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" |
| 42 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" | 43 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" |
| (...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 const NSPoint kOffset = NSMakePoint( | 746 const NSPoint kOffset = NSMakePoint( |
| 746 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, | 747 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, |
| 747 kFirstRunBubbleYOffset); | 748 kFirstRunBubbleYOffset); |
| 748 [FirstRunBubbleController showForView:field_ | 749 [FirstRunBubbleController showForView:field_ |
| 749 offset:kOffset | 750 offset:kOffset |
| 750 browser:browser_ | 751 browser:browser_ |
| 751 profile:profile()]; | 752 profile:profile()]; |
| 752 } | 753 } |
| 753 | 754 |
| 754 void LocationBarViewMac::UpdateTranslateDecoration() { | 755 void LocationBarViewMac::UpdateTranslateDecoration() { |
| 756 if (!TranslateService::IsTranslateBubbleEnabled()) |
| 757 return; |
| 758 |
| 755 WebContents* web_contents = GetWebContents(); | 759 WebContents* web_contents = GetWebContents(); |
| 756 if (!web_contents) | 760 if (!web_contents) |
| 757 return; | 761 return; |
| 758 LanguageState& language_state = | 762 LanguageState& language_state = |
| 759 TranslateTabHelper::FromWebContents(web_contents)->GetLanguageState(); | 763 TranslateTabHelper::FromWebContents(web_contents)->GetLanguageState(); |
| 760 bool enabled = language_state.translate_enabled(); | 764 bool enabled = language_state.translate_enabled(); |
| 761 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); | 765 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); |
| 762 translate_decoration_->SetVisible(enabled); | 766 translate_decoration_->SetVisible(enabled); |
| 763 translate_decoration_->SetLit(language_state.IsPageTranslated()); | 767 translate_decoration_->SetLit(language_state.IsPageTranslated()); |
| 764 } | 768 } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 776 } | 780 } |
| 777 | 781 |
| 778 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 782 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 779 bool is_visible = !GetToolbarModel()->input_in_progress() && | 783 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 780 browser_->search_model()->voice_search_supported(); | 784 browser_->search_model()->voice_search_supported(); |
| 781 if (mic_search_decoration_->IsVisible() == is_visible) | 785 if (mic_search_decoration_->IsVisible() == is_visible) |
| 782 return false; | 786 return false; |
| 783 mic_search_decoration_->SetVisible(is_visible); | 787 mic_search_decoration_->SetVisible(is_visible); |
| 784 return true; | 788 return true; |
| 785 } | 789 } |
| OLD | NEW |