| 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 content_setting_decorations_.push_back( | 141 content_setting_decorations_.push_back( |
| 142 new ContentSettingDecoration(type, this, profile)); | 142 new ContentSettingDecoration(type, this, profile)); |
| 143 } | 143 } |
| 144 | 144 |
| 145 registrar_.Add( | 145 registrar_.Add( |
| 146 this, chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, | 146 this, chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED, |
| 147 content::NotificationService::AllSources()); | 147 content::NotificationService::AllSources()); |
| 148 content::Source<Profile> profile_source = content::Source<Profile>(profile); | 148 content::Source<Profile> profile_source = content::Source<Profile>(profile); |
| 149 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, | 149 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED, |
| 150 profile_source); | 150 profile_source); |
| 151 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, profile_source); | 151 registrar_.Add( |
| 152 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); |
| 152 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 153 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 153 profile_source); | 154 profile_source); |
| 154 | 155 |
| 155 edit_bookmarks_enabled_.Init( | 156 edit_bookmarks_enabled_.Init( |
| 156 prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 157 prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 157 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, | 158 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, |
| 158 base::Unretained(this))); | 159 base::Unretained(this))); |
| 159 | 160 |
| 160 browser_->search_model()->AddObserver(this); | 161 browser_->search_model()->AddObserver(this); |
| 161 | 162 |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 } | 624 } |
| 624 | 625 |
| 625 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { | 626 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { |
| 626 // Only update if the updated action box was for the active tab contents. | 627 // Only update if the updated action box was for the active tab contents. |
| 627 WebContents* target_tab = content::Details<WebContents>(details).ptr(); | 628 WebContents* target_tab = content::Details<WebContents>(details).ptr(); |
| 628 if (target_tab == GetWebContents()) | 629 if (target_tab == GetWebContents()) |
| 629 UpdatePageActions(); | 630 UpdatePageActions(); |
| 630 break; | 631 break; |
| 631 } | 632 } |
| 632 | 633 |
| 633 case chrome::NOTIFICATION_EXTENSION_LOADED: | 634 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 634 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: | 635 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 635 Update(NULL); | 636 Update(NULL); |
| 636 break; | 637 break; |
| 637 | 638 |
| 638 default: | 639 default: |
| 639 NOTREACHED() << "Unexpected notification"; | 640 NOTREACHED() << "Unexpected notification"; |
| 640 break; | 641 break; |
| 641 } | 642 } |
| 642 } | 643 } |
| 643 | 644 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 788 } | 789 } |
| 789 | 790 |
| 790 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 791 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 791 bool is_visible = !GetToolbarModel()->input_in_progress() && | 792 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 792 browser_->search_model()->voice_search_supported(); | 793 browser_->search_model()->voice_search_supported(); |
| 793 if (mic_search_decoration_->IsVisible() == is_visible) | 794 if (mic_search_decoration_->IsVisible() == is_visible) |
| 794 return false; | 795 return false; |
| 795 mic_search_decoration_->SetVisible(is_visible); | 796 mic_search_decoration_->SetVisible(is_visible); |
| 796 return true; | 797 return true; |
| 797 } | 798 } |
| OLD | NEW |