| 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.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 rb.GetNativeImageNamed(IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_C).ToNSImage(), | 131 rb.GetNativeImageNamed(IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_C).ToNSImage(), |
| 132 rb.GetNativeImageNamed(IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_R).ToNSImage()); | 132 rb.GetNativeImageNamed(IDR_OMNIBOX_WI_BUBBLE_BACKGROUND_R).ToNSImage()); |
| 133 | 133 |
| 134 registrar_.Add(this, | 134 registrar_.Add(this, |
| 135 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 135 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
| 136 content::NotificationService::AllSources()); | 136 content::NotificationService::AllSources()); |
| 137 registrar_.Add(this, | 137 registrar_.Add(this, |
| 138 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 138 chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
| 139 content::Source<Profile>(browser_->profile())); | 139 content::Source<Profile>(browser_->profile())); |
| 140 | 140 |
| 141 edit_bookmarks_enabled_.Init(prefs::kEditBookmarksEnabled, | 141 edit_bookmarks_enabled_.Init( |
| 142 profile_->GetPrefs(), this); | 142 prefs::kEditBookmarksEnabled, |
| 143 profile_->GetPrefs(), |
| 144 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, |
| 145 base::Unretained(this))); |
| 143 } | 146 } |
| 144 | 147 |
| 145 LocationBarViewMac::~LocationBarViewMac() { | 148 LocationBarViewMac::~LocationBarViewMac() { |
| 146 // Disconnect from cell in case it outlives us. | 149 // Disconnect from cell in case it outlives us. |
| 147 [[field_ cell] clearDecorations]; | 150 [[field_ cell] clearDecorations]; |
| 148 } | 151 } |
| 149 | 152 |
| 150 void LocationBarViewMac::ShowFirstRunBubble() { | 153 void LocationBarViewMac::ShowFirstRunBubble() { |
| 151 // We need the browser window to be shown before we can show the bubble, but | 154 // We need the browser window to be shown before we can show the bubble, but |
| 152 // we get called before that's happened. | 155 // we get called before that's happened. |
| (...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 UpdatePageActions(); | 592 UpdatePageActions(); |
| 590 break; | 593 break; |
| 591 } | 594 } |
| 592 | 595 |
| 593 default: | 596 default: |
| 594 NOTREACHED() << "Unexpected notification"; | 597 NOTREACHED() << "Unexpected notification"; |
| 595 break; | 598 break; |
| 596 } | 599 } |
| 597 } | 600 } |
| 598 | 601 |
| 599 void LocationBarViewMac::OnPreferenceChanged(PrefServiceBase* service, | 602 void LocationBarViewMac::OnEditBookmarksEnabledChanged() { |
| 600 const std::string& pref_name) { | |
| 601 UpdateStarDecorationVisibility(); | 603 UpdateStarDecorationVisibility(); |
| 602 OnChanged(); | 604 OnChanged(); |
| 603 } | 605 } |
| 604 | 606 |
| 605 void LocationBarViewMac::PostNotification(NSString* notification) { | 607 void LocationBarViewMac::PostNotification(NSString* notification) { |
| 606 [[NSNotificationCenter defaultCenter] postNotificationName:notification | 608 [[NSNotificationCenter defaultCenter] postNotificationName:notification |
| 607 object:[NSValue valueWithPointer:this]]; | 609 object:[NSValue valueWithPointer:this]]; |
| 608 } | 610 } |
| 609 | 611 |
| 610 bool LocationBarViewMac::RefreshContentSettingsDecorations() { | 612 bool LocationBarViewMac::RefreshContentSettingsDecorations() { |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 visible = false; | 778 visible = false; |
| 777 star_decoration_->SetVisible(visible); | 779 star_decoration_->SetVisible(visible); |
| 778 } | 780 } |
| 779 | 781 |
| 780 void LocationBarViewMac::UpdatePlusDecorationVisibility() { | 782 void LocationBarViewMac::UpdatePlusDecorationVisibility() { |
| 781 if (extensions::FeatureSwitch::action_box()->IsEnabled()) { | 783 if (extensions::FeatureSwitch::action_box()->IsEnabled()) { |
| 782 // If the action box is enabled, hide it when input is in progress. | 784 // If the action box is enabled, hide it when input is in progress. |
| 783 plus_decoration_->SetVisible(!toolbar_model_->GetInputInProgress()); | 785 plus_decoration_->SetVisible(!toolbar_model_->GetInputInProgress()); |
| 784 } | 786 } |
| 785 } | 787 } |
| OLD | NEW |