| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/cocoa/toolbar_controller.h" | 5 #import "chrome/browser/cocoa/toolbar_controller.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "app/l10n_util_mac.h" | 9 #include "app/l10n_util_mac.h" |
| 10 #include "app/menus/accelerator_cocoa.h" | 10 #include "app/menus/accelerator_cocoa.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #import "chrome/browser/cocoa/extensions/browser_action_button.h" | 26 #import "chrome/browser/cocoa/extensions/browser_action_button.h" |
| 27 #import "chrome/browser/cocoa/extensions/browser_actions_container_view.h" | 27 #import "chrome/browser/cocoa/extensions/browser_actions_container_view.h" |
| 28 #import "chrome/browser/cocoa/extensions/browser_actions_controller.h" | 28 #import "chrome/browser/cocoa/extensions/browser_actions_controller.h" |
| 29 #import "chrome/browser/cocoa/gradient_button_cell.h" | 29 #import "chrome/browser/cocoa/gradient_button_cell.h" |
| 30 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.h" | 30 #import "chrome/browser/cocoa/location_bar/autocomplete_text_field_editor.h" |
| 31 #import "chrome/browser/cocoa/location_bar/location_bar_view_mac.h" | 31 #import "chrome/browser/cocoa/location_bar/location_bar_view_mac.h" |
| 32 #import "chrome/browser/cocoa/menu_button.h" | 32 #import "chrome/browser/cocoa/menu_button.h" |
| 33 #import "chrome/browser/cocoa/menu_controller.h" | 33 #import "chrome/browser/cocoa/menu_controller.h" |
| 34 #import "chrome/browser/cocoa/reload_button.h" | 34 #import "chrome/browser/cocoa/reload_button.h" |
| 35 #import "chrome/browser/cocoa/toolbar_view.h" | 35 #import "chrome/browser/cocoa/toolbar_view.h" |
| 36 #import "chrome/browser/cocoa/view_id_util.h" |
| 36 #import "chrome/browser/cocoa/wrench_menu_controller.h" | 37 #import "chrome/browser/cocoa/wrench_menu_controller.h" |
| 37 #include "chrome/browser/net/url_fixer_upper.h" | 38 #include "chrome/browser/net/url_fixer_upper.h" |
| 38 #include "chrome/browser/pref_service.h" | 39 #include "chrome/browser/pref_service.h" |
| 39 #include "chrome/browser/profile.h" | 40 #include "chrome/browser/profile.h" |
| 40 #include "chrome/browser/search_engines/template_url_model.h" | 41 #include "chrome/browser/search_engines/template_url_model.h" |
| 41 #include "chrome/browser/tab_contents/tab_contents.h" | 42 #include "chrome/browser/tab_contents/tab_contents.h" |
| 42 #include "chrome/browser/toolbar_model.h" | 43 #include "chrome/browser/toolbar_model.h" |
| 43 #include "chrome/browser/upgrade_detector.h" | 44 #include "chrome/browser/upgrade_detector.h" |
| 44 #include "chrome/browser/wrench_menu_model.h" | 45 #include "chrome/browser/wrench_menu_model.h" |
| 45 #include "chrome/common/notification_details.h" | 46 #include "chrome/common/notification_details.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 profile:profile | 219 profile:profile |
| 219 browser:browser | 220 browser:browser |
| 220 resizeDelegate:resizeDelegate | 221 resizeDelegate:resizeDelegate |
| 221 nibFileNamed:@"Toolbar"])) { | 222 nibFileNamed:@"Toolbar"])) { |
| 222 } | 223 } |
| 223 return self; | 224 return self; |
| 224 } | 225 } |
| 225 | 226 |
| 226 | 227 |
| 227 - (void)dealloc { | 228 - (void)dealloc { |
| 229 // Unset ViewIDs of toolbar elements. |
| 230 // ViewIDs of |toolbarView|, |reloadButton_|, |locationBar_| and |
| 231 // |browserActionsContainerView_| are handled by themselves. |
| 232 view_id_util::UnsetID(backButton_); |
| 233 view_id_util::UnsetID(forwardButton_); |
| 234 view_id_util::UnsetID(homeButton_); |
| 235 view_id_util::UnsetID(wrenchButton_); |
| 236 |
| 228 // Make sure any code in the base class which assumes [self view] is | 237 // Make sure any code in the base class which assumes [self view] is |
| 229 // the "parent" view continues to work. | 238 // the "parent" view continues to work. |
| 230 hasToolbar_ = YES; | 239 hasToolbar_ = YES; |
| 231 hasLocationBar_ = YES; | 240 hasLocationBar_ = YES; |
| 232 | 241 |
| 233 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 242 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
| 234 | 243 |
| 235 if (trackingArea_.get()) | 244 if (trackingArea_.get()) |
| 236 [[self view] removeTrackingArea:trackingArea_.get()]; | 245 [[self view] removeTrackingArea:trackingArea_.get()]; |
| 237 [super dealloc]; | 246 [super dealloc]; |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 [reloadButton_ addToolTipRect:[reloadButton_ bounds] owner:self userData:nil]; | 325 [reloadButton_ addToolTipRect:[reloadButton_ bounds] owner:self userData:nil]; |
| 317 | 326 |
| 318 // If the user has any Browser Actions installed, the container view for them | 327 // If the user has any Browser Actions installed, the container view for them |
| 319 // may have to be resized depending on the width of the toolbar frame. | 328 // may have to be resized depending on the width of the toolbar frame. |
| 320 [toolbarView setPostsFrameChangedNotifications:YES]; | 329 [toolbarView setPostsFrameChangedNotifications:YES]; |
| 321 [[NSNotificationCenter defaultCenter] | 330 [[NSNotificationCenter defaultCenter] |
| 322 addObserver:self | 331 addObserver:self |
| 323 selector:@selector(toolbarFrameChanged) | 332 selector:@selector(toolbarFrameChanged) |
| 324 name:NSViewFrameDidChangeNotification | 333 name:NSViewFrameDidChangeNotification |
| 325 object:toolbarView]; | 334 object:toolbarView]; |
| 335 |
| 336 // Set ViewIDs for toolbar elements which don't have their dedicated class. |
| 337 // ViewIDs of |toolbarView|, |reloadButton_|, |locationBar_| and |
| 338 // |browserActionsContainerView_| are handled by themselves. |
| 339 view_id_util::SetID(backButton_, VIEW_ID_BACK_BUTTON); |
| 340 view_id_util::SetID(forwardButton_, VIEW_ID_FORWARD_BUTTON); |
| 341 view_id_util::SetID(homeButton_, VIEW_ID_HOME_BUTTON); |
| 342 view_id_util::SetID(wrenchButton_, VIEW_ID_APP_MENU); |
| 326 } | 343 } |
| 327 | 344 |
| 328 - (void)addAccessibilityDescriptions { | 345 - (void)addAccessibilityDescriptions { |
| 329 // Set accessibility descriptions. http://openradar.appspot.com/7496255 | 346 // Set accessibility descriptions. http://openradar.appspot.com/7496255 |
| 330 NSString* description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_BACK); | 347 NSString* description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_BACK); |
| 331 [[backButton_ cell] | 348 [[backButton_ cell] |
| 332 accessibilitySetOverrideValue:description | 349 accessibilitySetOverrideValue:description |
| 333 forAttribute:NSAccessibilityDescriptionAttribute]; | 350 forAttribute:NSAccessibilityDescriptionAttribute]; |
| 334 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_FORWARD); | 351 description = l10n_util::GetNSStringWithFixup(IDS_ACCNAME_FORWARD); |
| 335 [[forwardButton_ cell] | 352 [[forwardButton_ cell] |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 775 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 792 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
| 776 // Do nothing. | 793 // Do nothing. |
| 777 } | 794 } |
| 778 | 795 |
| 779 // (URLDropTargetController protocol) | 796 // (URLDropTargetController protocol) |
| 780 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 797 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
| 781 // Do nothing. | 798 // Do nothing. |
| 782 } | 799 } |
| 783 | 800 |
| 784 @end | 801 @end |
| OLD | NEW |