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

Side by Side Diff: chrome/browser/ui/cocoa/toolbar/toolbar_controller.mm

Issue 2039403002: Renamed AppMenuBadgeController to AppMenuIconController (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Renamed identifiers in Cocoa file Created 4 years, 6 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
OLDNEW
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/toolbar/toolbar_controller.h" 5 #import "chrome/browser/ui/cocoa/toolbar/toolbar_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/mac/bundle_locations.h" 9 #include "base/mac/bundle_locations.h"
10 #include "base/mac/foundation_util.h" 10 #include "base/mac/foundation_util.h"
(...skipping 28 matching lines...) Expand all
39 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" 39 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h"
40 #import "chrome/browser/ui/cocoa/menu_button.h" 40 #import "chrome/browser/ui/cocoa/menu_button.h"
41 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h" 41 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button.h"
42 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h" 42 #import "chrome/browser/ui/cocoa/toolbar/app_toolbar_button_cell.h"
43 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h" 43 #import "chrome/browser/ui/cocoa/toolbar/back_forward_menu_controller.h"
44 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h" 44 #import "chrome/browser/ui/cocoa/toolbar/reload_button_cocoa.h"
45 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h" 45 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button_cocoa.h"
46 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view_cocoa.h" 46 #import "chrome/browser/ui/cocoa/toolbar/toolbar_view_cocoa.h"
47 #import "chrome/browser/ui/cocoa/view_id_util.h" 47 #import "chrome/browser/ui/cocoa/view_id_util.h"
48 #include "chrome/browser/ui/tabs/tab_strip_model.h" 48 #include "chrome/browser/ui/tabs/tab_strip_model.h"
49 #include "chrome/browser/ui/toolbar/app_menu_badge_controller.h" 49 #include "chrome/browser/ui/toolbar/app_menu_icon_controller.h"
50 #include "chrome/browser/ui/toolbar/app_menu_model.h" 50 #include "chrome/browser/ui/toolbar/app_menu_model.h"
51 #include "chrome/common/pref_names.h" 51 #include "chrome/common/pref_names.h"
52 #include "chrome/grit/chromium_strings.h" 52 #include "chrome/grit/chromium_strings.h"
53 #include "chrome/grit/generated_resources.h" 53 #include "chrome/grit/generated_resources.h"
54 #include "components/metrics/proto/omnibox_event.pb.h" 54 #include "components/metrics/proto/omnibox_event.pb.h"
55 #include "components/omnibox/browser/autocomplete_classifier.h" 55 #include "components/omnibox/browser/autocomplete_classifier.h"
56 #include "components/omnibox/browser/autocomplete_match.h" 56 #include "components/omnibox/browser/autocomplete_match.h"
57 #include "components/omnibox/browser/omnibox_view.h" 57 #include "components/omnibox/browser/omnibox_view.h"
58 #include "components/prefs/pref_service.h" 58 #include "components/prefs/pref_service.h"
59 #include "components/search_engines/template_url_service.h" 59 #include "components/search_engines/template_url_service.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 185
186 private: 186 private:
187 ToolbarController* observer_; // weak, owns me 187 ToolbarController* observer_; // weak, owns me
188 188
189 DISALLOW_COPY_AND_ASSIGN(CommandObserverBridge); 189 DISALLOW_COPY_AND_ASSIGN(CommandObserverBridge);
190 }; 190 };
191 191
192 // A class registered for C++ notifications. This is used to detect changes in 192 // A class registered for C++ notifications. This is used to detect changes in
193 // preferences and upgrade available notifications. Bridges the notification 193 // preferences and upgrade available notifications. Bridges the notification
194 // back to the ToolbarController. 194 // back to the ToolbarController.
195 class NotificationBridge : public AppMenuBadgeController::Delegate { 195 class NotificationBridge : public AppMenuIconController::Delegate {
196 public: 196 public:
197 explicit NotificationBridge(ToolbarController* controller) 197 explicit NotificationBridge(ToolbarController* controller)
198 : controller_(controller), 198 : controller_(controller),
199 badge_controller_([controller browser]->profile(), this) { 199 app_menu_icon_controller_([controller browser]->profile(), this) {}
200 }
201 ~NotificationBridge() override {} 200 ~NotificationBridge() override {}
202 201
203 void UpdateBadgeSeverity() { 202 void UpdateSeverity() { app_menu_icon_controller_.UpdateDelegate(); }
204 badge_controller_.UpdateDelegate();
205 }
206 203
207 void UpdateBadgeSeverity(AppMenuBadgeController::BadgeType type, 204 void UpdateSeverity(AppMenuIconController::IconType type,
208 AppMenuIconPainter::Severity severity, 205 AppMenuIconPainter::Severity severity,
209 bool animate) override { 206 bool animate) override {
210 [controller_ updateAppMenuButtonSeverity:severity animate:animate]; 207 [controller_ updateAppMenuButtonSeverity:severity animate:animate];
211 } 208 }
212 209
213 void OnPreferenceChanged(const std::string& pref_name) { 210 void OnPreferenceChanged(const std::string& pref_name) {
214 [controller_ prefChanged:pref_name]; 211 [controller_ prefChanged:pref_name];
215 } 212 }
216 213
217 private: 214 private:
218 ToolbarController* controller_; // weak, owns us 215 ToolbarController* controller_; // weak, owns us
219 216
220 AppMenuBadgeController badge_controller_; 217 AppMenuIconController app_menu_icon_controller_;
221 218
222 DISALLOW_COPY_AND_ASSIGN(NotificationBridge); 219 DISALLOW_COPY_AND_ASSIGN(NotificationBridge);
223 }; 220 };
224 221
225 } // namespace ToolbarControllerInternal 222 } // namespace ToolbarControllerInternal
226 223
227 @implementation ToolbarController 224 @implementation ToolbarController
228 225
229 @synthesize browser = browser_; 226 @synthesize browser = browser_;
230 227
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
428 ToolbarView* toolbarView = [self toolbarView]; 425 ToolbarView* toolbarView = [self toolbarView];
429 NSRect toolbarFrame = [toolbarView frame]; 426 NSRect toolbarFrame = [toolbarView frame];
430 if (toolbarFrame.size.height != toolbarHeight) { 427 if (toolbarFrame.size.height != toolbarHeight) {
431 toolbarFrame.size.height = toolbarHeight; 428 toolbarFrame.size.height = toolbarHeight;
432 [toolbarView setFrame:toolbarFrame]; 429 [toolbarView setFrame:toolbarFrame];
433 } 430 }
434 } 431 }
435 432
436 notificationBridge_.reset( 433 notificationBridge_.reset(
437 new ToolbarControllerInternal::NotificationBridge(self)); 434 new ToolbarControllerInternal::NotificationBridge(self));
438 notificationBridge_->UpdateBadgeSeverity(); 435 notificationBridge_->UpdateSeverity();
439 436
440 [appMenuButton_ setOpenMenuOnClick:YES]; 437 [appMenuButton_ setOpenMenuOnClick:YES];
441 438
442 [backButton_ setOpenMenuOnRightClick:YES]; 439 [backButton_ setOpenMenuOnRightClick:YES];
443 [forwardButton_ setOpenMenuOnRightClick:YES]; 440 [forwardButton_ setOpenMenuOnRightClick:YES];
444 441
445 [backButton_ setHandleMiddleClick:YES]; 442 [backButton_ setHandleMiddleClick:YES];
446 [forwardButton_ setHandleMiddleClick:YES]; 443 [forwardButton_ setHandleMiddleClick:YES];
447 [reloadButton_ setHandleMiddleClick:YES]; 444 [reloadButton_ setHandleMiddleClick:YES];
448 [homeButton_ setHandleMiddleClick:YES]; 445 [homeButton_ setHandleMiddleClick:YES];
(...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after
1158 - (void)hideDropURLsIndicatorInView:(NSView*)view { 1155 - (void)hideDropURLsIndicatorInView:(NSView*)view {
1159 // Do nothing. 1156 // Do nothing.
1160 } 1157 }
1161 1158
1162 // (URLDropTargetController protocol) 1159 // (URLDropTargetController protocol)
1163 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info { 1160 - (BOOL)isUnsupportedDropData:(id<NSDraggingInfo>)info {
1164 return drag_util::IsUnsupportedDropData(profile_, info); 1161 return drag_util::IsUnsupportedDropData(profile_, info);
1165 } 1162 }
1166 1163
1167 @end 1164 @end
OLDNEW
« no previous file with comments | « chrome/browser/enumerate_modules_model_win.cc ('k') | chrome/browser/ui/toolbar/app_menu_badge_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698