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" |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 35 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" | 35 #import "chrome/browser/ui/cocoa/first_run_bubble_controller.h" |
| 36 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 36 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| 37 #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" |
| 38 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" | 38 #import "chrome/browser/ui/cocoa/location_bar/content_setting_decoration.h" |
| 39 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" | 39 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" |
| 40 #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 " |
| 41 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" | 41 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" |
| 42 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" | 42 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" |
| 43 #import "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h" | 43 #import "chrome/browser/ui/cocoa/location_bar/manage_passwords_decoration.h" |
| 44 #import "chrome/browser/ui/cocoa/location_bar/mic_search_decoration.h" | 44 #import "chrome/browser/ui/cocoa/location_bar/mic_search_decoration.h" |
| 45 #import "chrome/browser/ui/cocoa/location_bar/origin_chip_decoration.h" | |
| 46 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h" | 45 #import "chrome/browser/ui/cocoa/location_bar/page_action_decoration.h" |
| 47 #import "chrome/browser/ui/cocoa/location_bar/search_button_decoration.h" | |
| 48 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" | 46 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" |
| 49 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" | 47 #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/translate_decoration.h" |
| 51 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" | 49 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" |
| 52 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 50 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
| 53 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" | 51 #include "chrome/browser/ui/content_settings/content_setting_bubble_model.h" |
| 54 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 52 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
| 55 #import "chrome/browser/ui/omnibox/omnibox_popup_model.h" | 53 #import "chrome/browser/ui/omnibox/omnibox_popup_model.h" |
| 56 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" | 54 #include "chrome/browser/ui/passwords/manage_passwords_ui_controller.h" |
| 57 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 55 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 selected_keyword_decoration_(new SelectedKeywordDecoration()), | 104 selected_keyword_decoration_(new SelectedKeywordDecoration()), |
| 107 ev_bubble_decoration_( | 105 ev_bubble_decoration_( |
| 108 new EVBubbleDecoration(location_icon_decoration_.get())), | 106 new EVBubbleDecoration(location_icon_decoration_.get())), |
| 109 star_decoration_(new StarDecoration(command_updater)), | 107 star_decoration_(new StarDecoration(command_updater)), |
| 110 translate_decoration_(new TranslateDecoration(command_updater)), | 108 translate_decoration_(new TranslateDecoration(command_updater)), |
| 111 zoom_decoration_(new ZoomDecoration(this)), | 109 zoom_decoration_(new ZoomDecoration(this)), |
| 112 keyword_hint_decoration_(new KeywordHintDecoration()), | 110 keyword_hint_decoration_(new KeywordHintDecoration()), |
| 113 mic_search_decoration_(new MicSearchDecoration(command_updater)), | 111 mic_search_decoration_(new MicSearchDecoration(command_updater)), |
| 114 generated_credit_card_decoration_( | 112 generated_credit_card_decoration_( |
| 115 new GeneratedCreditCardDecoration(this)), | 113 new GeneratedCreditCardDecoration(this)), |
| 116 search_button_decoration_(new SearchButtonDecoration(this)), | |
| 117 manage_passwords_decoration_( | 114 manage_passwords_decoration_( |
| 118 new ManagePasswordsDecoration(command_updater, this)), | 115 new ManagePasswordsDecoration(command_updater, this)), |
| 119 browser_(browser), | 116 browser_(browser), |
| 120 weak_ptr_factory_(this) { | 117 weak_ptr_factory_(this) { |
| 121 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 118 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
| 122 DCHECK_EQ(i, content_setting_decorations_.size()); | 119 DCHECK_EQ(i, content_setting_decorations_.size()); |
| 123 ContentSettingsType type = static_cast<ContentSettingsType>(i); | 120 ContentSettingsType type = static_cast<ContentSettingsType>(i); |
| 124 content_setting_decorations_.push_back( | 121 content_setting_decorations_.push_back( |
| 125 new ContentSettingDecoration(type, this, profile)); | 122 new ContentSettingDecoration(type, this, profile)); |
| 126 } | 123 } |
| 127 | 124 |
| 128 edit_bookmarks_enabled_.Init( | 125 edit_bookmarks_enabled_.Init( |
| 129 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 126 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 130 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, | 127 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, |
| 131 base::Unretained(this))); | 128 base::Unretained(this))); |
| 132 | 129 |
| 133 browser_->search_model()->AddObserver(this); | 130 browser_->search_model()->AddObserver(this); |
| 134 | 131 |
| 135 [[field_ cell] setIsPopupMode: | 132 [[field_ cell] setIsPopupMode: |
| 136 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)]; | 133 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)]; |
| 137 | 134 |
| 138 if (chrome::ShouldDisplayOriginChip()) | |
| 139 origin_chip_decoration_.reset(new OriginChipDecoration( | |
| 140 this, location_icon_decoration_.get())); | |
| 141 | |
| 142 // Sets images for the decorations, and performs a layout. This call ensures | 135 // Sets images for the decorations, and performs a layout. This call ensures |
| 143 // that this class is in a consistent state after initialization. | 136 // that this class is in a consistent state after initialization. |
| 144 OnChanged(); | 137 OnChanged(); |
| 145 } | 138 } |
| 146 | 139 |
| 147 LocationBarViewMac::~LocationBarViewMac() { | 140 LocationBarViewMac::~LocationBarViewMac() { |
| 148 // Disconnect from cell in case it outlives us. | 141 // Disconnect from cell in case it outlives us. |
| 149 [[field_ cell] clearDecorations]; | 142 [[field_ cell] clearDecorations]; |
| 150 | 143 |
| 151 browser_->search_model()->RemoveObserver(this); | 144 browser_->search_model()->RemoveObserver(this); |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 | 354 |
| 362 NSPoint LocationBarViewMac::GetTranslateBubblePoint() const { | 355 NSPoint LocationBarViewMac::GetTranslateBubblePoint() const { |
| 363 return [field_ bubblePointForDecoration:translate_decoration_.get()]; | 356 return [field_ bubblePointForDecoration:translate_decoration_.get()]; |
| 364 } | 357 } |
| 365 | 358 |
| 366 NSPoint LocationBarViewMac::GetManagePasswordsBubblePoint() const { | 359 NSPoint LocationBarViewMac::GetManagePasswordsBubblePoint() const { |
| 367 return [field_ bubblePointForDecoration:manage_passwords_decoration_.get()]; | 360 return [field_ bubblePointForDecoration:manage_passwords_decoration_.get()]; |
| 368 } | 361 } |
| 369 | 362 |
| 370 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { | 363 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { |
| 371 if (origin_chip_decoration_ && origin_chip_decoration_->IsVisible()) { | 364 if (ev_bubble_decoration_->IsVisible()) { |
| 372 return [field_ bubblePointForDecoration:origin_chip_decoration_.get()]; | |
| 373 } else if (ev_bubble_decoration_->IsVisible()) { | |
| 374 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()]; | 365 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()]; |
| 375 } else { | 366 } else { |
| 376 return [field_ bubblePointForDecoration:location_icon_decoration_.get()]; | 367 return [field_ bubblePointForDecoration:location_icon_decoration_.get()]; |
| 377 } | 368 } |
| 378 } | 369 } |
| 379 | 370 |
| 380 NSPoint LocationBarViewMac::GetGeneratedCreditCardBubblePoint() const { | 371 NSPoint LocationBarViewMac::GetGeneratedCreditCardBubblePoint() const { |
| 381 return | 372 return |
| 382 [field_ bubblePointForDecoration:generated_credit_card_decoration_.get()]; | 373 [field_ bubblePointForDecoration:generated_credit_card_decoration_.get()]; |
| 383 } | 374 } |
| 384 | 375 |
| 385 void LocationBarViewMac::OnDecorationsChanged() { | 376 void LocationBarViewMac::OnDecorationsChanged() { |
| 386 // TODO(shess): The field-editor frame and cursor rects should not | 377 // TODO(shess): The field-editor frame and cursor rects should not |
| 387 // change, here. | 378 // change, here. |
| 388 [field_ updateMouseTracking]; | 379 [field_ updateMouseTracking]; |
| 389 [field_ resetFieldEditorFrameIfNeeded]; | 380 [field_ resetFieldEditorFrameIfNeeded]; |
| 390 [field_ setNeedsDisplay:YES]; | 381 [field_ setNeedsDisplay:YES]; |
| 391 } | 382 } |
| 392 | 383 |
| 393 // TODO(shess): This function should over time grow to closely match | 384 // TODO(shess): This function should over time grow to closely match |
| 394 // the views Layout() function. | 385 // the views Layout() function. |
| 395 void LocationBarViewMac::Layout() { | 386 void LocationBarViewMac::Layout() { |
| 396 AutocompleteTextFieldCell* cell = [field_ cell]; | 387 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 397 | 388 |
| 398 // Reset the left-hand decorations. | 389 // Reset the left-hand decorations. |
| 399 // TODO(shess): Shortly, this code will live somewhere else, like in | 390 // TODO(shess): Shortly, this code will live somewhere else, like in |
| 400 // the constructor. I am still wrestling with how best to deal with | 391 // the constructor. I am still wrestling with how best to deal with |
| 401 // right-hand decorations, which are not a static set. | 392 // right-hand decorations, which are not a static set. |
| 402 [cell clearDecorations]; | 393 [cell clearDecorations]; |
| 403 if (origin_chip_decoration_.get()) | |
| 404 [cell addLeftDecoration:origin_chip_decoration_.get()]; | |
| 405 [cell addLeftDecoration:location_icon_decoration_.get()]; | 394 [cell addLeftDecoration:location_icon_decoration_.get()]; |
| 406 [cell addLeftDecoration:selected_keyword_decoration_.get()]; | 395 [cell addLeftDecoration:selected_keyword_decoration_.get()]; |
| 407 if (!origin_chip_decoration_.get()) | 396 [cell addLeftDecoration:ev_bubble_decoration_.get()]; |
| 408 [cell addLeftDecoration:ev_bubble_decoration_.get()]; | |
| 409 [cell addRightDecoration:search_button_decoration_.get()]; | |
| 410 [cell addRightDecoration:star_decoration_.get()]; | 397 [cell addRightDecoration:star_decoration_.get()]; |
| 411 [cell addRightDecoration:translate_decoration_.get()]; | 398 [cell addRightDecoration:translate_decoration_.get()]; |
| 412 [cell addRightDecoration:zoom_decoration_.get()]; | 399 [cell addRightDecoration:zoom_decoration_.get()]; |
| 413 [cell addRightDecoration:generated_credit_card_decoration_.get()]; | 400 [cell addRightDecoration:generated_credit_card_decoration_.get()]; |
| 414 [cell addRightDecoration:manage_passwords_decoration_.get()]; | 401 [cell addRightDecoration:manage_passwords_decoration_.get()]; |
| 415 | 402 |
| 416 // Note that display order is right to left. | 403 // Note that display order is right to left. |
| 417 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 404 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
| 418 [cell addRightDecoration:page_action_decorations_[i]]; | 405 [cell addRightDecoration:page_action_decorations_[i]]; |
| 419 } | 406 } |
| 420 | 407 |
| 421 for (ScopedVector<ContentSettingDecoration>::iterator i = | 408 for (ScopedVector<ContentSettingDecoration>::iterator i = |
| 422 content_setting_decorations_.begin(); | 409 content_setting_decorations_.begin(); |
| 423 i != content_setting_decorations_.end(); ++i) { | 410 i != content_setting_decorations_.end(); ++i) { |
| 424 [cell addRightDecoration:*i]; | 411 [cell addRightDecoration:*i]; |
| 425 } | 412 } |
| 426 | 413 |
| 427 [cell addRightDecoration:keyword_hint_decoration_.get()]; | 414 [cell addRightDecoration:keyword_hint_decoration_.get()]; |
| 428 [cell addRightDecoration:mic_search_decoration_.get()]; | 415 [cell addRightDecoration:mic_search_decoration_.get()]; |
| 429 | 416 |
| 430 // By default only the location icon is visible. | 417 // By default only the location icon is visible. |
| 431 location_icon_decoration_->SetVisible(!origin_chip_decoration_.get() || | 418 location_icon_decoration_->SetVisible(true); |
| 432 !origin_chip_decoration_->IsVisible()); | |
| 433 selected_keyword_decoration_->SetVisible(false); | 419 selected_keyword_decoration_->SetVisible(false); |
| 434 ev_bubble_decoration_->SetVisible(false); | 420 ev_bubble_decoration_->SetVisible(false); |
| 435 keyword_hint_decoration_->SetVisible(false); | 421 keyword_hint_decoration_->SetVisible(false); |
| 436 | 422 |
| 437 // Get the keyword to use for keyword-search and hinting. | 423 // Get the keyword to use for keyword-search and hinting. |
| 438 const base::string16 keyword = omnibox_view_->model()->keyword(); | 424 const base::string16 keyword = omnibox_view_->model()->keyword(); |
| 439 base::string16 short_name; | 425 base::string16 short_name; |
| 440 bool is_extension_keyword = false; | 426 bool is_extension_keyword = false; |
| 441 if (!keyword.empty()) { | 427 if (!keyword.empty()) { |
| 442 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> | 428 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> |
| 443 GetKeywordShortName(keyword, &is_extension_keyword); | 429 GetKeywordShortName(keyword, &is_extension_keyword); |
| 444 } | 430 } |
| 445 | 431 |
| 446 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); | 432 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); |
| 447 if (!keyword.empty() && !is_keyword_hint) { | 433 if (!keyword.empty() && !is_keyword_hint) { |
| 448 // Switch from location icon to keyword mode. | 434 // Switch from location icon to keyword mode. |
| 449 location_icon_decoration_->SetVisible(false); | 435 location_icon_decoration_->SetVisible(false); |
| 450 selected_keyword_decoration_->SetVisible(true); | 436 selected_keyword_decoration_->SetVisible(true); |
| 451 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); | 437 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); |
| 452 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); | 438 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); |
| 453 } else if ((GetToolbarModel()->GetSecurityLevel(false) == | 439 } else if ((GetToolbarModel()->GetSecurityLevel(false) == |
| 454 ToolbarModel::EV_SECURE) && !origin_chip_decoration_.get()) { | 440 ToolbarModel::EV_SECURE)) { |
| 455 // Switch from location icon to show the EV bubble instead. | 441 // Switch from location icon to show the EV bubble instead. |
| 456 location_icon_decoration_->SetVisible(false); | 442 location_icon_decoration_->SetVisible(false); |
| 457 ev_bubble_decoration_->SetVisible(true); | 443 ev_bubble_decoration_->SetVisible(true); |
| 458 | 444 |
| 459 base::string16 label(GetToolbarModel()->GetEVCertName()); | 445 base::string16 label(GetToolbarModel()->GetEVCertName()); |
| 460 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label)); | 446 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label)); |
| 461 } else if (!keyword.empty() && is_keyword_hint) { | 447 } else if (!keyword.empty() && is_keyword_hint) { |
| 462 keyword_hint_decoration_->SetKeyword(short_name, | 448 keyword_hint_decoration_->SetKeyword(short_name, |
| 463 is_extension_keyword); | 449 is_extension_keyword); |
| 464 keyword_hint_decoration_->SetVisible(true); | 450 keyword_hint_decoration_->SetVisible(true); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 545 omnibox_view_->Update(); | 531 omnibox_view_->Update(); |
| 546 OnChanged(); | 532 OnChanged(); |
| 547 } | 533 } |
| 548 | 534 |
| 549 void LocationBarViewMac::OnChanged() { | 535 void LocationBarViewMac::OnChanged() { |
| 550 // Update the location-bar icon. | 536 // Update the location-bar icon. |
| 551 const int resource_id = omnibox_view_->GetIcon(); | 537 const int resource_id = omnibox_view_->GetIcon(); |
| 552 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); | 538 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); |
| 553 location_icon_decoration_->SetImage(image); | 539 location_icon_decoration_->SetImage(image); |
| 554 ev_bubble_decoration_->SetImage(image); | 540 ev_bubble_decoration_->SetImage(image); |
| 555 | |
| 556 if (origin_chip_decoration_.get()) | |
| 557 origin_chip_decoration_->Update(); | |
| 558 | |
| 559 ToolbarModel* toolbar_model = GetToolbarModel(); | |
| 560 const chrome::DisplaySearchButtonConditions conditions = | |
| 561 chrome::GetDisplaySearchButtonConditions(); | |
| 562 const bool meets_conditions = | |
|
Justin Donnelly
2014/12/03 16:07:25
I'm really sad to see these features ripped out. B
groby-ooo-7-16
2015/01/10 00:54:06
Acknowledged.
| |
| 563 (conditions == chrome::DISPLAY_SEARCH_BUTTON_ALWAYS) || | |
| 564 ((conditions != chrome::DISPLAY_SEARCH_BUTTON_NEVER) && | |
| 565 (toolbar_model->WouldPerformSearchTermReplacement(true) || | |
| 566 ((conditions == chrome::DISPLAY_SEARCH_BUTTON_FOR_STR_OR_IIP) && | |
| 567 toolbar_model->input_in_progress()))); | |
| 568 search_button_decoration_->SetVisible( | |
| 569 ![[field_ cell] isPopupMode] && meets_conditions); | |
| 570 search_button_decoration_->SetIcon( | |
| 571 (resource_id == IDR_OMNIBOX_SEARCH) ? | |
| 572 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE : IDR_OMNIBOX_SEARCH_BUTTON_ARROW); | |
| 573 | |
| 574 Layout(); | 541 Layout(); |
| 575 | 542 |
| 576 InstantService* instant_service = | 543 InstantService* instant_service = |
| 577 InstantServiceFactory::GetForProfile(profile()); | 544 InstantServiceFactory::GetForProfile(profile()); |
| 578 if (instant_service) { | 545 if (instant_service) { |
| 579 gfx::Rect bounds(NSRectToCGRect([field_ frame])); | 546 gfx::Rect bounds(NSRectToCGRect([field_ frame])); |
| 580 instant_service->OnOmniboxStartMarginChanged(bounds.x()); | 547 instant_service->OnOmniboxStartMarginChanged(bounds.x()); |
| 581 } | 548 } |
| 582 } | 549 } |
| 583 | 550 |
| 584 void LocationBarViewMac::OnSetFocus() { | 551 void LocationBarViewMac::OnSetFocus() { |
| 585 // Update the keyword and search hint states. | 552 // Update the keyword and search hint states. |
| 586 OnChanged(); | 553 OnChanged(); |
| 587 } | 554 } |
| 588 | 555 |
| 589 void LocationBarViewMac::ShowURL() { | 556 void LocationBarViewMac::ShowURL() { |
| 590 omnibox_view_->ShowURL(); | 557 omnibox_view_->ShowURL(); |
| 591 } | 558 } |
| 592 | 559 |
| 593 void LocationBarViewMac::HideURL() { | |
| 594 omnibox_view_->HideURL(); | |
| 595 } | |
| 596 | |
| 597 void LocationBarViewMac::EndOriginChipAnimations(bool cancel_fade) { | |
| 598 } | |
| 599 | |
| 600 InstantController* LocationBarViewMac::GetInstant() { | 560 InstantController* LocationBarViewMac::GetInstant() { |
| 601 return browser_->instant_controller() ? | 561 return browser_->instant_controller() ? |
| 602 browser_->instant_controller()->instant() : NULL; | 562 browser_->instant_controller()->instant() : NULL; |
| 603 } | 563 } |
| 604 | 564 |
| 605 WebContents* LocationBarViewMac::GetWebContents() { | 565 WebContents* LocationBarViewMac::GetWebContents() { |
| 606 return browser_->tab_strip_model()->GetActiveWebContents(); | 566 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 607 } | 567 } |
| 608 | 568 |
| 609 ToolbarModel* LocationBarViewMac::GetToolbarModel() { | 569 ToolbarModel* LocationBarViewMac::GetToolbarModel() { |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 757 } | 717 } |
| 758 | 718 |
| 759 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 719 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 760 bool is_visible = !GetToolbarModel()->input_in_progress() && | 720 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 761 browser_->search_model()->voice_search_supported(); | 721 browser_->search_model()->voice_search_supported(); |
| 762 if (mic_search_decoration_->IsVisible() == is_visible) | 722 if (mic_search_decoration_->IsVisible() == is_visible) |
| 763 return false; | 723 return false; |
| 764 mic_search_decoration_->SetVisible(is_visible); | 724 mic_search_decoration_->SetVisible(is_visible); |
| 765 return true; | 725 return true; |
| 766 } | 726 } |
| OLD | NEW |