diff options
author | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 04:10:02 +0000 |
---|---|---|
committer | shess@chromium.org <shess@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-14 04:10:02 +0000 |
commit | 4b1deac7ba7e7a6bf0425e6ed4db26e0c29daa7f (patch) | |
tree | 88cce4c938f6c7b69125ac686188da49276838d1 | |
parent | 4d930b8a3f6c2e391ff022a1fd8520cd82fc60a0 (diff) | |
download | chromium_src-4b1deac7ba7e7a6bf0425e6ed4db26e0c29daa7f.zip chromium_src-4b1deac7ba7e7a6bf0425e6ed4db26e0c29daa7f.tar.gz chromium_src-4b1deac7ba7e7a6bf0425e6ed4db26e0c29daa7f.tar.bz2 |
[Mac] Have reload button handle tooltip directly.
Previously the reload button tooltip was handled dynamically via
-view:stringForToolTip:point:userData:. Now that the button is a
distinct class, just have that class handle it directly.
BUG=58954
TEST=reload tooltip still works, and the crash in the bug stops happening.
Review URL: http://codereview.chromium.org/3814001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62508 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/cocoa/reload_button.mm | 5 | ||||
-rw-r--r-- | chrome/browser/cocoa/toolbar_controller.mm | 14 |
2 files changed, 5 insertions, 14 deletions
diff --git a/chrome/browser/cocoa/reload_button.mm b/chrome/browser/cocoa/reload_button.mm index 4a46a51..c1379ed 100644 --- a/chrome/browser/cocoa/reload_button.mm +++ b/chrome/browser/cocoa/reload_button.mm @@ -4,10 +4,13 @@ #import "chrome/browser/cocoa/reload_button.h" +#include "app/l10n_util.h" +#include "app/l10n_util_mac.h" #include "base/nsimage_cache_mac.h" #include "chrome/app/chrome_dll_resource.h" #import "chrome/browser/cocoa/gradient_button_cell.h" #import "chrome/browser/cocoa/view_id_util.h" +#include "grit/generated_resources.h" namespace { @@ -63,10 +66,12 @@ NSString* const kStopImageName = @"stop_Template.pdf"; if (isLoading) { [self setImage:nsimage_cache::ImageNamed(kStopImageName)]; [self setTag:IDC_STOP]; + [self setToolTip:l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_STOP)]; [self setEnabled:YES]; } else if (force || ![self isMouseInside]) { [self setImage:nsimage_cache::ImageNamed(kReloadImageName)]; [self setTag:IDC_RELOAD]; + [self setToolTip:l10n_util::GetNSStringWithFixup(IDS_TOOLTIP_RELOAD)]; // This button's cell may not have received a mouseExited event, and // therefore it could still think that the mouse is inside the button. Make diff --git a/chrome/browser/cocoa/toolbar_controller.mm b/chrome/browser/cocoa/toolbar_controller.mm index 1d37b09..4405b3f 100644 --- a/chrome/browser/cocoa/toolbar_controller.mm +++ b/chrome/browser/cocoa/toolbar_controller.mm @@ -282,10 +282,6 @@ class NotificationBridge : public NotificationObserver { NSView* toolbarView = [self view]; [toolbarView addTrackingArea:trackingArea_.get()]; - // We want a dynamic tooltip on the reload button, so tell the - // reload button to ask us for the tooltip. - [reloadButton_ addToolTipRect:[reloadButton_ bounds] owner:self userData:nil]; - // If the user has any Browser Actions installed, the container view for them // may have to be resized depending on the width of the toolbar frame. [toolbarView setPostsFrameChangedNotifications:YES]; @@ -722,16 +718,6 @@ class NotificationBridge : public NotificationObserver { return browserActionsController_.get(); } -- (NSString*)view:(NSView*)view - stringForToolTip:(NSToolTipTag)tag - point:(NSPoint)point - userData:(void*)userData { - DCHECK(view == reloadButton_); - - return l10n_util::GetNSStringWithFixup( - [reloadButton_ tag] == IDC_STOP ? IDS_TOOLTIP_STOP : IDS_TOOLTIP_RELOAD); -} - // (URLDropTargetController protocol) - (void)dropURLs:(NSArray*)urls inView:(NSView*)view at:(NSPoint)point { // TODO(viettrungluu): This code is more or less copied from the code in |