Commit 226653e9 authored by Sylvain Defresne's avatar Sylvain Defresne Committed by Chromium LUCI CQ

[ios] Move IsMultipleScenesSupported to base/ios/ios_util.{h,mm}

This function is useful to check whether the device supports
having multiple scenes (which has impact on core behaviour
of the application and not just on the UI).

Move it besides other multi-window related functions.

Fix compilation when targeting iOS x86 platform caused by the
inclusion of partition_alloc header in base/memory/checked_ptr.h
even when user_partition_alloc is disabled (which is always
the case on iOS).

Bug: none
Change-Id: I31f7abb6479438176ed72467ddf9811624001911
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2640455
Auto-Submit: Sylvain Defresne <sdefresne@chromium.org>
Commit-Queue: Mark Mentovai <mark@chromium.org>
Reviewed-by: default avatarMark Mentovai <mark@chromium.org>
Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845666}
parent 37bbbb61
...@@ -56,6 +56,11 @@ BASE_EXPORT bool IsMultiwindowSupported(); ...@@ -56,6 +56,11 @@ BASE_EXPORT bool IsMultiwindowSupported();
// base::ios::IsMultiwindowSupported() returns true. // base::ios::IsMultiwindowSupported() returns true.
BASE_EXPORT bool IsSceneStartupSupported(); BASE_EXPORT bool IsSceneStartupSupported();
// Returns true iff multiple windows can be opened, i.e. when the multiwindow
// build flag is on, the device is running on iOS 13+ and it's a compatible
// iPad.
BASE_EXPORT bool IsMultipleScenesSupported();
} // namespace ios } // namespace ios
} // namespace base } // namespace base
......
...@@ -5,6 +5,8 @@ ...@@ -5,6 +5,8 @@
#include "base/ios/ios_util.h" #include "base/ios/ios_util.h"
#import <Foundation/Foundation.h> #import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#include <stddef.h> #include <stddef.h>
#include "base/mac/foundation_util.h" #include "base/mac/foundation_util.h"
...@@ -114,5 +116,12 @@ bool IsSceneStartupSupported() { ...@@ -114,5 +116,12 @@ bool IsSceneStartupSupported() {
return cached_value; return cached_value;
} }
bool IsMultipleScenesSupported() {
if (@available(iOS 13, *)) {
return UIApplication.sharedApplication.supportsMultipleScenes;
}
return false;
}
} // namespace ios } // namespace ios
} // namespace base } // namespace base
...@@ -10,17 +10,20 @@ ...@@ -10,17 +10,20 @@
#include <utility> #include <utility>
#include "base/allocator/partition_allocator/address_pool_manager_bitmap.h"
#include "base/allocator/partition_allocator/checked_ptr_support.h"
#include "base/allocator/partition_allocator/partition_address_space.h"
#include "base/allocator/partition_allocator/partition_alloc_forward.h"
#include "base/allocator/partition_allocator/partition_ref_count.h"
#include "base/check_op.h" #include "base/check_op.h"
#include "base/compiler_specific.h" #include "base/compiler_specific.h"
#include "base/partition_alloc_buildflags.h" #include "base/partition_alloc_buildflags.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "build/buildflag.h" #include "build/buildflag.h"
#if BUILDFLAG(USE_PARTITION_ALLOC)
#include "base/allocator/partition_allocator/address_pool_manager_bitmap.h"
#include "base/allocator/partition_allocator/checked_ptr_support.h"
#include "base/allocator/partition_allocator/partition_address_space.h"
#include "base/allocator/partition_allocator/partition_alloc_forward.h"
#include "base/allocator/partition_allocator/partition_ref_count.h"
#endif
#if BUILDFLAG(USE_BACKUP_REF_PTR) && !defined(OS_NACL) #if BUILDFLAG(USE_BACKUP_REF_PTR) && !defined(OS_NACL)
#define ENABLE_BACKUP_REF_PTR_IMPL 1 #define ENABLE_BACKUP_REF_PTR_IMPL 1
#else #else
......
...@@ -21,8 +21,5 @@ bool IsSceneStartupSupported() { ...@@ -21,8 +21,5 @@ bool IsSceneStartupSupported() {
} }
bool IsMultipleScenesSupported() { bool IsMultipleScenesSupported() {
if (@available(iOS 13, *)) { return base::ios::IsMultipleScenesSupported();
return UIApplication.sharedApplication.supportsMultipleScenes;
}
return false;
} }
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