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

Unified Diff: chrome/browser/cocoa/reload_button.mm

Issue 2973004: [Mac]Implement ViewID support. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Turns out that, it's not a good solution. Created 10 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/cocoa/reload_button.h ('k') | chrome/browser/cocoa/reload_button_unittest.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/reload_button.mm
diff --git a/chrome/browser/cocoa/reload_button.mm b/chrome/browser/cocoa/reload_button.mm
index 53e6c58239638eba4928223cb6795ee039e5a6f4..e5a335729d8e48e920b007e477000f9b80bd9931 100644
--- a/chrome/browser/cocoa/reload_button.mm
+++ b/chrome/browser/cocoa/reload_button.mm
@@ -6,6 +6,7 @@
#include "base/nsimage_cache_mac.h"
#include "chrome/app/chrome_dll_resource.h"
+#import "chrome/browser/cocoa/view_id_util.h"
namespace {
@@ -50,6 +51,7 @@ NSString* const kStopImageName = @"stop_Template.pdf";
// Don't allow multi-clicks, because the user probably wouldn't ever
// want to stop+reload or reload+stop.
[self setIgnoresMultiClick:YES];
+ [self setCommand:IDC_RELOAD];
}
- (void)setIsLoading:(BOOL)isLoading force:(BOOL)force {
@@ -60,17 +62,17 @@ NSString* const kStopImageName = @"stop_Template.pdf";
// that reload mode is desired and make no change.
if (isLoading) {
[self setImage:nsimage_cache::ImageNamed(kStopImageName)];
- [self setTag:IDC_STOP];
+ [self setCommand:IDC_STOP];
} else if (force || ![self isMouseInside]) {
[self setImage:nsimage_cache::ImageNamed(kReloadImageName)];
- [self setTag:IDC_RELOAD];
- } else if ([self tag] == IDC_STOP) {
+ [self setCommand:IDC_RELOAD];
+ } else if ([self command] == IDC_STOP) {
pendingReloadMode_ = YES;
}
}
- (BOOL)sendAction:(SEL)theAction to:(id)theTarget {
- if ([self tag] == IDC_STOP) {
+ if ([self command] == IDC_STOP) {
// The stop command won't be valid after the attempt to change
// back to reload. But it "worked", so short-circuit it.
const BOOL ret =
@@ -105,6 +107,11 @@ NSString* const kStopImageName = @"stop_Template.pdf";
return trackingArea_ && isMouseInside_;
}
+// Tag is used solely for ViewID. Override to prevent changing of it.
+- (NSInteger)tag {
+ return view_id_util::ViewIDToTag(VIEW_ID_RELOAD_BUTTON);
+}
+
@end // ReloadButton
@implementation ReloadButton (Testing)
« no previous file with comments | « chrome/browser/cocoa/reload_button.h ('k') | chrome/browser/cocoa/reload_button_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698