diff options
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/autofill/autofill_text_field_mac.mm | 12 | ||||
-rw-r--r-- | chrome/browser/cocoa/authorization_util.mm | 3 | ||||
-rw-r--r-- | chrome/browser/cocoa/bookmark_bar_controller.mm | 7 |
3 files changed, 17 insertions, 5 deletions
diff --git a/chrome/browser/autofill/autofill_text_field_mac.mm b/chrome/browser/autofill/autofill_text_field_mac.mm index 509b1a6..5db2ffb 100644 --- a/chrome/browser/autofill/autofill_text_field_mac.mm +++ b/chrome/browser/autofill/autofill_text_field_mac.mm @@ -24,10 +24,16 @@ } } -- (void)setObjectValue:(id)object { - if (isCreditCardField_ && [object isKindOfClass:[NSString class]]) { +- (void)setObjectValue:(id<NSCopying>)anObject { + // -[NSControl setObjectValue:] says that the passed-in object has type + // |id<NSCopying>|, but this function needs to call the NSObject method + // -isKindOfClass: on the parameter. In theory, this is not correct, but this + // is probably a bug in the method signature. + NSObject<NSCopying>* object = static_cast<NSObject<NSCopying>*>(anObject); + if (isCreditCardField_ && + [object isKindOfClass:[NSString class]]) { // Obfuscate the number. - NSString* string = object; + NSString* string = static_cast<NSString*>(object); CreditCard card; card.SetInfo(AutoFillType(CREDIT_CARD_NUMBER), base::SysNSStringToUTF16(string)); diff --git a/chrome/browser/cocoa/authorization_util.mm b/chrome/browser/cocoa/authorization_util.mm index fdd4387..e255993 100644 --- a/chrome/browser/cocoa/authorization_util.mm +++ b/chrome/browser/cocoa/authorization_util.mm @@ -48,7 +48,8 @@ AuthorizationRef AuthorizationCreateToRunAsRoot(CFStringRef prompt) { // The OS will append " Type an administrator's name and password to allow // <CFBundleDisplayName> to make changes." - NSString* prompt_ns = reinterpret_cast<const NSString*>(prompt); + NSString* prompt_ns = const_cast<NSString*>( + reinterpret_cast<const NSString*>(prompt)); const char* prompt_c = [prompt_ns UTF8String]; size_t prompt_length = prompt_c ? strlen(prompt_c) : 0; diff --git a/chrome/browser/cocoa/bookmark_bar_controller.mm b/chrome/browser/cocoa/bookmark_bar_controller.mm index 9c6f8d5..0c7ec9d 100644 --- a/chrome/browser/cocoa/bookmark_bar_controller.mm +++ b/chrome/browser/cocoa/bookmark_bar_controller.mm @@ -874,7 +874,12 @@ const NSTimeInterval kBookmarkBarAnimationDuration = 0.12; // Enable or disable items. We are the menu delegate for both the bar // and for bookmark folder buttons. -- (BOOL)validateUserInterfaceItem:(id)item { +- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)anItem { + // NSUserInterfaceValidations says that the passed-in object has type + // |id<NSValidatedUserInterfaceItem>|, but this function needs to call the + // NSObject method -isKindOfClass: on the parameter. In theory, this is not + // correct, but this is probably a bug in the method signature. + NSMenuItem* item = static_cast<NSMenuItem*>(anItem); // Yes for everything we don't explicitly deny. if (![item isKindOfClass:[NSMenuItem class]]) return YES; |