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

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

Issue 165853002: [OSX, OmniTheatre] URL hiding for Origin Chip. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
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 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 return [field_ convertPoint:bubble_point toView:nil]; 516 return [field_ convertPoint:bubble_point toView:nil];
517 } 517 }
518 518
519 void LocationBarViewMac::Update(const WebContents* contents) { 519 void LocationBarViewMac::Update(const WebContents* contents) {
520 UpdateStarDecorationVisibility(); 520 UpdateStarDecorationVisibility();
521 UpdateZoomDecoration(); 521 UpdateZoomDecoration();
522 RefreshPageActionDecorations(); 522 RefreshPageActionDecorations();
523 RefreshContentSettingsDecorations(); 523 RefreshContentSettingsDecorations();
524 UpdateMicSearchDecorationVisibility(); 524 UpdateMicSearchDecorationVisibility();
525 UpdateGeneratedCreditCardView(); 525 UpdateGeneratedCreditCardView();
526 UpdateOriginChipDecoration();
527 if (contents) 526 if (contents)
528 omnibox_view_->OnTabChanged(contents); 527 omnibox_view_->OnTabChanged(contents);
529 else 528 else
530 omnibox_view_->Update(); 529 omnibox_view_->Update();
531 OnChanged(); 530 OnChanged();
532 } 531 }
533 532
534 void LocationBarViewMac::OnChanged() { 533 void LocationBarViewMac::OnChanged() {
535 // Update the location-bar icon. 534 // Update the location-bar icon.
536 const int resource_id = omnibox_view_->GetIcon(); 535 const int resource_id = omnibox_view_->GetIcon();
537 NSImage* image = OmniboxViewMac::ImageForResource(resource_id); 536 NSImage* image = OmniboxViewMac::ImageForResource(resource_id);
538 location_icon_decoration_->SetImage(image); 537 location_icon_decoration_->SetImage(image);
539 ev_bubble_decoration_->SetImage(image); 538 ev_bubble_decoration_->SetImage(image);
540 539
541 ToolbarModel* toolbar_model = GetToolbarModel(); 540 ToolbarModel* toolbar_model = GetToolbarModel();
542 const chrome::DisplaySearchButtonConditions conditions = 541 const chrome::DisplaySearchButtonConditions conditions =
543 chrome::GetDisplaySearchButtonConditions(); 542 chrome::GetDisplaySearchButtonConditions();
544 const bool meets_conditions = 543 const bool meets_conditions =
545 (conditions == chrome::DISPLAY_SEARCH_BUTTON_ALWAYS) || 544 (conditions == chrome::DISPLAY_SEARCH_BUTTON_ALWAYS) ||
546 ((conditions != chrome::DISPLAY_SEARCH_BUTTON_NEVER) && 545 ((conditions != chrome::DISPLAY_SEARCH_BUTTON_NEVER) &&
547 (toolbar_model->WouldPerformSearchTermReplacement(true) || 546 (toolbar_model->WouldPerformSearchTermReplacement(true) ||
548 ((conditions == chrome::DISPLAY_SEARCH_BUTTON_FOR_STR_OR_IIP) && 547 ((conditions == chrome::DISPLAY_SEARCH_BUTTON_FOR_STR_OR_IIP) &&
549 toolbar_model->input_in_progress()))); 548 toolbar_model->input_in_progress())));
550 search_button_decoration_->SetVisible( 549 search_button_decoration_->SetVisible(
551 ![[field_ cell] isPopupMode] && meets_conditions); 550 ![[field_ cell] isPopupMode] && meets_conditions);
552 search_button_decoration_->SetIcon( 551 search_button_decoration_->SetIcon(
553 (resource_id == IDR_OMNIBOX_SEARCH) ? 552 (resource_id == IDR_OMNIBOX_SEARCH) ?
554 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE : IDR_OMNIBOX_SEARCH_BUTTON_ARROW); 553 IDR_OMNIBOX_SEARCH_BUTTON_LOUPE : IDR_OMNIBOX_SEARCH_BUTTON_ARROW);
555 554
555 UpdateOriginChipDecoration();
556 Layout(); 556 Layout();
557 557
558 InstantService* instant_service = 558 InstantService* instant_service =
559 InstantServiceFactory::GetForProfile(profile()); 559 InstantServiceFactory::GetForProfile(profile());
560 if (instant_service) { 560 if (instant_service) {
561 gfx::Rect bounds(NSRectToCGRect([field_ frame])); 561 gfx::Rect bounds(NSRectToCGRect([field_ frame]));
562 instant_service->OnOmniboxStartMarginChanged(bounds.x()); 562 instant_service->OnOmniboxStartMarginChanged(bounds.x());
563 } 563 }
564 } 564 }
565 565
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 if (mic_search_decoration_->IsVisible() == is_visible) 757 if (mic_search_decoration_->IsVisible() == is_visible)
758 return false; 758 return false;
759 mic_search_decoration_->SetVisible(is_visible); 759 mic_search_decoration_->SetVisible(is_visible);
760 return true; 760 return true;
761 } 761 }
762 762
763 void LocationBarViewMac::UpdateOriginChipDecoration() { 763 void LocationBarViewMac::UpdateOriginChipDecoration() {
764 if (origin_chip_decoration_.get()) 764 if (origin_chip_decoration_.get())
765 origin_chip_decoration_->Update(); 765 origin_chip_decoration_->Update();
766 } 766 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698