| 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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 | 349 |
| 357 NSPoint LocationBarViewMac::GetTranslateBubblePoint() const { | 350 NSPoint LocationBarViewMac::GetTranslateBubblePoint() const { |
| 358 return [field_ bubblePointForDecoration:translate_decoration_.get()]; | 351 return [field_ bubblePointForDecoration:translate_decoration_.get()]; |
| 359 } | 352 } |
| 360 | 353 |
| 361 NSPoint LocationBarViewMac::GetManagePasswordsBubblePoint() const { | 354 NSPoint LocationBarViewMac::GetManagePasswordsBubblePoint() const { |
| 362 return [field_ bubblePointForDecoration:manage_passwords_decoration_.get()]; | 355 return [field_ bubblePointForDecoration:manage_passwords_decoration_.get()]; |
| 363 } | 356 } |
| 364 | 357 |
| 365 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { | 358 NSPoint LocationBarViewMac::GetPageInfoBubblePoint() const { |
| 366 if (origin_chip_decoration_ && origin_chip_decoration_->IsVisible()) { | 359 if (ev_bubble_decoration_->IsVisible()) { |
| 367 return [field_ bubblePointForDecoration:origin_chip_decoration_.get()]; | |
| 368 } else if (ev_bubble_decoration_->IsVisible()) { | |
| 369 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()]; | 360 return [field_ bubblePointForDecoration:ev_bubble_decoration_.get()]; |
| 370 } else { | 361 } else { |
| 371 return [field_ bubblePointForDecoration:location_icon_decoration_.get()]; | 362 return [field_ bubblePointForDecoration:location_icon_decoration_.get()]; |
| 372 } | 363 } |
| 373 } | 364 } |
| 374 | 365 |
| 375 NSPoint LocationBarViewMac::GetGeneratedCreditCardBubblePoint() const { | 366 NSPoint LocationBarViewMac::GetGeneratedCreditCardBubblePoint() const { |
| 376 return | 367 return |
| 377 [field_ bubblePointForDecoration:generated_credit_card_decoration_.get()]; | 368 [field_ bubblePointForDecoration:generated_credit_card_decoration_.get()]; |
| 378 } | 369 } |
| 379 | 370 |
| 380 void LocationBarViewMac::OnDecorationsChanged() { | 371 void LocationBarViewMac::OnDecorationsChanged() { |
| 381 // TODO(shess): The field-editor frame and cursor rects should not | 372 // TODO(shess): The field-editor frame and cursor rects should not |
| 382 // change, here. | 373 // change, here. |
| 383 [field_ updateMouseTracking]; | 374 [field_ updateMouseTracking]; |
| 384 [field_ resetFieldEditorFrameIfNeeded]; | 375 [field_ resetFieldEditorFrameIfNeeded]; |
| 385 [field_ setNeedsDisplay:YES]; | 376 [field_ setNeedsDisplay:YES]; |
| 386 } | 377 } |
| 387 | 378 |
| 388 // TODO(shess): This function should over time grow to closely match | 379 // TODO(shess): This function should over time grow to closely match |
| 389 // the views Layout() function. | 380 // the views Layout() function. |
| 390 void LocationBarViewMac::Layout() { | 381 void LocationBarViewMac::Layout() { |
| 391 AutocompleteTextFieldCell* cell = [field_ cell]; | 382 AutocompleteTextFieldCell* cell = [field_ cell]; |
| 392 | 383 |
| 393 // Reset the left-hand decorations. | 384 // Reset the left-hand decorations. |
| 394 // TODO(shess): Shortly, this code will live somewhere else, like in | 385 // TODO(shess): Shortly, this code will live somewhere else, like in |
| 395 // the constructor. I am still wrestling with how best to deal with | 386 // the constructor. I am still wrestling with how best to deal with |
| 396 // right-hand decorations, which are not a static set. | 387 // right-hand decorations, which are not a static set. |
| 397 [cell clearDecorations]; | 388 [cell clearDecorations]; |
| 398 if (origin_chip_decoration_.get()) | |
| 399 [cell addLeftDecoration:origin_chip_decoration_.get()]; | |
| 400 [cell addLeftDecoration:location_icon_decoration_.get()]; | 389 [cell addLeftDecoration:location_icon_decoration_.get()]; |
| 401 [cell addLeftDecoration:selected_keyword_decoration_.get()]; | 390 [cell addLeftDecoration:selected_keyword_decoration_.get()]; |
| 402 if (!origin_chip_decoration_.get()) | 391 [cell addLeftDecoration:ev_bubble_decoration_.get()]; |
| 403 [cell addLeftDecoration:ev_bubble_decoration_.get()]; | |
| 404 [cell addRightDecoration:search_button_decoration_.get()]; | |
| 405 [cell addRightDecoration:star_decoration_.get()]; | 392 [cell addRightDecoration:star_decoration_.get()]; |
| 406 [cell addRightDecoration:translate_decoration_.get()]; | 393 [cell addRightDecoration:translate_decoration_.get()]; |
| 407 [cell addRightDecoration:zoom_decoration_.get()]; | 394 [cell addRightDecoration:zoom_decoration_.get()]; |
| 408 [cell addRightDecoration:generated_credit_card_decoration_.get()]; | 395 [cell addRightDecoration:generated_credit_card_decoration_.get()]; |
| 409 [cell addRightDecoration:manage_passwords_decoration_.get()]; | 396 [cell addRightDecoration:manage_passwords_decoration_.get()]; |
| 410 | 397 |
| 411 // Note that display order is right to left. | 398 // Note that display order is right to left. |
| 412 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { | 399 for (size_t i = 0; i < page_action_decorations_.size(); ++i) { |
| 413 [cell addRightDecoration:page_action_decorations_[i]]; | 400 [cell addRightDecoration:page_action_decorations_[i]]; |
| 414 } | 401 } |
| 415 | 402 |
| 416 for (ScopedVector<ContentSettingDecoration>::iterator i = | 403 for (ScopedVector<ContentSettingDecoration>::iterator i = |
| 417 content_setting_decorations_.begin(); | 404 content_setting_decorations_.begin(); |
| 418 i != content_setting_decorations_.end(); ++i) { | 405 i != content_setting_decorations_.end(); ++i) { |
| 419 [cell addRightDecoration:*i]; | 406 [cell addRightDecoration:*i]; |
| 420 } | 407 } |
| 421 | 408 |
| 422 [cell addRightDecoration:keyword_hint_decoration_.get()]; | 409 [cell addRightDecoration:keyword_hint_decoration_.get()]; |
| 423 [cell addRightDecoration:mic_search_decoration_.get()]; | 410 [cell addRightDecoration:mic_search_decoration_.get()]; |
| 424 | 411 |
| 425 // By default only the location icon is visible. | 412 // By default only the location icon is visible. |
| 426 location_icon_decoration_->SetVisible(!origin_chip_decoration_.get() || | 413 location_icon_decoration_->SetVisible(true); |
| 427 !origin_chip_decoration_->IsVisible()); | |
| 428 selected_keyword_decoration_->SetVisible(false); | 414 selected_keyword_decoration_->SetVisible(false); |
| 429 ev_bubble_decoration_->SetVisible(false); | 415 ev_bubble_decoration_->SetVisible(false); |
| 430 keyword_hint_decoration_->SetVisible(false); | 416 keyword_hint_decoration_->SetVisible(false); |
| 431 | 417 |
| 432 // Get the keyword to use for keyword-search and hinting. | 418 // Get the keyword to use for keyword-search and hinting. |
| 433 const base::string16 keyword = omnibox_view_->model()->keyword(); | 419 const base::string16 keyword = omnibox_view_->model()->keyword(); |
| 434 base::string16 short_name; | 420 base::string16 short_name; |
| 435 bool is_extension_keyword = false; | 421 bool is_extension_keyword = false; |
| 436 if (!keyword.empty()) { | 422 if (!keyword.empty()) { |
| 437 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> | 423 short_name = TemplateURLServiceFactory::GetForProfile(profile())-> |
| 438 GetKeywordShortName(keyword, &is_extension_keyword); | 424 GetKeywordShortName(keyword, &is_extension_keyword); |
| 439 } | 425 } |
| 440 | 426 |
| 441 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); | 427 const bool is_keyword_hint = omnibox_view_->model()->is_keyword_hint(); |
| 442 if (!keyword.empty() && !is_keyword_hint) { | 428 if (!keyword.empty() && !is_keyword_hint) { |
| 443 // Switch from location icon to keyword mode. | 429 // Switch from location icon to keyword mode. |
| 444 location_icon_decoration_->SetVisible(false); | 430 location_icon_decoration_->SetVisible(false); |
| 445 selected_keyword_decoration_->SetVisible(true); | 431 selected_keyword_decoration_->SetVisible(true); |
| 446 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); | 432 selected_keyword_decoration_->SetKeyword(short_name, is_extension_keyword); |
| 447 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); | 433 selected_keyword_decoration_->SetImage(GetKeywordImage(keyword)); |
| 448 } else if ((GetToolbarModel()->GetSecurityLevel(false) == | 434 } else if ((GetToolbarModel()->GetSecurityLevel(false) == |
| 449 ToolbarModel::EV_SECURE) && !origin_chip_decoration_.get()) { | 435 ToolbarModel::EV_SECURE)) { |
| 450 // Switch from location icon to show the EV bubble instead. | 436 // Switch from location icon to show the EV bubble instead. |
| 451 location_icon_decoration_->SetVisible(false); | 437 location_icon_decoration_->SetVisible(false); |
| 452 ev_bubble_decoration_->SetVisible(true); | 438 ev_bubble_decoration_->SetVisible(true); |
| 453 | 439 |
| 454 base::string16 label(GetToolbarModel()->GetEVCertName()); | 440 base::string16 label(GetToolbarModel()->GetEVCertName()); |
| 455 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label)); | 441 ev_bubble_decoration_->SetFullLabel(base::SysUTF16ToNSString(label)); |
| 456 } else if (!keyword.empty() && is_keyword_hint) { | 442 } else if (!keyword.empty() && is_keyword_hint) { |
| 457 keyword_hint_decoration_->SetKeyword(short_name, | 443 keyword_hint_decoration_->SetKeyword(short_name, |
| 458 is_extension_keyword); | 444 is_extension_keyword); |
| 459 keyword_hint_decoration_->SetVisible(true); | 445 keyword_hint_decoration_->SetVisible(true); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 omnibox_view_->Update(); | 526 omnibox_view_->Update(); |
| 541 OnChanged(); | 527 OnChanged(); |
| 542 } | 528 } |
| 543 | 529 |
| 544 void LocationBarViewMac::OnChanged() { | 530 void LocationBarViewMac::OnChanged() { |
| 545 // Update the location-bar icon. | 531 // Update the location-bar icon. |
| 546 const int resource_id = omnibox_view_->GetIcon(); | 532 const int resource_id = omnibox_view_->GetIcon(); |
| 547 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); | 533 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); |
| 548 location_icon_decoration_->SetImage(image); | 534 location_icon_decoration_->SetImage(image); |
| 549 ev_bubble_decoration_->SetImage(image); | 535 ev_bubble_decoration_->SetImage(image); |
| 550 | |
| 551 if (origin_chip_decoration_.get()) | |
| 552 origin_chip_decoration_->Update(); | |
| 553 | |
| 554 ToolbarModel* toolbar_model = GetToolbarModel(); | |
| 555 const chrome::DisplaySearchButtonConditions conditions = | |
| 556 chrome::GetDisplaySearchButtonConditions(); | |
| 557 const bool meets_conditions = | |
| 558 (conditions == chrome::DISPLAY_SEARCH_BUTTON_ALWAYS) || | |
| 559 ((conditions != chrome::DISPLAY_SEARCH_BUTTON_NEVER) && | |
| 560 (toolbar_model->WouldPerformSearchTermReplacement(true) || | |
| 561 ((conditions == chrome::DISPLAY_SEARCH_BUTTON_FOR_STR_OR_IIP) && | |
| 562 toolbar_model->input_in_progress()))); | |
| 563 search_button_decoration_->SetVisible( | |
| 564 ![[field_ cell] isPopupMode] && meets_conditions); | |
| 565 search_button_decoration_->SetIcon( | |
| 566 (resource_id == IDR_OMNIBOX_SEARCH) ? | |
| 567 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE : IDR_OMNIBOX_SEARCH_BUTTON_ARROW); | |
| 568 | |
| 569 Layout(); | 536 Layout(); |
| 570 | 537 |
| 571 InstantService* instant_service = | 538 InstantService* instant_service = |
| 572 InstantServiceFactory::GetForProfile(profile()); | 539 InstantServiceFactory::GetForProfile(profile()); |
| 573 if (instant_service) { | 540 if (instant_service) { |
| 574 gfx::Rect bounds(NSRectToCGRect([field_ frame])); | 541 gfx::Rect bounds(NSRectToCGRect([field_ frame])); |
| 575 instant_service->OnOmniboxStartMarginChanged(bounds.x()); | 542 instant_service->OnOmniboxStartMarginChanged(bounds.x()); |
| 576 } | 543 } |
| 577 } | 544 } |
| 578 | 545 |
| 579 void LocationBarViewMac::OnSetFocus() { | 546 void LocationBarViewMac::OnSetFocus() { |
| 580 // Update the keyword and search hint states. | 547 // Update the keyword and search hint states. |
| 581 OnChanged(); | 548 OnChanged(); |
| 582 } | 549 } |
| 583 | 550 |
| 584 void LocationBarViewMac::ShowURL() { | 551 void LocationBarViewMac::ShowURL() { |
| 585 omnibox_view_->ShowURL(); | 552 omnibox_view_->ShowURL(); |
| 586 } | 553 } |
| 587 | 554 |
| 588 void LocationBarViewMac::HideURL() { | |
| 589 omnibox_view_->HideURL(); | |
| 590 } | |
| 591 | |
| 592 void LocationBarViewMac::EndOriginChipAnimations(bool cancel_fade) { | |
| 593 } | |
| 594 | |
| 595 InstantController* LocationBarViewMac::GetInstant() { | 555 InstantController* LocationBarViewMac::GetInstant() { |
| 596 return browser_->instant_controller() ? | 556 return browser_->instant_controller() ? |
| 597 browser_->instant_controller()->instant() : NULL; | 557 browser_->instant_controller()->instant() : NULL; |
| 598 } | 558 } |
| 599 | 559 |
| 600 WebContents* LocationBarViewMac::GetWebContents() { | 560 WebContents* LocationBarViewMac::GetWebContents() { |
| 601 return browser_->tab_strip_model()->GetActiveWebContents(); | 561 return browser_->tab_strip_model()->GetActiveWebContents(); |
| 602 } | 562 } |
| 603 | 563 |
| 604 ToolbarModel* LocationBarViewMac::GetToolbarModel() { | 564 ToolbarModel* LocationBarViewMac::GetToolbarModel() { |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 765 } | 725 } |
| 766 | 726 |
| 767 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 727 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 768 bool is_visible = !GetToolbarModel()->input_in_progress() && | 728 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 769 browser_->search_model()->voice_search_supported(); | 729 browser_->search_model()->voice_search_supported(); |
| 770 if (mic_search_decoration_->IsVisible() == is_visible) | 730 if (mic_search_decoration_->IsVisible() == is_visible) |
| 771 return false; | 731 return false; |
| 772 mic_search_decoration_->SetVisible(is_visible); | 732 mic_search_decoration_->SetVisible(is_visible); |
| 773 return true; | 733 return true; |
| 774 } | 734 } |
| OLD | NEW |