0

mac: bump deployment target to 10.10

This change:
1) Marks uses of launch_data_t as deprecated with no replacement (so ignored);
2) Marks uses of the NSObject accessibility API as deprecated to be replaced
   (per bug 921109)
3) Replaces one use of CWInterface with a corresponding use of CWWiFiClient, and
   marks another as ignored for now;
4) Replaces some LaunchServices invocations with their new equivalents;
5) Marks GTM to ignore deprecation warnings, since the GTM dependency will go
   away soon anyway;
6) Fixes how blink refers to NSCalendarIdentifierGregorian;
7) Replaces some uses of NSRunAlertPanel with explicit constructions of NSAlert;
8) Bumps the deployment target to 10.10

An earlier version of this change attempted to incrementally upgrade, but many
of the replacement APIs are themselves only @available on 10.10, so it proved
to be significantly uglier.

Bug: 841631
Change-Id: Ic6e96efbb84ba0a077eda3528b452137d64f5f02
Reviewed-on: https://chromium-review.googlesource.com/c/1407177
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Reviewed-by: Mike Pinkerton <pinkerton@chromium.org>
Reviewed-by: Robert Sesek <rsesek@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#625380}
This commit is contained in:
Elly Fong-Jones
2019-01-23 22:10:28 +00:00
committed by Commit Bot
parent c8970c8ff8
commit bd6d39d548
41 changed files with 210 additions and 202 deletions

@ -7,6 +7,11 @@
#include "base/logging.h"
#include "base/mac/scoped_launch_data.h"
// This file is written in terms of launch_data_t, which is deprecated but has
// no replacement. Ignore the deprecation warnings for now.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
namespace base {
namespace mac {
@ -73,3 +78,5 @@ pid_t PIDForJob(const std::string& job_label) {
} // namespace mac
} // namespace base
#pragma clang diagnostic pop

@ -98,13 +98,16 @@ LSSharedFileListItemRef GetLoginItemForApp() {
for(NSUInteger i = 0; i < [login_items_array count]; ++i) {
LSSharedFileListItemRef item =
reinterpret_cast<LSSharedFileListItemRef>(login_items_array[i]);
CFURLRef item_url_ref = NULL;
base::ScopedCFTypeRef<CFErrorRef> error;
CFURLRef item_url_ref =
LSSharedFileListItemCopyResolvedURL(item, 0, error.InitializeInto());
// It seems that LSSharedFileListItemResolve() can return NULL in
// item_url_ref even if the function itself returns noErr. See
// https://crbug.com/760989
if (LSSharedFileListItemResolve(item, 0, &item_url_ref, NULL) == noErr &&
item_url_ref) {
// This function previously used LSSharedFileListItemResolve(), which could
// return a NULL URL even when returning no error. This caused
// <https://crbug.com/760989>. It's not clear one way or the other whether
// LSSharedFileListItemCopyResolvedURL() shares this behavior, so this check
// remains in place.
if (!error && item_url_ref) {
ScopedCFTypeRef<CFURLRef> item_url(item_url_ref);
if (CFEqual(item_url, url)) {
CFRetain(item);

@ -9,6 +9,11 @@
#include "base/scoped_generic.h"
// This file uses launch_data_t and related APIs, which are deprecated with no
// replacement.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
namespace base {
namespace mac {
@ -28,4 +33,6 @@ using ScopedLaunchData =
} // namespace mac
} // namespace base
#pragma clang diagnostic pop // -Wdeprecated-declarations
#endif // BASE_MAC_SCOPED_LAUNCH_DATA_H_

@ -14,7 +14,7 @@ declare_args() {
# additional code changes are required to be compliant with the availability
# rules.
# Must be of the form x.x.x for Info.plist files.
mac_deployment_target = "10.9.0"
mac_deployment_target = "10.10.0"
# The value of the LSMinimmumSystemVersion in Info.plist files. This partially
# controls the minimum supported version of macOS for Chromium by

@ -826,10 +826,15 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
waitTitle =
l10n_util::GetNSString(IDS_ABANDON_DOWNLOAD_DIALOG_CONTINUE_BUTTON);
base::scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]);
[alert setMessageText:titleText];
[alert setInformativeText:explanationText];
[alert addButtonWithTitle:waitTitle];
[alert addButtonWithTitle:exitTitle];
// 'waitButton' is the default choice.
int choice = NSRunAlertPanel(titleText, @"%@",
waitTitle, exitTitle, nil, explanationText);
return choice == NSAlertDefaultReturn ? YES : NO;
int choice = [alert runModal];
return choice == NSAlertFirstButtonReturn ? YES : NO;
}
// Check all profiles for in progress downloads, and if we find any, prompt the

@ -12,6 +12,12 @@
#include "base/logging.h"
#include "base/strings/sys_string_conversions.h"
// TODO(crbug.com/841631): This file uses the deprecated CWInterface interface;
// it needs to be migrated to CWWiFiClient, which is unfortunately not
// compatible.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
namespace media_router {
namespace {
@ -42,3 +48,5 @@ bool MaybeGetWifiSSID(const std::string& if_name, std::string* ssid_out) {
}
} // namespace media_router
#pragma clang diagnostic pop

@ -116,8 +116,11 @@ const char kTestFileContents[] = "test";
- (id)init:(NSString*)name {
if ((self = [super init])) {
base::scoped_nsobject<NSDateFormatter> iso8601day(
[[NSDateFormatter alloc] init]);
[iso8601day setDateFormat:@"yyyy-MM-dd"];
name_.reset([name retain]);
date_.reset([[NSDate dateWithNaturalLanguageString:@"12/12/12"] retain]);
date_.reset([[iso8601day dateFromString:@"2012-12-12"] retain]);
}
return self;
}

@ -121,17 +121,14 @@ DefaultWebClientSetPermission GetDefaultWebClientSetPermission() {
base::string16 GetApplicationNameForProtocol(const GURL& url) {
NSURL* ns_url = [NSURL URLWithString:
base::SysUTF8ToNSString(url.possibly_invalid_spec())];
CFURLRef openingApp = NULL;
OSStatus status = LSGetApplicationForURL((CFURLRef)ns_url,
kLSRolesAll,
NULL,
&openingApp);
if (status != noErr) {
base::ScopedCFTypeRef<CFErrorRef> out_err;
base::ScopedCFTypeRef<CFURLRef> openingApp(LSCopyDefaultApplicationURLForURL(
(CFURLRef)ns_url, kLSRolesAll, out_err.InitializeInto()));
if (out_err) {
// likely kLSApplicationNotFoundErr
return base::string16();
}
NSString* appPath = [(NSURL*)openingApp path];
CFRelease(openingApp); // NOT A BUG; LSGetApplicationForURL retains for us
NSString* appPath = [base::mac::CFToNSCast(openingApp.get()) path];
NSString* appDisplayName =
[[NSFileManager defaultManager] displayNameAtPath:appPath];
return base::SysNSStringToUTF16(appDisplayName);

@ -407,6 +407,11 @@ class API_AVAILABLE(macos(10.12.2)) TouchBarNotificationBridge
return touchBar.autorelease();
}
// TODO(crbug.com/921109): Migrate to the new NSAccessibility API for this
// method.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (void)setupBackForwardControl {
NSMutableArray* images = [NSMutableArray arrayWithArray:@[
CreateNSImageFromIcon(vector_icons::kBackArrowIcon),
@ -451,6 +456,8 @@ class API_AVAILABLE(macos(10.12.2)) TouchBarNotificationBridge
backForwardControl_.reset([control retain]);
}
#pragma clang diagnostic pop
- (void)updateWebContents:(content::WebContents*)contents {
notificationBridge_->UpdateWebContents(contents);
}

@ -935,17 +935,8 @@ std::vector<base::FilePath> WebAppShortcutCreator::GetAppBundlesByIdUnsorted()
base::SysUTF8ToCFStringRef(GetBundleIdentifier()));
// Retrieve the URLs found by LaunchServices.
base::scoped_nsobject<NSArray> urls;
if (@available(macOS 10.10, *)) {
urls.reset(base::mac::CFToNSCast(
LSCopyApplicationURLsForBundleIdentifier(bundle_id_cf.get(), nullptr)));
} else {
base::ScopedCFTypeRef<CFURLRef> cf_url;
LSFindApplicationForInfo(kLSUnknownCreator, bundle_id_cf.get(), NULL, NULL,
cf_url.InitializeInto());
if (cf_url)
urls.reset([@[ base::mac::CFToNSCast(cf_url) ] retain]);
}
base::scoped_nsobject<NSArray> urls(base::mac::CFToNSCast(
LSCopyApplicationURLsForBundleIdentifier(bundle_id_cf.get(), nullptr)));
// Store only those results corresponding to this user data dir.
std::vector<base::FilePath> paths;

@ -25,17 +25,17 @@ base::FilePath GetProfilesINI() {
}
base::FilePath GetFirefoxDylibPath() {
CFURLRef appURL = nil;
if (LSFindApplicationForInfo(kLSUnknownCreator,
CFSTR("org.mozilla.firefox"),
NULL,
NULL,
&appURL) != noErr) {
base::ScopedCFTypeRef<CFErrorRef> out_err;
base::ScopedCFTypeRef<CFArrayRef> app_urls(
LSCopyApplicationURLsForBundleIdentifier(CFSTR("org.mozilla.firefox"),
out_err.InitializeInto()));
if (out_err || CFArrayGetCount(app_urls) == 0) {
return base::FilePath();
}
NSBundle *ff_bundle =
[NSBundle bundleWithPath:[base::mac::CFToNSCast(appURL) path]];
CFRelease(appURL);
CFURLRef app_url =
base::mac::CFCastStrict<CFURLRef>(CFArrayGetValueAtIndex(app_urls, 0));
NSBundle* ff_bundle =
[NSBundle bundleWithPath:[base::mac::CFToNSCast(app_url) path]];
NSString *ff_library_path =
[[ff_bundle executablePath] stringByDeletingLastPathComponent];
char buf[MAXPATHLEN];

@ -17,6 +17,11 @@
#include "base/macros.h"
#include "base/strings/sys_string_conversions.h"
// This entire file is written in terms of the launch_data_t API, which is
// deprecated with no replacement, so just ignore the warnings for now.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
namespace {
class ScopedLaunchData {
@ -260,3 +265,5 @@ bool RemoveJob(const std::string& label) {
} // namespace services
} // namespace mac
#pragma clang diagnostic pop

@ -15,10 +15,6 @@ class FilePath;
namespace download {
bool GetQuarantinePropertiesDeprecated(
const base::FilePath& file,
base::scoped_nsobject<NSMutableDictionary>* properties);
bool GetQuarantineProperties(
const base::FilePath& file,
base::scoped_nsobject<NSMutableDictionary>* properties);

@ -17,46 +17,6 @@
namespace download {
// Once Chrome no longer supports macOS 10.9, this code will no longer be
// necessary. Note that LSCopyItemAttribute was deprecated in macOS 10.8, but
// the replacement to kLSItemQuarantineProperties did not exist until macOS
// 10.10.
#if !defined(MAC_OS_X_VERSION_10_10) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
bool GetQuarantinePropertiesDeprecated(
const base::FilePath& file,
base::scoped_nsobject<NSMutableDictionary>* properties) {
const UInt8* path = reinterpret_cast<const UInt8*>(file.value().c_str());
FSRef file_ref;
if (FSPathMakeRef(path, &file_ref, nullptr) != noErr)
return false;
base::ScopedCFTypeRef<CFTypeRef> quarantine_properties;
OSStatus status =
LSCopyItemAttribute(&file_ref, kLSRolesAll, kLSItemQuarantineProperties,
quarantine_properties.InitializeInto());
if (status != noErr)
return true;
CFDictionaryRef quarantine_properties_dict =
base::mac::CFCast<CFDictionaryRef>(quarantine_properties.get());
if (!quarantine_properties_dict) {
LOG(WARNING) << "kLSItemQuarantineProperties is not a dictionary on file "
<< file.value();
return false;
}
properties->reset(
[base::mac::CFToNSCast(quarantine_properties_dict) mutableCopy]);
return true;
}
#pragma clang diagnostic pop
#endif
API_AVAILABLE(macos(10.10))
bool GetQuarantineProperties(
const base::FilePath& file,
base::scoped_nsobject<NSMutableDictionary>* properties) {

@ -23,34 +23,6 @@
namespace {
// Once Chrome no longer supports macOS 10.9, this code will no longer be
// necessary. Note that LSCopyItemAttribute was deprecated in macOS 10.8, but
// the replacement to kLSItemQuarantineProperties did not exist until macOS
// 10.10.
#if !defined(MAC_OS_X_VERSION_10_10) || \
MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_10
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
bool SetQuarantinePropertiesDeprecated(const base::FilePath& file,
NSDictionary* properties) {
const UInt8* path = reinterpret_cast<const UInt8*>(file.value().c_str());
FSRef file_ref;
if (FSPathMakeRef(path, &file_ref, nullptr) != noErr)
return false;
OSStatus os_error = LSSetItemAttribute(
&file_ref, kLSRolesAll, kLSItemQuarantineProperties, properties);
if (os_error != noErr) {
OSSTATUS_LOG(WARNING, os_error)
<< "Unable to set quarantine attributes on file " << file.value();
return false;
}
return true;
}
#pragma clang diagnostic pop
#endif
API_AVAILABLE(macos(10.10))
bool SetQuarantineProperties(const base::FilePath& file,
NSDictionary* properties) {
base::scoped_nsobject<NSURL> file_url([[NSURL alloc]
@ -170,12 +142,7 @@ bool AddQuarantineMetadataToFile(const base::FilePath& file,
const GURL& referrer) {
base::ScopedBlockingCall scoped_blocking_call(base::BlockingType::MAY_BLOCK);
base::scoped_nsobject<NSMutableDictionary> properties;
bool success = false;
if (@available(macos 10.10, *)) {
success = GetQuarantineProperties(file, &properties);
} else {
success = GetQuarantinePropertiesDeprecated(file, &properties);
}
bool success = GetQuarantineProperties(file, &properties);
if (!success)
return false;
@ -213,11 +180,7 @@ bool AddQuarantineMetadataToFile(const base::FilePath& file,
[properties setValue:origin_url forKey:(NSString*)kLSQuarantineDataURLKey];
}
if (@available(macos 10.10, *)) {
return SetQuarantineProperties(file, properties);
} else {
return SetQuarantinePropertiesDeprecated(file, properties);
}
return SetQuarantineProperties(file, properties);
}
} // namespace

@ -26,11 +26,7 @@ bool IsFileQuarantined(const base::FilePath& file,
return false;
base::scoped_nsobject<NSMutableDictionary> properties;
bool success = false;
if (@available(macos 10.10, *))
success = GetQuarantineProperties(file, &properties);
else
success = GetQuarantinePropertiesDeprecated(file, &properties);
bool success = GetQuarantineProperties(file, &properties);
if (!success || !properties)
return false;

@ -157,8 +157,11 @@ const char kTestFileContents[] = "test";
- (instancetype)init:(NSString*)name {
if ((self = [super init])) {
base::scoped_nsobject<NSDateFormatter> iso8601day(
[[NSDateFormatter alloc] init]);
[iso8601day setDateFormat:@"yyyy-MM-dd"];
name_.reset([name retain]);
date_.reset([[NSDate dateWithNaturalLanguageString:@"12/12/12"] retain]);
date_.reset([[iso8601day dateFromString:@"2012-12-12"] retain]);
}
return self;
}

@ -165,7 +165,7 @@ WiFiServiceMac::~WiFiServiceMac() {
void WiFiServiceMac::Initialize(
scoped_refptr<base::SequencedTaskRunner> task_runner) {
task_runner_.swap(task_runner);
interface_.reset([[CWInterface interface] retain]);
interface_.reset([[[CWWiFiClient sharedWiFiClient] interface] retain]);
if (!interface_) {
DVLOG(1) << "Failed to initialize default interface.";
return;

@ -17,6 +17,11 @@
#include "content/browser/accessibility/browser_accessibility_mac.h"
#include "content/browser/accessibility/browser_accessibility_manager.h"
// This file uses the deprecated NSObject accessibility interface.
// TODO(crbug.com/921109): Migrate to the new NSAccessibility interface.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
using base::StringPrintf;
using base::SysNSStringToUTF8;
using base::SysNSStringToUTF16;
@ -361,3 +366,5 @@ const string AccessibilityTreeFormatterMac::GetDenyString() {
}
} // namespace content
#pragma clang diagnostic pop

@ -2787,6 +2787,11 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
return actions;
}
// TODO(crbug.com/921109): Migrate from the NSObject accessibility interface to
// the NSAccessibility one, then remove this suppression.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Returns a sub-array of values for the given attribute value, starting at
// index, with up to maxCount items. If the given index is out of bounds,
// or there are no values for the given attribute, it will return nil.
@ -2823,6 +2828,8 @@ NSString* const NSAccessibilityRequiredAttributeChrome = @"AXRequired";
return [fullArray count];
}
#pragma clang diagnostic pop
// Returns the list of accessibility attributes that this object supports.
- (NSArray*)accessibilityAttributeNames {
if (![self instanceActive])

@ -19,6 +19,11 @@
#include "testing/gtest_mac.h"
#include "url/gurl.h"
// This file uses the deprecated NSObject accessibility APIs:
// https://crbug.com/921109
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
namespace content {
namespace {
@ -119,3 +124,5 @@ IN_PROC_BROWSER_TEST_F(BrowserAccessibilityCocoaBrowserTest,
}
} // namespace content
#pragma clang diagnostic pop

@ -123,6 +123,11 @@ class BrowserAccessibilityMacTest : public ui::CocoaTest {
std::unique_ptr<BrowserAccessibilityManager> manager_;
};
// The next few tests all use the deprecated NSObject accessibility APIs:
// https://crbug.com/921109.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Standard hit test.
TEST_F(BrowserAccessibilityMacTest, HitTestTest) {
BrowserAccessibilityCocoa* firstChild =
@ -186,6 +191,8 @@ TEST_F(BrowserAccessibilityMacTest, RetainedDetachedObjectsReturnNil) {
[retainedFirstChild release];
}
#pragma clang diagnostic pop
TEST_F(BrowserAccessibilityMacTest, TestComputeTextEdit) {
BrowserAccessibility* owner = [accessibility_ owner];
ASSERT_NE(nullptr, owner);

@ -1381,6 +1381,11 @@ void ExtractUnderlines(NSAttributedString* string,
return client_;
}
// TODO(crbug.com/921109): Migrate from the NSObject accessibility API to the
// NSAccessibility API, then remove this suppression.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
- (NSArray*)accessibilityArrayAttributeValues:(NSString*)attribute
index:(NSUInteger)index
maxCount:(NSUInteger)maxCount {
@ -1451,6 +1456,8 @@ void ExtractUnderlines(NSAttributedString* string,
return clientHelper_->GetFocusedBrowserAccessibilityElement();
}
#pragma clang diagnostic pop
// Below is our NSTextInputClient implementation.
//
// When WebHTMLView receives a NSKeyDown event, WebHTMLView calls the following

@ -39,6 +39,10 @@ TEST_F(WebContentsViewCocoaTest, NonWebDragSourceTest) {
[view draggingSourceOperationMaskForLocal:NO]);
}
// This test uses deprecated NSObject accessibility APIs - see
// https://crbug.com/921109.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
TEST_F(WebContentsViewCocoaTest, AccessibilityParentTest) {
// The designated initializer is private but init should be fine in this case.
base::scoped_nsobject<WebContentsViewCocoa> view(
@ -60,6 +64,7 @@ TEST_F(WebContentsViewCocoaTest, AccessibilityParentTest) {
EXPECT_NSEQ([view accessibilityAttributeValue:NSAccessibilityParentAttribute],
parent_view);
}
#pragma clang diagnostic pop
namespace {

@ -26,9 +26,8 @@
andCallback:(content::JavaScriptDialogManager::DialogClosedCallback)callback;
- (NSAlert*)alert;
- (NSTextField*)textField;
- (void)alertDidEnd:(NSAlert*)alert
returnCode:(int)returnCode
contextInfo:(void*)contextInfo;
- (void)alertDidEndWithResult:(NSModalResponse)returnCode
dialog:(content::ShellJavaScriptDialog*)dialog;
- (void)cancel;
@end
@ -60,10 +59,9 @@
return textField_;
}
- (void)alertDidEnd:(NSAlert*)alert
returnCode:(int)returnCode
contextInfo:(void*)contextInfo {
if (returnCode == NSRunStoppedResponse)
- (void)alertDidEndWithResult:(NSModalResponse)returnCode
dialog:(content::ShellJavaScriptDialog*)dialog {
if (returnCode == NSModalResponseStop)
return;
bool success = returnCode == NSAlertFirstButtonReturn;
@ -71,10 +69,8 @@
if (textField_)
input = base::SysNSStringToUTF16([textField_ stringValue]);
content::ShellJavaScriptDialog* native_dialog =
reinterpret_cast<content::ShellJavaScriptDialog*>(contextInfo);
std::move(callback_).Run(success, input);
manager_->DialogClosed(native_dialog);
manager_->DialogClosed(dialog);
}
- (void)cancel {
@ -117,11 +113,10 @@ ShellJavaScriptDialog::ShellJavaScriptDialog(
[other setKeyEquivalent:@"\e"];
}
[alert
beginSheetModalForWindow:nil // nil here makes it app-modal
modalDelegate:helper_
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:this];
[alert beginSheetModalForWindow:nil // nil here makes it app-modal
completionHandler:^void(NSModalResponse returnCode) {
[helper_ alertDidEndWithResult:returnCode dialog:this];
}];
}
ShellJavaScriptDialog::~ShellJavaScriptDialog() {

@ -31,9 +31,8 @@ const int kPasswordFieldTag = 2;
- (NSAlert*)alert;
- (NSView*)accessoryView;
- (void)alertDidEnd:(NSAlert*)alert
returnCode:(int)returnCode
contextInfo:(void*)contextInfo;
- (void)alertDidEndWithResponse:(NSModalResponse)response
dialog:(content::ShellLoginDialog*)dialog;
- (void)cancel;
@end
@ -57,20 +56,17 @@ const int kPasswordFieldTag = 2;
return accessory_view;
}
- (void)alertDidEnd:(NSAlert*)alert
returnCode:(int)returnCode
contextInfo:(void*)contextInfo {
if (returnCode == NSRunStoppedResponse)
- (void)alertDidEndWithResponse:(NSModalResponse)returnCode
dialog:(content::ShellLoginDialog*)dialog {
if (returnCode == NSModalResponseStop)
return;
content::ShellLoginDialog* this_dialog =
reinterpret_cast<content::ShellLoginDialog*>(contextInfo);
if (returnCode == NSAlertFirstButtonReturn) {
this_dialog->UserAcceptedAuth(
dialog->UserAcceptedAuth(
base::SysNSStringToUTF16([usernameField_ stringValue]),
base::SysNSStringToUTF16([passwordField_ stringValue]));
} else {
this_dialog->UserCancelledAuth();
dialog->UserCancelledAuth();
}
}
@ -95,11 +91,10 @@ void ShellLoginDialog::PlatformCreateDialog(const base::string16& message) {
[alert addButtonWithTitle:@"OK"];
NSButton* other = [alert addButtonWithTitle:@"Cancel"];
[other setKeyEquivalent:@"\e"];
[alert
beginSheetModalForWindow:nil // nil here makes it app-modal
modalDelegate:helper_
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:this];
[alert beginSheetModalForWindow:nil
completionHandler:^void(NSModalResponse resp) {
[helper_ alertDidEndWithResponse:resp dialog:this];
}];
}
void ShellLoginDialog::PlatformCleanUp() {

@ -141,6 +141,7 @@ mac_app_bundle("remoting_host_uninstaller") {
"//base",
"//remoting/host:remoting_infoplist_strings",
"//remoting/host/mac:constants",
"//ui/base:base",
]
foreach(locale, remoting_locales_with_underscores) {
deps += [ ":remoting_uninstaller_strings_${locale}_bundle_data" ]

@ -6,7 +6,10 @@
#import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
#include "remoting/base/string_resources.h"
#include "remoting/host/installer/mac/uninstaller/remoting_uninstaller.h"
#include "ui/base/l10n/l10n_util_mac.h"
@implementation RemotingUninstallerAppDelegate
@ -19,13 +22,12 @@
- (void)showSuccess:(bool)success withMessage:(NSString*) message {
NSString* summary = success ? @"Uninstall succeeded" : @"Uninstall failed";
NSAlert* alert = [NSAlert alertWithMessageText:summary
defaultButton:@"OK"
alternateButton:nil
otherButton:nil
informativeTextWithFormat:@"%@", message];
[alert setAlertStyle:
(success ? NSInformationalAlertStyle : NSCriticalAlertStyle)];
base::scoped_nsobject<NSAlert> alert([[NSAlert alloc] init]);
[alert setMessageText:summary];
[alert setInformativeText:message];
[alert setAlertStyle:(success ? NSInformationalAlertStyle
: NSCriticalAlertStyle)];
[alert addButtonWithTitle:l10n_util::GetNSString(IDS_OK)];
[alert runModal];
}

@ -7,6 +7,12 @@
#import <CoreWLAN/CoreWLAN.h>
#import <Foundation/Foundation.h>
// This file uses the deprecated CWInterface API, but CWWiFiClient appears to be
// different in ways that are relevant to this code, so for now ignore the
// deprecation. See <https://crbug.com/841631>.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"
@ -135,3 +141,5 @@ std::unique_ptr<WifiPollingPolicy> WifiDataProviderMac::CreatePollingPolicy() {
}
} // namespace device
#pragma clang diagnostic pop

@ -306,11 +306,11 @@ int RunApplication(NSString* app_path,
forKey:@"TestingEnvironmentVariables"];
[xctestrun setObject:testTargetName forKey:@"TestTargetName"];
NSString* error;
NSData* data = [NSPropertyListSerialization
dataFromPropertyList:xctestrun
dataWithPropertyList:xctestrun
format:NSPropertyListXMLFormat_v1_0
errorDescription:&error];
options:0
error:nil];
[data writeToFile:tempFilePath atomically:YES];
XCRunTask* task = [[[XCRunTask alloc] initWithArguments:@[
@"xcodebuild", @"-xctestrun", tempFilePath, @"-destination",

@ -89,7 +89,8 @@ LocaleMac::LocaleMac(NSLocale* locale)
: locale_(locale),
gregorian_calendar_(
kAdoptNS,
[[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar]),
[[NSCalendar alloc]
initWithCalendarIdentifier:NSCalendarIdentifierGregorian]),
did_initialize_number_data_(false) {
NSArray* available_languages = [NSLocale ISOLanguageCodes];
// NSLocale returns a lower case NSLocaleLanguageCode so we don't have care

@ -455,6 +455,10 @@ if (is_mac) {
defines = [ "USE_PROTECTED_ALLOCATIONS=1" ]
include_dirs = [ "breakpad/src/client/apple/Framework" ]
# TODO(crbug.com/841631): Breakpad uses bootstrap_subset() and
# bootstrap_create_server(), both of which are deprecated starting in 10.10.
cflags = [ "-Wno-deprecated-declarations" ]
deps = [
":crash_inspector",
":crash_report_sender",

@ -39,6 +39,11 @@ component("google_toolbox_for_mac") {
"Cocoa.framework",
"QuartzCore.framework",
]
# TODO(crbug.com/841631): GTM uses accessibility APIs that are deprecated as
# of 10.10. These can't yet be compiled out, so for now, ignore deprecated
# declarations in GTM altogether.
cflags = [ "-Wno-deprecated-declarations" ]
} else { # is_ios
sources += [
"src/DebugUtils/GTMMethodCheck.h",

@ -43,16 +43,13 @@
- (NSArray*)installedBrowserIdentifiers; // sort order not specified
- (NSString*)defaultBrowserIdentifier;
- (NSURL*)defaultBrowserURL;
- (NSArray*)installedFeedViewerIdentifiers;
- (NSString*)defaultFeedViewerIdentifier;
- (NSURL*)defaultFeedViewerURL;
- (void)setDefaultBrowserWithIdentifier:(NSString*)bundleID;
- (void)setDefaultFeedViewerWithIdentifier:(NSString*)bundleID;
- (NSURL*)urlOfApplicationWithIdentifier:(NSString*)bundleID;
- (NSString*)identifierForBundle:(NSURL*)inBundleURL;
- (NSString*)displayNameForFile:(NSURL*)inFileURL;

@ -81,22 +81,6 @@
return [(NSString*)LSCopyDefaultHandlerForURLScheme(CFSTR("feed")) autorelease];
}
- (NSURL*)defaultBrowserURL
{
NSString* defaultBundleId = [self defaultBrowserIdentifier];
if (defaultBundleId)
return [self urlOfApplicationWithIdentifier:defaultBundleId];
return nil;
}
- (NSURL*)defaultFeedViewerURL
{
NSString* defaultBundleId = [self defaultFeedViewerIdentifier];
if (defaultBundleId)
return [self urlOfApplicationWithIdentifier:defaultBundleId];
return nil;
}
- (void)setDefaultBrowserWithIdentifier:(NSString*)bundleID
{
LSSetDefaultHandlerForURLScheme(CFSTR("http"), (CFStringRef)bundleID);
@ -110,17 +94,6 @@
LSSetDefaultHandlerForURLScheme(CFSTR("feed"), (CFStringRef)bundleID);
}
- (NSURL*)urlOfApplicationWithIdentifier:(NSString*)bundleID
{
if (!bundleID)
return nil;
NSURL* appURL = nil;
if (LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)bundleID, NULL, NULL, (CFURLRef*)&appURL) == noErr)
return [appURL autorelease];
return nil;
}
- (NSString*)identifierForBundle:(NSURL*)inBundleURL
{
if (!inBundleURL) return nil;

@ -33,3 +33,6 @@ Local modifications:
- MOZILLA_EXPORT was added to some constants in NSPasteboard+Utils.h.
- +[NSWorkspace(CaminoDefaultBrowserAdditions) isLeopardOrHigher] hidden since
it relies on methods deprecated in 10.8 (and is unused in Chrome).
- NSWorkspace(CaminoDefaultBrowserAdditions) methods defaultBrowserURL,
defaultFeedViewerURL, and urlOfApplicationWithIdentifier: removed since they
are unused in Chrome and rely on deprecated APIs as of 10.10.

@ -13,6 +13,11 @@
#include "ui/views/widget/widget.h"
#import "testing/gtest_mac.h"
// This file uses the deprecated NSObject accessibility API - see
// https://crbug.com/921109.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
namespace views {
namespace test {
@ -163,3 +168,5 @@ TEST_F(TabbedPaneAccessibilityMacTest, WritableValue) {
} // namespace test
} // namespace views
#pragma clang diagnostic pop

@ -97,6 +97,11 @@ class TestWidgetDelegate : public test::TestDesktopWidgetDelegate {
constexpr char TestWidgetDelegate::kAccessibleWindowTitle[];
// This test framework uses the deprecated NSObject accessibility APIs - see
// https://crbug.com/921109.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
class AXNativeWidgetMacTest : public test::WidgetTest {
public:
AXNativeWidgetMacTest() {}
@ -927,3 +932,5 @@ TEST_F(AXNativeWidgetMacTest, Combobox) {
}
} // namespace views
#pragma clang diagnostic pop

@ -701,6 +701,11 @@ TEST_F(NativeWidgetMacTest, SetCursor) {
widget->CloseNow();
}
// This test uses the deprecated NSObject accessibility API - see
// https://crbug.com/921109.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
// Tests that an accessibility request from the system makes its way through to
// a views::Label filling the window.
TEST_F(NativeWidgetMacTest, AccessibilityIntegration) {
@ -726,6 +731,8 @@ TEST_F(NativeWidgetMacTest, AccessibilityIntegration) {
widget->CloseNow();
}
#pragma clang diagnostic pop
namespace {
Widget* AttachPopupToNativeParent(NSWindow* native_parent) {

@ -209,7 +209,7 @@ const int kMessageTextMaxSlots = 2000;
case NSAlertSecondButtonReturn: // Cancel
alertBridge_->SendResultAndDestroy(AlertDisposition::SECONDARY_BUTTON);
break;
case NSRunStoppedResponse: // Window was closed underneath us
case NSModalResponseStop: // Window was closed underneath us
alertBridge_->SendResultAndDestroy(AlertDisposition::CLOSE);
break;
default:
@ -223,10 +223,15 @@ const int kMessageTextMaxSlots = 2000;
NSAlert* alert = [self alert];
[alert layout];
[[alert window] recalculateKeyViewLoop];
// TODO(crbug.com/841631): Migrate to `[NSWindow
// beginSheetModalForWindow:completionHandler:]` instead.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[alert beginSheetModalForWindow:nil // nil here makes it app-modal
modalDelegate:self
didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
#pragma clang diagnostic pop
}
- (void)closeWindow {

@ -1338,11 +1338,16 @@ void BridgedNativeWidgetImpl::ShowAsModalSheet() {
// Since |this| may destroy [window_ delegate], use |window_| itself as the
// delegate, which will forward to ViewsNSWindowDelegate if |this| is still
// alive (i.e. it has not set the window delegate to nil).
// TODO(crbug.com/841631): Migrate to `[NSWindow
// beginSheet:completionHandler:]` instead of this method.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[NSApp beginSheet:window_
modalForWindow:parent_window
modalDelegate:window_
didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
contextInfo:nullptr];
#pragma clang diagnostic pop
}
} // namespace views