| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 DCHECK_EQ(i, content_setting_decorations_.size()); | 139 DCHECK_EQ(i, content_setting_decorations_.size()); |
| 140 ContentSettingsType type = static_cast<ContentSettingsType>(i); | 140 ContentSettingsType type = static_cast<ContentSettingsType>(i); |
| 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, | |
| 150 profile_source); | |
| 151 registrar_.Add( | 149 registrar_.Add( |
| 152 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); | 150 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); |
| 153 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, | 151 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, |
| 154 profile_source); | 152 profile_source); |
| 155 | 153 |
| 156 edit_bookmarks_enabled_.Init( | 154 edit_bookmarks_enabled_.Init( |
| 157 prefs::kEditBookmarksEnabled, profile->GetPrefs(), | 155 prefs::kEditBookmarksEnabled, profile->GetPrefs(), |
| 158 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, | 156 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, |
| 159 base::Unretained(this))); | 157 base::Unretained(this))); |
| 160 | 158 |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { | 621 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { |
| 624 WebContents* contents = GetWebContents(); | 622 WebContents* contents = GetWebContents(); |
| 625 if (content::Details<WebContents>(contents) != details) | 623 if (content::Details<WebContents>(contents) != details) |
| 626 return; | 624 return; |
| 627 | 625 |
| 628 [field_ updateMouseTracking]; | 626 [field_ updateMouseTracking]; |
| 629 [field_ setNeedsDisplay:YES]; | 627 [field_ setNeedsDisplay:YES]; |
| 630 break; | 628 break; |
| 631 } | 629 } |
| 632 | 630 |
| 633 case chrome::NOTIFICATION_EXTENSION_LOCATION_BAR_UPDATED: { | |
| 634 // Only update if the updated action box was for the active tab contents. | |
| 635 WebContents* target_tab = content::Details<WebContents>(details).ptr(); | |
| 636 if (target_tab == GetWebContents()) | |
| 637 UpdatePageActions(); | |
| 638 break; | |
| 639 } | |
| 640 | |
| 641 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: | 631 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 642 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: | 632 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: |
| 643 Update(NULL); | 633 Update(NULL); |
| 644 break; | 634 break; |
| 645 | 635 |
| 646 default: | 636 default: |
| 647 NOTREACHED() << "Unexpected notification"; | 637 NOTREACHED() << "Unexpected notification"; |
| 648 break; | 638 break; |
| 649 } | 639 } |
| 650 } | 640 } |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 796 } | 786 } |
| 797 | 787 |
| 798 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { | 788 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { |
| 799 bool is_visible = !GetToolbarModel()->input_in_progress() && | 789 bool is_visible = !GetToolbarModel()->input_in_progress() && |
| 800 browser_->search_model()->voice_search_supported(); | 790 browser_->search_model()->voice_search_supported(); |
| 801 if (mic_search_decoration_->IsVisible() == is_visible) | 791 if (mic_search_decoration_->IsVisible() == is_visible) |
| 802 return false; | 792 return false; |
| 803 mic_search_decoration_->SetVisible(is_visible); | 793 mic_search_decoration_->SetVisible(is_visible); |
| 804 return true; | 794 return true; |
| 805 } | 795 } |
| OLD | NEW |