Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(413)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm

Issue 425303002: Move extension notifications to extensions/browser/notification_types.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: (extension-notifications) rebase Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 weak_ptr_factory_(this) { 136 weak_ptr_factory_(this) {
137 137
138 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { 138 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) {
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,
147 extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED,
147 content::NotificationService::AllSources()); 148 content::NotificationService::AllSources());
148 content::Source<Profile> profile_source = content::Source<Profile>(profile); 149 content::Source<Profile> profile_source = content::Source<Profile>(profile);
149 registrar_.Add( 150 registrar_.Add(this,
150 this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, profile_source); 151 extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED,
151 registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, 152 profile_source);
153 registrar_.Add(this,
154 extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED,
152 profile_source); 155 profile_source);
153 156
154 edit_bookmarks_enabled_.Init( 157 edit_bookmarks_enabled_.Init(
155 prefs::kEditBookmarksEnabled, profile->GetPrefs(), 158 prefs::kEditBookmarksEnabled, profile->GetPrefs(),
156 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged, 159 base::Bind(&LocationBarViewMac::OnEditBookmarksEnabledChanged,
157 base::Unretained(this))); 160 base::Unretained(this)));
158 161
159 browser_->search_model()->AddObserver(this); 162 browser_->search_model()->AddObserver(this);
160 163
161 [[field_ cell] setIsPopupMode: 164 [[field_ cell] setIsPopupMode:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (RefreshContentSettingsDecorations()) 214 if (RefreshContentSettingsDecorations())
212 OnDecorationsChanged(); 215 OnDecorationsChanged();
213 } 216 }
214 217
215 void LocationBarViewMac::UpdatePageActions() { 218 void LocationBarViewMac::UpdatePageActions() {
216 size_t count_before = page_action_decorations_.size(); 219 size_t count_before = page_action_decorations_.size();
217 RefreshPageActionDecorations(); 220 RefreshPageActionDecorations();
218 Layout(); 221 Layout();
219 if (page_action_decorations_.size() != count_before) { 222 if (page_action_decorations_.size() != count_before) {
220 content::NotificationService::current()->Notify( 223 content::NotificationService::current()->Notify(
221 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, 224 extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED,
222 content::Source<LocationBar>(this), 225 content::Source<LocationBar>(this),
223 content::NotificationService::NoDetails()); 226 content::NotificationService::NoDetails());
224 } 227 }
225 } 228 }
226 229
227 void LocationBarViewMac::InvalidatePageActions() { 230 void LocationBarViewMac::InvalidatePageActions() {
228 size_t count_before = page_action_decorations_.size(); 231 size_t count_before = page_action_decorations_.size();
229 DeletePageActionDecorations(); 232 DeletePageActionDecorations();
230 Layout(); 233 Layout();
231 if (page_action_decorations_.size() != count_before) { 234 if (page_action_decorations_.size() != count_before) {
232 content::NotificationService::current()->Notify( 235 content::NotificationService::current()->Notify(
233 chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED, 236 extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_COUNT_CHANGED,
234 content::Source<LocationBar>(this), 237 content::Source<LocationBar>(this),
235 content::NotificationService::NoDetails()); 238 content::NotificationService::NoDetails());
236 } 239 }
237 } 240 }
238 241
239 void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() { 242 void LocationBarViewMac::UpdateOpenPDFInReaderPrompt() {
240 // Not implemented on Mac. 243 // Not implemented on Mac.
241 } 244 }
242 245
243 void LocationBarViewMac::UpdateGeneratedCreditCardView() { 246 void LocationBarViewMac::UpdateGeneratedCreditCardView() {
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage(); 614 GetOmniboxIcon(template_url->GetExtensionId()).AsNSImage();
612 } 615 }
613 616
614 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH); 617 return OmniboxViewMac::ImageForResource(IDR_OMNIBOX_SEARCH);
615 } 618 }
616 619
617 void LocationBarViewMac::Observe(int type, 620 void LocationBarViewMac::Observe(int type,
618 const content::NotificationSource& source, 621 const content::NotificationSource& source,
619 const content::NotificationDetails& details) { 622 const content::NotificationDetails& details) {
620 switch (type) { 623 switch (type) {
621 case chrome::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: { 624 case extensions::NOTIFICATION_EXTENSION_PAGE_ACTION_VISIBILITY_CHANGED: {
622 WebContents* contents = GetWebContents(); 625 WebContents* contents = GetWebContents();
623 if (content::Details<WebContents>(contents) != details) 626 if (content::Details<WebContents>(contents) != details)
624 return; 627 return;
625 628
626 [field_ updateMouseTracking]; 629 [field_ updateMouseTracking];
627 [field_ setNeedsDisplay:YES]; 630 [field_ setNeedsDisplay:YES];
628 break; 631 break;
629 } 632 }
630 633
631 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: 634 case extensions::NOTIFICATION_EXTENSION_LOADED_DEPRECATED:
632 case chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED: 635 case extensions::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED:
633 Update(NULL); 636 Update(NULL);
634 break; 637 break;
635 638
636 default: 639 default:
637 NOTREACHED() << "Unexpected notification"; 640 NOTREACHED() << "Unexpected notification";
638 break; 641 break;
639 } 642 }
640 } 643 }
641 644
642 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state, 645 void LocationBarViewMac::ModelChanged(const SearchModel::State& old_state,
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 } 789 }
787 790
788 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() { 791 bool LocationBarViewMac::UpdateMicSearchDecorationVisibility() {
789 bool is_visible = !GetToolbarModel()->input_in_progress() && 792 bool is_visible = !GetToolbarModel()->input_in_progress() &&
790 browser_->search_model()->voice_search_supported(); 793 browser_->search_model()->voice_search_supported();
791 if (mic_search_decoration_->IsVisible() == is_visible) 794 if (mic_search_decoration_->IsVisible() == is_visible)
792 return false; 795 return false;
793 mic_search_decoration_->SetVisible(is_visible); 796 mic_search_decoration_->SetVisible(is_visible);
794 return true; 797 return true;
795 } 798 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698