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/ui/cocoa/toolbar_controller.h" | 5 #import "chrome/browser/ui/cocoa/toolbar_controller.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/l10n_util_mac.h" | 10 #include "app/l10n_util_mac.h" |
11 #include "app/mac/nsimage_cache.h" | |
11 #include "app/menus/accelerator_cocoa.h" | 12 #include "app/menus/accelerator_cocoa.h" |
12 #include "app/menus/menu_model.h" | 13 #include "app/menus/menu_model.h" |
13 #include "app/resource_bundle.h" | 14 #include "app/resource_bundle.h" |
14 #include "base/mac_util.h" | 15 #include "base/mac_util.h" |
15 #include "base/nsimage_cache_mac.h" | |
16 #include "base/singleton.h" | 16 #include "base/singleton.h" |
17 #include "base/sys_string_conversions.h" | 17 #include "base/sys_string_conversions.h" |
18 #include "chrome/app/chrome_command_ids.h" | 18 #include "chrome/app/chrome_command_ids.h" |
19 #include "chrome/browser/autocomplete/autocomplete.h" | 19 #include "chrome/browser/autocomplete/autocomplete.h" |
20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" | 20 #include "chrome/browser/autocomplete/autocomplete_classifier.h" |
21 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" | 21 #include "chrome/browser/autocomplete/autocomplete_edit_view.h" |
22 #include "chrome/browser/autocomplete/autocomplete_match.h" | 22 #include "chrome/browser/autocomplete/autocomplete_match.h" |
23 #include "chrome/browser/net/url_fixer_upper.h" | 23 #include "chrome/browser/net/url_fixer_upper.h" |
24 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
216 } | 216 } |
217 | 217 |
218 // Called after the view is done loading and the outlets have been hooked up. | 218 // Called after the view is done loading and the outlets have been hooked up. |
219 // Now we can hook up bridges that rely on UI objects such as the location | 219 // Now we can hook up bridges that rely on UI objects such as the location |
220 // bar and button state. | 220 // bar and button state. |
221 - (void)awakeFromNib { | 221 - (void)awakeFromNib { |
222 // A bug in AppKit (<rdar://7298597>, <http://openradar.me/7298597>) causes | 222 // A bug in AppKit (<rdar://7298597>, <http://openradar.me/7298597>) causes |
223 // images loaded directly from nibs in a framework to not get their "template" | 223 // images loaded directly from nibs in a framework to not get their "template" |
224 // flags set properly. Thus, despite the images being set on the buttons in | 224 // flags set properly. Thus, despite the images being set on the buttons in |
225 // the xib, we must set them in code. | 225 // the xib, we must set them in code. |
226 [backButton_ setImage:nsimage_cache::ImageNamed(kBackButtonImageName)]; | 226 [backButton_ setImage:app::mac::GetCachedImageWithName(kBackButtonImageName)]; |
227 [forwardButton_ setImage:nsimage_cache::ImageNamed(kForwardButtonImageName)]; | 227 [forwardButton_ |
228 setImage:app::mac::GetCachedImageWithName(kForwardButtonImageName)]; | |
Avi (use Gerrit)
2010/12/22 19:06:38
Break after setImage: here and next three times
| |
228 [reloadButton_ | 229 [reloadButton_ |
229 setImage:nsimage_cache::ImageNamed(kReloadButtonReloadImageName)]; | 230 setImage:app::mac::GetCachedImageWithName(kReloadButtonReloadImageName)]; |
230 [homeButton_ setImage:nsimage_cache::ImageNamed(kHomeButtonImageName)]; | 231 [homeButton_ setImage:app::mac::GetCachedImageWithName(kHomeButtonImageName)]; |
231 [wrenchButton_ setImage:nsimage_cache::ImageNamed(kWrenchButtonImageName)]; | 232 [wrenchButton_ |
233 setImage:app::mac::GetCachedImageWithName(kWrenchButtonImageName)]; | |
232 | 234 |
233 if (UpgradeDetector::GetInstance()->notify_upgrade()) | 235 if (UpgradeDetector::GetInstance()->notify_upgrade()) |
234 [self badgeWrenchMenu]; | 236 [self badgeWrenchMenu]; |
235 | 237 |
236 [backButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 238 [backButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
237 [forwardButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 239 [forwardButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
238 [reloadButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 240 [reloadButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
239 [homeButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 241 [homeButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
240 [wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES]; | 242 [wrenchButton_ setShowsBorderOnlyWhileMouseInside:YES]; |
241 | 243 |
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 [wrenchButton_ setAttachedMenu:[wrenchMenuController_ menu]]; | 524 [wrenchButton_ setAttachedMenu:[wrenchMenuController_ menu]]; |
523 } | 525 } |
524 | 526 |
525 - (WrenchMenuController*)wrenchMenuController { | 527 - (WrenchMenuController*)wrenchMenuController { |
526 return wrenchMenuController_; | 528 return wrenchMenuController_; |
527 } | 529 } |
528 | 530 |
529 - (void)badgeWrenchMenu { | 531 - (void)badgeWrenchMenu { |
530 NSImage* badge = ResourceBundle::GetSharedInstance().GetNativeImageNamed( | 532 NSImage* badge = ResourceBundle::GetSharedInstance().GetNativeImageNamed( |
531 IDR_UPDATE_BADGE); | 533 IDR_UPDATE_BADGE); |
532 NSImage* wrenchImage = nsimage_cache::ImageNamed(kWrenchButtonImageName); | 534 NSImage* wrenchImage = |
535 app::mac::GetCachedImageWithName(kWrenchButtonImageName); | |
533 NSSize wrenchImageSize = [wrenchImage size]; | 536 NSSize wrenchImageSize = [wrenchImage size]; |
534 | 537 |
535 scoped_nsobject<NSImage> overlayImage( | 538 scoped_nsobject<NSImage> overlayImage( |
536 [[NSImage alloc] initWithSize:wrenchImageSize]); | 539 [[NSImage alloc] initWithSize:wrenchImageSize]); |
537 | 540 |
538 [overlayImage lockFocus]; | 541 [overlayImage lockFocus]; |
539 [badge drawAtPoint:NSZeroPoint | 542 [badge drawAtPoint:NSZeroPoint |
540 fromRect:NSZeroRect | 543 fromRect:NSZeroRect |
541 operation:NSCompositeSourceOver | 544 operation:NSCompositeSourceOver |
542 fraction:1.0]; | 545 fraction:1.0]; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
763 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { | 766 - (void)indicateDropURLsInView:(NSView*)view at:(NSPoint)point { |
764 // Do nothing. | 767 // Do nothing. |
765 } | 768 } |
766 | 769 |
767 // (URLDropTargetController protocol) | 770 // (URLDropTargetController protocol) |
768 - (void)hideDropURLsIndicatorInView:(NSView*)view { | 771 - (void)hideDropURLsIndicatorInView:(NSView*)view { |
769 // Do nothing. | 772 // Do nothing. |
770 } | 773 } |
771 | 774 |
772 @end | 775 @end |
OLD | NEW |