| 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" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/sys_string_conversions.h" | 13 #include "base/strings/sys_string_conversions.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "chrome/app/chrome_command_ids.h" |
| 15 #import "chrome/browser/app_controller_mac.h" | 16 #import "chrome/browser/app_controller_mac.h" |
| 16 #include "chrome/browser/chrome_notification_types.h" | 17 #include "chrome/browser/chrome_notification_types.h" |
| 17 #include "chrome/browser/command_updater.h" | 18 #include "chrome/browser/command_updater.h" |
| 18 #include "chrome/browser/defaults.h" | 19 #include "chrome/browser/defaults.h" |
| 19 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" | 20 #include "chrome/browser/extensions/api/omnibox/omnibox_api.h" |
| 20 #include "chrome/browser/extensions/api/tabs/tabs_api.h" | 21 #include "chrome/browser/extensions/api/tabs/tabs_api.h" |
| 21 #include "chrome/browser/extensions/extension_action.h" | 22 #include "chrome/browser/extensions/extension_action.h" |
| 22 #include "chrome/browser/extensions/extension_service.h" | 23 #include "chrome/browser/extensions/extension_service.h" |
| 23 #include "chrome/browser/extensions/location_bar_controller.h" | 24 #include "chrome/browser/extensions/location_bar_controller.h" |
| 24 #include "chrome/browser/extensions/tab_helper.h" | 25 #include "chrome/browser/extensions/tab_helper.h" |
| 25 #include "chrome/browser/search/instant_service.h" | 26 #include "chrome/browser/search/instant_service.h" |
| 26 #include "chrome/browser/search/instant_service_factory.h" | 27 #include "chrome/browser/search/instant_service_factory.h" |
| 27 #include "chrome/browser/search/search.h" | 28 #include "chrome/browser/search/search.h" |
| 28 #include "chrome/browser/search_engines/template_url.h" | 29 #include "chrome/browser/search_engines/template_url.h" |
| 29 #include "chrome/browser/search_engines/template_url_service.h" | 30 #include "chrome/browser/search_engines/template_url_service.h" |
| 30 #include "chrome/browser/search_engines/template_url_service_factory.h" | 31 #include "chrome/browser/search_engines/template_url_service_factory.h" |
| 32 #include "chrome/browser/translate/translate_tab_helper.h" |
| 31 #include "chrome/browser/ui/browser_instant_controller.h" | 33 #include "chrome/browser/ui/browser_instant_controller.h" |
| 32 #include "chrome/browser/ui/browser_list.h" | 34 #include "chrome/browser/ui/browser_list.h" |
| 33 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" | 35 #import "chrome/browser/ui/cocoa/content_settings/content_setting_bubble_cocoa.h
" |
| 34 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" | 36 #import "chrome/browser/ui/cocoa/extensions/extension_popup_controller.h" |
| 35 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" | 37 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" |
| 36 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 38 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| 37 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 39 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
| 38 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" | 40 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" |
| 39 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" | 41 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" |
| 40 #import "chrome/browser/ui/cocoa/location_bar/generated_credit_card_decoration.h
" | 42 #import "chrome/browser/ui/cocoa/location_bar/generated_credit_card_decoration.h
" |
| 41 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" | 43 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" |
| 42 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" | 44 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" |
| 43 #import "chrome/browser/ui/cocoa/location_bar/mic_search_decoration.h" | 45 #import "chrome/browser/ui/cocoa/location_bar/mic_search_decoration.h" |
| 44 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h" | 46 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h" |
| 45 #import "chrome/browser/ui/cocoa/location_bar/search_button_decoration.h" | 47 #import "chrome/browser/ui/cocoa/location_bar/search_button_decoration.h" |
| 46 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" | 48 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" |
| 47 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" | 49 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" |
| 50 #import "chrome/browser/ui/cocoa/location_bar/translate_decoration.h" |
| 48 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" | 51 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" |
| 49 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 52 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 50 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 53 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 51 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 54 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
| 52 #include "chrome/browser/ui/omnibox/location_bar_util.h" | 55 #include "chrome/browser/ui/omnibox/location_bar_util.h" |
| 53 #import "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 56 #import "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 54 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 57 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 55 #include "chrome/browser/ui/toolbar/toolbar_model.h" | 58 #include "chrome/browser/ui/toolbar/toolbar_model.h" |
| 56 #include "chrome/browser/ui/zoom/zoom_controller.h" | 59 #include "chrome/browser/ui/zoom/zoom_controller.h" |
| 57 #include "chrome/common/chrome_switches.h" | 60 #include "chrome/common/chrome_switches.h" |
| 58 #include "chrome/common/pref_names.h" | 61 #include "chrome/common/pref_names.h" |
| 62 #include "components/translate/core/browser/language_state.h" |
| 59 #include "content/public/browser/notification_service.h" | 63 #include "content/public/browser/notification_service.h" |
| 60 #include "content/public/browser/web_contents.h" | 64 #include "content/public/browser/web_contents.h" |
| 61 #include "extensions/browser/extension_system.h" | 65 #include "extensions/browser/extension_system.h" |
| 62 #include "extensions/common/extension.h" | 66 #include "extensions/common/extension.h" |
| 63 #include "extensions/common/permissions/permissions_data.h" | 67 #include "extensions/common/permissions/permissions_data.h" |
| 64 #include "grit/generated_resources.h" | 68 #include "grit/generated_resources.h" |
| 65 #include "grit/theme_resources.h" | 69 #include "grit/theme_resources.h" |
| 66 #include "net/base/net_util.h" | 70 #include "net/base/net_util.h" |
| 67 #include "skia/ext/skia_utils_mac.h" | 71 #include "skia/ext/skia_utils_mac.h" |
| 68 #import "ui/base/cocoa/cocoa_event_utils.h" | 72 #import "ui/base/cocoa/cocoa_event_utils.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 98 | 102 |
| 99 // NOTE: Can't DISALLOW_COPY_AND_ASSIGN as we pass this object by value to | 103 // NOTE: Can't DISALLOW_COPY_AND_ASSIGN as we pass this object by value to |
| 100 // std::stable_partition(). | 104 // std::stable_partition(). |
| 101 }; | 105 }; |
| 102 | 106 |
| 103 } | 107 } |
| 104 | 108 |
| 105 // TODO(shess): This code is mostly copied from the gtk | 109 // TODO(shess): This code is mostly copied from the gtk |
| 106 // implementation. Make sure it's all appropriate and flesh it out. | 110 // implementation. Make sure it's all appropriate and flesh it out. |
| 107 | 111 |
| 108 LocationBarViewMac::LocationBarViewMac( | 112 LocationBarViewMac::LocationBarViewMac(AutocompleteTextField* field, |
| 109 AutocompleteTextField* field, | 113 CommandUpdater* command_updater, |
| 110 CommandUpdater* command_updater, | 114 Profile* profile, |
| 111 Profile* profile, | 115 Browser* browser) |
| 112 Browser* browser) | |
| 113 : LocationBar(profile), | 116 : LocationBar(profile), |
| 114 OmniboxEditController(command_updater), | 117 OmniboxEditController(command_updater), |
| 115 omnibox_view_(new OmniboxViewMac(this, profile, command_updater, field)), | 118 omnibox_view_(new OmniboxViewMac(this, profile, command_updater, field)), |
| 116 field_(field), | 119 field_(field), |
| 117 location_icon_decoration_(new LocationIconDecoration(this)), | 120 location_icon_decoration_(new LocationIconDecoration(this)), |
| 118 selected_keyword_decoration_(new SelectedKeywordDecoration()), | 121 selected_keyword_decoration_(new SelectedKeywordDecoration()), |
| 119 ev_bubble_decoration_( | 122 ev_bubble_decoration_( |
| 120 new EVBubbleDecoration(location_icon_decoration_.get())), | 123 new EVBubbleDecoration(location_icon_decoration_.get())), |
| 121 star_decoration_(new StarDecoration(command_updater)), | 124 star_decoration_(new StarDecoration(command_updater)), |
| 125 translate_decoration_(new TranslateDecoration(command_updater)), |
| 122 zoom_decoration_(new ZoomDecoration(this)), | 126 zoom_decoration_(new ZoomDecoration(this)), |
| 123 keyword_hint_decoration_(new KeywordHintDecoration()), | 127 keyword_hint_decoration_(new KeywordHintDecoration()), |
| 124 mic_search_decoration_(new MicSearchDecoration(command_updater)), | 128 mic_search_decoration_(new MicSearchDecoration(command_updater)), |
| 125 generated_credit_card_decoration_( | 129 generated_credit_card_decoration_( |
| 126 new GeneratedCreditCardDecoration(this)), | 130 new GeneratedCreditCardDecoration(this)), |
| 127 search_button_decoration_(new SearchButtonDecoration(this)), | 131 search_button_decoration_(new SearchButtonDecoration(this)), |
| 128 browser_(browser), | 132 browser_(browser), |
| 129 weak_ptr_factory_(this) { | 133 weak_ptr_factory_(this) { |
| 130 | 134 |
| 131 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 135 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 bool LocationBarViewMac::IsEditable() { | 316 bool LocationBarViewMac::IsEditable() { |
| 313 return [field_ isEditable] ? true : false; | 317 return [field_ isEditable] ? true : false; |
| 314 } | 318 } |
| 315 | 319 |
| 316 void LocationBarViewMac::SetStarred(bool starred) { | 320 void LocationBarViewMac::SetStarred(bool starred) { |
| 317 star_decoration_->SetStarred(starred); | 321 star_decoration_->SetStarred(starred); |
| 318 UpdateStarDecorationVisibility(); | 322 UpdateStarDecorationVisibility(); |
| 319 OnDecorationsChanged(); | 323 OnDecorationsChanged(); |
| 320 } | 324 } |
| 321 | 325 |
| 326 void LocationBarViewMac::SetTranslateIconLit(bool on) { |
| 327 translate_decoration_->SetLit(on); |
| 328 OnDecorationsChanged(); |
| 329 } |
| 330 |
| 322 void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) { | 331 void LocationBarViewMac::ZoomChangedForActiveTab(bool can_show_bubble) { |
| 323 UpdateZoomDecoration(); | 332 UpdateZoomDecoration(); |
| 324 OnDecorationsChanged(); | 333 OnDecorationsChanged(); |
| 325 | 334 |
| 326 if (can_show_bubble && zoom_decoration_->IsVisible()) | 335 if (can_show_bubble && zoom_decoration_->IsVisible()) |
| 327 zoom_decoration_->ShowBubble(YES); | 336 zoom_decoration_->ShowBubble(YES); |
| 328 } | 337 } |
| 329 | 338 |
| 330 bool LocationBarViewMac::IsStarEnabled() const { | 339 bool LocationBarViewMac::IsStarEnabled() const { |
| 331 return browser_defaults::bookmarks_enabled && | 340 return browser_defaults::bookmarks_enabled && |
| 332 [field_ isEditable] && | 341 [field_ isEditable] && |
| 333 !GetToolbarModel()->input_in_progress() && | 342 !GetToolbarModel()->input_in_progress() && |
| 334 edit_bookmarks_enabled_.GetValue() && | 343 edit_bookmarks_enabled_.GetValue() && |
| 335 !IsBookmarkStarHiddenByExtension(); | 344 !IsBookmarkStarHiddenByExtension(); |
| 336 } | 345 } |
| 337 | 346 |
| 338 NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const { | 347 NSPoint LocationBarViewMac::GetBookmarkBubblePoint() const { |
| 339 DCHECK(IsStarEnabled()); | 348 DCHECK(IsStarEnabled()); |
| 340 | 349 |
| 341 AutocompleteTextFieldCell* cell = [field_ cell]; | 350 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 342 const NSRect frame = [cell frameForDecoration:star_decoration_.get() | 351 const NSRect frame = [cell frameForDecoration:star_decoration_.get() |
| 343 inFrame:[field_ bounds]]; | 352 inFrame:[field_ bounds]]; |
| 344 const NSPoint point = star_decoration_->GetBubblePointInFrame(frame); | 353 const NSPoint point = star_decoration_->GetBubblePointInFrame(frame); |
| 345 return [field_ convertPoint:point toView:nil]; | 354 return [field_ convertPoint:point toView:nil]; |
| 346 } | 355 } |
| 347 | 356 |
| 357 NSPoint LocationBarViewMac::GetTranslateBubblePoint() const { |
| 358 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 359 const NSRect frame = [cell frameForDecoration:translate_decoration_.get() |
| 360 inFrame:[field_ bounds]]; |
| 361 const NSPoint point = translate_decoration_->GetBubblePointInFrame(frame); |
| 362 return [field_ convertPoint:point toView:nil]; |
| 363 } |
| 364 |
| 348 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { | 365 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { |
| 349 AutocompleteTextFieldCell* cell = [field_ cell]; | 366 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 350 if (ev_bubble_decoration_->IsVisible()) { | 367 if (ev_bubble_decoration_->IsVisible()) { |
| 351 const NSRect frame = [cell frameForDecoration:ev_bubble_decoration_.get() | 368 const NSRect frame = [cell frameForDecoration:ev_bubble_decoration_.get() |
| 352 inFrame:[field_ bounds]]; | 369 inFrame:[field_ bounds]]; |
| 353 const NSPoint point = ev_bubble_decoration_->GetBubblePointInFrame(frame); | 370 const NSPoint point = ev_bubble_decoration_->GetBubblePointInFrame(frame); |
| 354 return [field_ convertPoint:point toView:nil]; | 371 return [field_ convertPoint:point toView:nil]; |
| 355 } else { | 372 } else { |
| 356 const NSRect frame = | 373 const NSRect frame = |
| 357 [cell frameForDecoration:location_icon_decoration_.get() | 374 [cell frameForDecoration:location_icon_decoration_.get() |
| (...skipping 30 matching lines...) Expand all Loading... |
| 388 // Reset the left-hand decorations. | 405 // Reset the left-hand decorations. |
| 389 // TODO(shess): Shortly, this code will live somewhere else, like in | 406 // TODO(shess): Shortly, this code will live somewhere else, like in |
| 390 // the constructor. I am still wrestling with how best to deal with | 407 // the constructor. I am still wrestling with how best to deal with |
| 391 // right-hand decorations, which are not a static set. | 408 // right-hand decorations, which are not a static set. |
| 392 [cell clearDecorations]; | 409 [cell clearDecorations]; |
| 393 [cell addLeftDecoration:location_icon_decoration_.get()]; | 410 [cell addLeftDecoration:location_icon_decoration_.get()]; |
| 394 [cell addLeftDecoration:selected_keyword_decoration_.get()]; | 411 [cell addLeftDecoration:selected_keyword_decoration_.get()]; |
| 395 [cell addLeftDecoration:ev_bubble_decoration_.get()]; | 412 [cell addLeftDecoration:ev_bubble_decoration_.get()]; |
| 396 [cell addRightDecoration:search_button_decoration_.get()]; | 413 [cell addRightDecoration:search_button_decoration_.get()]; |
| 397 [cell addRightDecoration:star_decoration_.get()]; | 414 [cell addRightDecoration:star_decoration_.get()]; |
| 415 [cell addRightDecoration:translate_decoration_.get()]; |
| 398 [cell addRightDecoration:zoom_decoration_.get()]; | 416 [cell addRightDecoration:zoom_decoration_.get()]; |
| 399 [cell addRightDecoration:generated_credit_card_decoration_.get()]; | 417 [cell addRightDecoration:generated_credit_card_decoration_.get()]; |
| 400 | 418 |
| 401 // Note that display order is right to left. | 419 // Note that display order is right to left. |
| 402 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 420 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
| 403 [cell addRightDecoration:page_action_decorations_[i]]; | 421 [cell addRightDecoration:page_action_decorations_[i]]; |
| 404 } | 422 } |
| 405 | 423 |
| 406 for (ScopedVector<ContentSettingDecoration>::iterator i = | 424 for (ScopedVector<ContentSettingDecoration>::iterator i = |
| 407 content_setting_decorations_.begin(); | 425 content_setting_decorations_.begin(); |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 NOTREACHED(); | 523 NOTREACHED(); |
| 506 return NSZeroPoint; | 524 return NSZeroPoint; |
| 507 } | 525 } |
| 508 | 526 |
| 509 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); | 527 NSPoint bubble_point = decoration->GetBubblePointInFrame(frame); |
| 510 return [field_ convertPoint:bubble_point toView:nil]; | 528 return [field_ convertPoint:bubble_point toView:nil]; |
| 511 } | 529 } |
| 512 | 530 |
| 513 void LocationBarViewMac::Update(const WebContents* contents) { | 531 void LocationBarViewMac::Update(const WebContents* contents) { |
| 514 UpdateStarDecorationVisibility(); | 532 UpdateStarDecorationVisibility(); |
| 533 UpdateTranslateDecoration(); |
| 515 UpdateZoomDecoration(); | 534 UpdateZoomDecoration(); |
| 516 RefreshPageActionDecorations(); | 535 RefreshPageActionDecorations(); |
| 517 RefreshContentSettingsDecorations(); | 536 RefreshContentSettingsDecorations(); |
| 518 UpdateMicSearchDecorationVisibility(); | 537 UpdateMicSearchDecorationVisibility(); |
| 519 UpdateGeneratedCreditCardView(); | 538 UpdateGeneratedCreditCardView(); |
| 520 if (contents) | 539 if (contents) |
| 521 omnibox_view_->OnTabChanged(contents); | 540 omnibox_view_->OnTabChanged(contents); |
| 522 else | 541 else |
| 523 omnibox_view_->Update(); | 542 omnibox_view_->Update(); |
| 524 OnChanged(); | 543 OnChanged(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 // BaseBubbleController will move it back to the correct position. | 744 // BaseBubbleController will move it back to the correct position. |
| 726 const NSPoint kOffset = NSMakePoint( | 745 const NSPoint kOffset = NSMakePoint( |
| 727 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, | 746 info_bubble::kBubbleArrowXOffset + info_bubble::kBubbleArrowWidth/2.0, |
| 728 kFirstRunBubbleYOffset); | 747 kFirstRunBubbleYOffset); |
| 729 [FirstRunBubbleController showForView:field_ | 748 [FirstRunBubbleController showForView:field_ |
| 730 offset:kOffset | 749 offset:kOffset |
| 731 browser:browser_ | 750 browser:browser_ |
| 732 profile:profile()]; | 751 profile:profile()]; |
| 733 } | 752 } |
| 734 | 753 |
| 754 void LocationBarViewMac::UpdateTranslateDecoration() { |
| 755 WebContents* web_contents = GetWebContents(); |
| 756 if (!web_contents) |
| 757 return; |
| 758 LanguageState& language_state = |
| 759 TranslateTabHelper::FromWebContents(web_contents)->GetLanguageState(); |
| 760 bool enabled = language_state.translate_enabled(); |
| 761 command_updater()->UpdateCommandEnabled(IDC_TRANSLATE_PAGE, enabled); |
| 762 translate_decoration_->SetVisible(enabled); |
| 763 translate_decoration_->SetLit(language_state.IsPageTranslated()); |
| 764 } |
| 765 |
| 735 void LocationBarViewMac::UpdateZoomDecoration() { | 766 void LocationBarViewMac::UpdateZoomDecoration() { |
| 736 WebContents* web_contents = GetWebContents(); | 767 WebContents* web_contents = GetWebContents(); |
| 737 if (!web_contents) | 768 if (!web_contents) |
| 738 return; | 769 return; |
| 739 | 770 |
| 740 zoom_decoration_->Update(ZoomController::FromWebContents(web_contents)); | 771 zoom_decoration_->Update(ZoomController::FromWebContents(web_contents)); |
| 741 } | 772 } |
| 742 | 773 |
| 743 void LocationBarViewMac::UpdateStarDecorationVisibility() { | 774 void LocationBarViewMac::UpdateStarDecorationVisibility() { |
| 744 star_decoration_->SetVisible(IsStarEnabled()); | 775 star_decoration_->SetVisible(IsStarEnabled()); |
| 745 } | 776 } |
| 746 | 777 |
| 747 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 778 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 748 bool is_visible = !GetToolbarModel()->input_in_progress() && | 779 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 749 browser_->search_model()->voice_search_supported(); | 780 browser_->search_model()->voice_search_supported(); |
| 750 if (mic_search_decoration_->IsVisible() == is_visible) | 781 if (mic_search_decoration_->IsVisible() == is_visible) |
| 751 return false; | 782 return false; |
| 752 mic_search_decoration_->SetVisible(is_visible); | 783 mic_search_decoration_->SetVisible(is_visible); |
| 753 return true; | 784 return true; |
| 754 } | 785 } |
| OLD | NEW |