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

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 203223002: Translate bubble for Mac OS X (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: groby's review Created 6 years, 9 months 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
OLDNEW
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
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 724 matching lines...) Expand 10 before | Expand all | Expand 10 after
767 const NSPoint kOffset = NSMakePoint( 768 const NSPoint kOffset = NSMakePoint(
768 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, 769 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0,
769 kFirstRunBubbleYOffset); 770 kFirstRunBubbleYOffset);
770 [FirstRunBubbleController showForView:field_ 771 [FirstRunBubbleController showForView:field_
771 offset:kOffset 772 offset:kOffset
772 browser:browser_ 773 browser:browser_
773 profile:profile()]; 774 profile:profile()];
774 } 775 }
775 776
776 void LocationBarViewMac::UpdateTranslateDecoration() { 777 void LocationBarViewMac::UpdateTranslateDecoration() {
778 if (!TranslateService::IsTranslateBubbleEnabled())
779 return;
780
777 WebContents* web_contents = GetWebContents(); 781 WebContents* web_contents = GetWebContents();
778 if (!web_contents) 782 if (!web_contents)
779 return; 783 return;
780 LanguageState& language_state = 784 LanguageState& language_state =
781 TranslateTabHelper::FromWebContents(web_contents)->GetLanguageState(); 785 TranslateTabHelper::FromWebContents(web_contents)->GetLanguageState();
782 bool enabled = language_state.translate_enabled(); 786 bool enabled = language_state.translate_enabled();
783 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); 787 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled);
784 translate_decoration_->SetVisible(enabled); 788 translate_decoration_->SetVisible(enabled);
785 translate_decoration_->SetLit(language_state.IsPageTranslated()); 789 translate_decoration_->SetLit(language_state.IsPageTranslated());
786 } 790 }
(...skipping 11 matching lines...) Expand all
798 } 802 }
799 803
800 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { 804 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() {
801 bool is_visible = !GetToolbarModel()->input_in_progress() && 805 bool is_visible = !GetToolbarModel()->input_in_progress() &&
802 browser_->search_model()->voice_search_supported(); 806 browser_->search_model()->voice_search_supported();
803 if (mic_search_decoration_->IsVisible() == is_visible) 807 if (mic_search_decoration_->IsVisible() == is_visible)
804 return false; 808 return false;
805 mic_search_decoration_->SetVisible(is_visible); 809 mic_search_decoration_->SetVisible(is_visible);
806 return true; 810 return true;
807 } 811 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698