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