OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 } | 586 } |
587 | 587 |
588 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { | 588 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { |
589 // Only update if the updated action box was for the active tab contents. | 589 // Only update if the updated action box was for the active tab contents. |
590 WebContents* target_tab = content::Details<WebContents>(details).ptr(); | 590 WebContents* target_tab = content::Details<WebContents>(details).ptr(); |
591 if (target_tab == GetTabContents()->web_contents()) | 591 if (target_tab == GetTabContents()->web_contents()) |
592 UpdatePageActions(); | 592 UpdatePageActions(); |
593 break; | 593 break; |
594 } | 594 } |
595 | 595 |
596 case chrome::NOTIFICATION_PREF_CHANGED: | |
597 UpdateStarDecorationVisibility(); | |
598 OnChanged(); | |
599 break; | |
600 | |
601 default: | 596 default: |
602 NOTREACHED() << "Unexpected notification"; | 597 NOTREACHED() << "Unexpected notification"; |
603 break; | 598 break; |
604 } | 599 } |
605 } | 600 } |
606 | 601 |
| 602 void LocationBarViewMac::OnPreferenceChanged(PrefServiceBase* service, |
| 603 const std::string& pref_name) { |
| 604 UpdateStarDecorationVisibility(); |
| 605 OnChanged(); |
| 606 } |
| 607 |
607 void LocationBarViewMac::PostNotification(NSString* notification) { | 608 void LocationBarViewMac::PostNotification(NSString* notification) { |
608 [[NSNotificationCenter defaultCenter] postNotificationName:notification | 609 [[NSNotificationCenter defaultCenter] postNotificationName:notification |
609 object:[NSValue valueWithPointer:this]]; | 610 object:[NSValue valueWithPointer:this]]; |
610 } | 611 } |
611 | 612 |
612 bool LocationBarViewMac::RefreshContentSettingsDecorations() { | 613 bool LocationBarViewMac::RefreshContentSettingsDecorations() { |
613 const bool input_in_progress = toolbar_model_->GetInputInProgress(); | 614 const bool input_in_progress = toolbar_model_->GetInputInProgress(); |
614 WebContents* web_contents = | 615 WebContents* web_contents = |
615 input_in_progress ? NULL : chrome::GetActiveWebContents(browser_); | 616 input_in_progress ? NULL : chrome::GetActiveWebContents(browser_); |
616 bool icons_updated = false; | 617 bool icons_updated = false; |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
781 visible = false; | 782 visible = false; |
782 star_decoration_->SetVisible(visible); | 783 star_decoration_->SetVisible(visible); |
783 } | 784 } |
784 | 785 |
785 void LocationBarViewMac::UpdatePlusDecorationVisibility() { | 786 void LocationBarViewMac::UpdatePlusDecorationVisibility() { |
786 if (extensions::FeatureSwitch::action_box()->IsEnabled()) { | 787 if (extensions::FeatureSwitch::action_box()->IsEnabled()) { |
787 // If the action box is enabled, hide it when input is in progress. | 788 // If the action box is enabled, hide it when input is in progress. |
788 plus_decoration_->SetVisible(!toolbar_model_->GetInputInProgress()); | 789 plus_decoration_->SetVisible(!toolbar_model_->GetInputInProgress()); |
789 } | 790 } |
790 } | 791 } |
OLD | NEW |