Commit 397009ea authored by Elly Fong-Jones's avatar Elly Fong-Jones Committed by Commit Bot

mac: remove 10.10 deployment target conditionals

This change replaces @available(macOS 10.10, *) with true and removes
API_AVAILABLE(macos(10.10)) annotations, then simplifies code where possible
as a result.

Bug: 841631
Change-Id: I55e0fbf23d836951354506f2058a419ebc95bb8b
Reviewed-on: https://chromium-review.googlesource.com/c/1437254Reviewed-by: default avatarAvi Drissman <avi@chromium.org>
Commit-Queue: Elly Fong-Jones <ellyjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#626114}
parent 54fab028
......@@ -1628,8 +1628,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
}
- (BOOL)application:(NSApplication*)application
willContinueUserActivityWithType:(NSString*)userActivityType
API_AVAILABLE(macos(10.10)) {
willContinueUserActivityWithType:(NSString*)userActivityType {
return [userActivityType isEqualToString:NSUserActivityTypeBrowsingWeb];
}
......@@ -1642,7 +1641,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
restorationHandler:
(void (^)(NSArray<id<NSUserActivityRestoring>>*))restorationHandler
#endif
API_AVAILABLE(macos(10.10)) {
{
if (![userActivity.activityType
isEqualToString:NSUserActivityTypeBrowsingWeb]) {
return NO;
......@@ -1678,14 +1677,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
}
- (void)passURLToHandoffManager:(const GURL&)handoffURL {
if (@available(macOS 10.10, *)) {
[handoffManager_ updateActiveURL:handoffURL];
} else {
// Only ends up being called in 10.10+, i.e. if shouldUseHandoff returns
// true. Some tests override shouldUseHandoff to always return true, but
// then they also override this function to do something else.
NOTREACHED();
}
}
- (void)updateHandoffManager:(content::WebContents*)webContents {
......
......@@ -14,10 +14,4 @@
: NSObject<NSMenuDelegate, NSSharingServiceDelegate>
@end
@interface ShareMenuController (ExposedForTesting)
// Whether the menu should add a "More..." item that opens the
// Sharing Extension pref pane.
+ (BOOL)shouldShowMoreItem;
@end
#endif // CHROME_BROWSER_UI_COCOA_SHARE_MENU_CONTROLLER_H_
......@@ -60,11 +60,7 @@ NSString* const kRemindersSharingServiceName =
base::scoped_nsobject<NSImage> snapshotForShare_;
// The Reminders share extension reads title/URL from the currently active
// activity.
base::scoped_nsobject<NSUserActivity> activity_ API_AVAILABLE(macos(10.10));
}
+ (BOOL)shouldShowMoreItem {
return base::mac::IsAtLeastOS10_10();
base::scoped_nsobject<NSUserActivity> activity_;
}
// NSMenuDelegate
......@@ -107,9 +103,6 @@ NSString* const kRemindersSharingServiceName =
[item setEnabled:canShare];
[menu addItem:item];
}
if (![[self class] shouldShowMoreItem]) {
return;
}
base::scoped_nsobject<NSMenuItem> moreItem([[NSMenuItem alloc]
initWithTitle:l10n_util::GetNSString(IDS_SHARING_MORE_MAC)
action:@selector(openSharingPrefs:)
......@@ -182,10 +175,8 @@ NSString* const kRemindersSharingServiceName =
windowForShare_ = nil;
rectForShare_ = NSZeroRect;
snapshotForShare_.reset();
if (@available(macOS 10.10, *)) {
[activity_ invalidate];
activity_.reset();
}
}
// Performs the share action using the sharing service represented by |sender|.
......@@ -212,7 +203,6 @@ NSString* const kRemindersSharingServiceName =
} else {
itemsToShare = @[ url ];
}
if (@available(macOS 10.10, *)) {
if ([[service name] isEqual:kRemindersSharingServiceName]) {
activity_.reset([[NSUserActivity alloc]
initWithActivityType:NSUserActivityTypeBrowsingWeb]);
......@@ -223,13 +213,11 @@ NSString* const kRemindersSharingServiceName =
[activity_ setTitle:title];
[activity_ becomeCurrent];
}
}
[service performWithItems:itemsToShare];
}
// Opens the "Sharing" subpane of the "Extensions" macOS preference pane.
- (void)openSharingPrefs:(NSMenuItem*)sender {
DCHECK([[self class] shouldShowMoreItem]);
NSURL* prefPaneURL =
[NSURL fileURLWithPath:kExtensionPrefPanePath isDirectory:YES];
NSDictionary* args = @{
......
......@@ -106,9 +106,6 @@ IN_PROC_BROWSER_TEST_F(ShareMenuControllerTest, PopulatesMenu) {
// This cancels out, so only decrement if the "More..." item
// isn't showing.
NSInteger expected_count = [sharing_services_for_url count];
if (![ShareMenuController shouldShowMoreItem]) {
--expected_count;
}
EXPECT_EQ([menu numberOfItems], expected_count);
NSSharingService* reading_list_service = [NSSharingService
......@@ -131,9 +128,6 @@ IN_PROC_BROWSER_TEST_F(ShareMenuControllerTest, PopulatesMenu) {
}
IN_PROC_BROWSER_TEST_F(ShareMenuControllerTest, AddsMoreButton) {
if (![ShareMenuController shouldShowMoreItem]) {
return;
}
base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@"Share"]);
[controller_ menuNeedsUpdate:menu];
......
......@@ -30,11 +30,8 @@ void AppWindowNativeWidgetMac::PopulateCreateWindowParams(
params->window_class = views_bridge_mac::mojom::WindowClass::kFrameless;
params->style_mask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
NSWindowStyleMaskMiniaturizable |
NSWindowStyleMaskResizable;
if (@available(macOS 10.10, *))
params->style_mask |= NSWindowStyleMaskFullSizeContentView;
else
NOTREACHED();
NSWindowStyleMaskResizable |
NSWindowStyleMaskFullSizeContentView;
}
}
......
......@@ -300,8 +300,6 @@ void BrowserFrameMac::PopulateCreateWindowParams(
if (browser_view_->IsBrowserTypeNormal() ||
browser_view_->IsBrowserTypeHostedApp()) {
params->window_class = views_bridge_mac::mojom::WindowClass::kBrowser;
if (@available(macOS 10.10, *))
params->style_mask |= NSFullSizeContentViewWindowMask;
// Ensure tabstrip/profile button are visible.
......
......@@ -342,11 +342,6 @@ void ExecFilePathWatcherCallback::NotifyPathChanged(const base::FilePath& path,
} else {
bool in_trash = false;
NSFileManager* file_manager = [NSFileManager defaultManager];
// Apple deprecated FSDetermineIfRefIsEnclosedByFolder() when deploying to
// 10.8, but didn't add getRelationship:... until 10.10. So fall back to
// the deprecated function while running on 10.9 (and delete the else block
// when Chromium requires OS X 10.10+).
if (@available(macOS 10.10, *)) {
NSURLRelationship relationship;
if ([file_manager getRelationship:&relationship
ofDirectory:NSTrashDirectory
......@@ -355,22 +350,6 @@ void ExecFilePathWatcherCallback::NotifyPathChanged(const base::FilePath& path,
error:nil]) {
in_trash = relationship == NSURLRelationshipContains;
}
} else {
DCHECK(base::mac::IsAtMostOS10_9());
Boolean fs_in_trash;
FSRef ref;
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
if (CFURLGetFSRef(base::mac::NSToCFCast(executable_fsref_.get()), &ref)) {
// This is ok because it only happens on 10.9 and won't be needed once
// we stop supporting that.
OSErr err = FSDetermineIfRefIsEnclosedByFolder(
kOnAppropriateDisk, kTrashFolderType, &ref, &fs_in_trash);
#pragma clang diagnostic pop
if (err == noErr && fs_in_trash)
in_trash = true;
}
}
if (in_trash) {
needs_shutdown = true;
} else {
......
......@@ -54,7 +54,7 @@ class SafeDMG {
bool EnableSandbox();
// Performs the actual DMG operation.
API_AVAILABLE(macos(10.10)) bool ParseDMG();
bool ParseDMG();
base::File dmg_file_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment