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