WIP: 4658680: Convert /content/browser to use ARC

https://chromium-review.googlesource.com/c/chromium/src/+/4658680
This commit is contained in:
John Kleinschmidt 2023-07-10 18:52:08 -04:00
Родитель 38e145f33d
Коммит c8559ea448
Не найден ключ, соответствующий данной подписи
7 изменённых файлов: 28 добавлений и 20 удалений

Просмотреть файл

@ -748,10 +748,17 @@ if (is_mac) {
source_set("electron_lib_arc") {
include_dirs = [ "." ]
sources = [
"shell/browser/browser_mac.mm",
"shell/browser/mac/dict_util.h",
"shell/browser/mac/dict_util.mm",
"shell/browser/mac/electron_application.h",
"shell/browser/mac/electron_application.mm",
"shell/browser/mac/electron_application_delegate.h",
"shell/browser/mac/electron_application_delegate.mm",
"shell/browser/native_window_mac.h",
"shell/browser/native_window_mac.mm",
"shell/browser/ui/cocoa/electron_ns_window_delegate.h",
"shell/browser/ui/cocoa/electron_ns_window_delegate.mm",
]
deps = [
@ -761,7 +768,10 @@ if (is_mac) {
"//v8",
]
configs += [ "//build/config/compiler:enable_arc" ]
configs += [
"//build/config/compiler:enable_arc",
"//electron/build/config:mas_build",
]
}
}

Просмотреть файл

@ -127,10 +127,7 @@ filenames = {
"shell/browser/api/electron_api_system_preferences_mac.mm",
"shell/browser/api/electron_api_web_contents_mac.mm",
"shell/browser/auto_updater_mac.mm",
"shell/browser/browser_mac.mm",
"shell/browser/electron_browser_main_parts_mac.mm",
"shell/browser/mac/electron_application.h",
"shell/browser/mac/electron_application.mm",
"shell/browser/mac/in_app_purchase_observer.h",
"shell/browser/mac/in_app_purchase_observer.mm",
"shell/browser/mac/in_app_purchase_product.h",
@ -139,8 +136,6 @@ filenames = {
"shell/browser/mac/in_app_purchase.mm",
"shell/browser/native_browser_view_mac.h",
"shell/browser/native_browser_view_mac.mm",
"shell/browser/native_window_mac.h",
"shell/browser/native_window_mac.mm",
"shell/browser/notifications/mac/cocoa_notification.h",
"shell/browser/notifications/mac/cocoa_notification.mm",
"shell/browser/notifications/mac/notification_center_delegate.h",
@ -161,8 +156,6 @@ filenames = {
"shell/browser/ui/cocoa/electron_menu_controller.mm",
"shell/browser/ui/cocoa/electron_native_widget_mac.h",
"shell/browser/ui/cocoa/electron_native_widget_mac.mm",
"shell/browser/ui/cocoa/electron_ns_window_delegate.h",
"shell/browser/ui/cocoa/electron_ns_window_delegate.mm",
"shell/browser/ui/cocoa/electron_ns_panel.h",
"shell/browser/ui/cocoa/electron_ns_panel.mm",
"shell/browser/ui/cocoa/electron_ns_window.h",

Просмотреть файл

@ -59,7 +59,9 @@ NSString* GetAppPathForProtocol(const GURL& url) {
// likely kLSApplicationNotFoundErr
return nullptr;
}
NSString* app_path = [base::mac::CFToNSCast(openingApp.get()) path];
NSURL* app_url =
const_cast<NSURL*>(reinterpret_cast<const NSURL*>(openingApp.get()));
NSString* app_path = [app_url path];
return app_path;
}
@ -178,7 +180,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
return false;
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
CFStringRef protocol_cf = base::mac::NSToCFCast(protocol_ns);
CFStringRef protocol_cf = reinterpret_cast<CFStringRef>((protocol_ns);
// TODO(codebytere): Use -[NSWorkspace URLForApplicationToOpenURL:] instead
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
@ -200,7 +202,7 @@ bool Browser::RemoveAsDefaultProtocolClient(const std::string& protocol,
// No other app was found set it to none instead of setting it back to itself.
if ([identifier isEqualToString:(__bridge NSString*)other]) {
other = base::mac::NSToCFCast(@"None");
other = reinterpret_cast<CFStringRef>(@"None");
}
OSStatus return_code = LSSetDefaultHandlerForURLScheme(protocol_cf, other);
@ -217,8 +219,9 @@ bool Browser::SetAsDefaultProtocolClient(const std::string& protocol,
return false;
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
OSStatus return_code = LSSetDefaultHandlerForURLScheme(
base::mac::NSToCFCast(protocol_ns), base::mac::NSToCFCast(identifier));
CFStringRef protocol_cf = reinterpret_cast<CFStringRef>(protocol_ns);
CFStringRef identifier_cf = reinterpret_cast<CFStringRef>(identifier);
OSStatus return_code = LSSetDefaultHandlerForURLScheme(protocol_cf, identifier_cf));
return return_code == noErr;
}
@ -232,20 +235,22 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
return false;
NSString* protocol_ns = [NSString stringWithUTF8String:protocol.c_str()];
CFStringRef protocol_cf = reinterpret_cast<CFStringRef>(protocol_ns);
// TODO(codebytere): Use -[NSWorkspace URLForApplicationToOpenURL:] instead
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
base::ScopedCFTypeRef<CFStringRef> bundleId(
LSCopyDefaultHandlerForURLScheme(base::mac::NSToCFCast(protocol_ns)));
LSCopyDefaultHandlerForURLScheme(protocol_cf));
#pragma clang diagnostic pop
if (!bundleId)
return false;
// Ensure the comparison is case-insensitive
// as LS does not persist the case of the bundle id.
NSComparisonResult result =
[base::mac::CFToNSCast(bundleId) caseInsensitiveCompare:identifier];
NSString* bundle_id_ns =
const_cast<NSString*>(reinterpret_cast<const NSString*>(bundleId));
NSComparisonResult result = [bundle_id_ns caseInsensitiveCompare:identifier];
return result == NSOrderedSame;
}

Просмотреть файл

@ -17,11 +17,11 @@
#include "base/supports_user_data.h"
#include "content/public/browser/desktop_media_id.h"
#include "content/public/browser/web_contents_user_data.h"
#include "electron/shell/common/api/api.mojom.h"
#include "extensions/browser/app_window/size_constraints.h"
#include "shell/browser/draggable_region_provider.h"
#include "shell/browser/native_window_observer.h"
#include "shell/browser/ui/inspectable_web_contents_view.h"
#include "shell/common/api/api.mojom.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/views/widget/widget_delegate.h"

Просмотреть файл

@ -12,8 +12,8 @@
#include <vector>
#include "base/mac/scoped_nsobject.h"
#include "electron/shell/common/api/api.mojom.h"
#include "shell/browser/native_window.h"
#include "shell/common/api/api.mojom.h"
#include "ui/display/display_observer.h"
#include "ui/native_theme/native_theme_observer.h"
#include "ui/views/controls/native/native_view_host.h"

Просмотреть файл

@ -8,7 +8,7 @@
#include <memory>
#include <vector>
#include "shell/common/api/api.mojom.h"
#include "electron/shell/common/api/api.mojom.h"
#include "third_party/skia/include/core/SkRegion.h"
#include "ui/gfx/image/image.h"

Просмотреть файл

@ -9,7 +9,7 @@
#include <string>
#include "base/memory/raw_ptr.h"
#include "shell/common/api/api.mojom.h"
#include "electron/shell/common/api/api.mojom.h"
#include "ui/gfx/native_widget_types.h"
class DevToolsContentsResizingStrategy;