| 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/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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 new ContentSettingDecoration(type, this, profile)); | 141 new ContentSettingDecoration(type, this, profile)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 registrar_.Add( | 144 registrar_.Add( |
| 145 this, chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 145 this, chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
| 146 content::NotificationService::AllSources()); | 146 content::NotificationService::AllSources()); |
| 147 content::Source<Profile> profile_source = content::Source<Profile>(profile); | 147 content::Source<Profile> profile_source = content::Source<Profile>(profile); |
| 148 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 148 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
| 149 profile_source); | 149 profile_source); |
| 150 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); | 150 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); |
| 151 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED, profile_source); | 151 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 152 profile_source); |
| 152 | 153 |
| 153 edit_bookmarks_enabled_.Init( | 154 edit_bookmarks_enabled_.Init( |
| 154 prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 155 prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 155 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, | 156 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, |
| 156 base::Unretained(this))); | 157 base::Unretained(this))); |
| 157 | 158 |
| 158 browser_->search_model()->AddObserver(this); | 159 browser_->search_model()->AddObserver(this); |
| 159 | 160 |
| 160 [[field_ cell] setIsPopupMode: | 161 [[field_ cell] setIsPopupMode: |
| 161 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)]; | 162 !browser->SupportsWindowFeature(Browser::FEATURE_TABSTRIP)]; |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 | 638 |
| 638 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { | 639 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { |
| 639 // Only update if the updated action box was for the active tab contents. | 640 // Only update if the updated action box was for the active tab contents. |
| 640 WebContents* target_tab = content::Details<WebContents>(details).ptr(); | 641 WebContents* target_tab = content::Details<WebContents>(details).ptr(); |
| 641 if (target_tab == GetWebContents()) | 642 if (target_tab == GetWebContents()) |
| 642 UpdatePageActions(); | 643 UpdatePageActions(); |
| 643 break; | 644 break; |
| 644 } | 645 } |
| 645 | 646 |
| 646 case chrome::NOTIFICATION_EXTENSION_LOADED: | 647 case chrome::NOTIFICATION_EXTENSION_LOADED: |
| 647 case chrome::NOTIFICATION_EXTENSION_UNLOADED: | 648 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 648 Update(NULL); | 649 Update(NULL); |
| 649 break; | 650 break; |
| 650 | 651 |
| 651 default: | 652 default: |
| 652 NOTREACHED() << "Unexpected notification"; | 653 NOTREACHED() << "Unexpected notification"; |
| 653 break; | 654 break; |
| 654 } | 655 } |
| 655 } | 656 } |
| 656 | 657 |
| 657 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state, | 658 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state, |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 798 } | 799 } |
| 799 | 800 |
| 800 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 801 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 801 bool is_visible = !GetToolbarModel()->input_in_progress() && | 802 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 802 browser_->search_model()->voice_search_supported(); | 803 browser_->search_model()->voice_search_supported(); |
| 803 if (mic_search_decoration_->IsVisible() == is_visible) | 804 if (mic_search_decoration_->IsVisible() == is_visible) |
| 804 return false; | 805 return false; |
| 805 mic_search_decoration_->SetVisible(is_visible); | 806 mic_search_decoration_->SetVisible(is_visible); |
| 806 return true; | 807 return true; |
| 807 } | 808 } |
| OLD | NEW |