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