chore: bump chromium to 117.0.5892.0 (main) (#39118)

* chore: bump chromium in DEPS to 117.0.5892.0

* 4670267: Don't send javascript: or empty URLs to browser in CreateNewWindow.

4670267

* 4662090: Add metrics for WebGPU support

4662090

* 4672599: Use set_defaults for mac_app_bundle

4672599

* 4663771: usb: Add connection count tracking methods for UsbDelegate

4663771

* 4664578: Remove unused parameter from ExtensionsGuestViewManagerDelegate ctor

4664578

* 4622253: usb: Create classes for usb system tray icon

4622253

* 4678263: Remove ARC support from scoped_nsobject

4678263

* chore: follow-up ARC changes and missing guard corrections

* chore: don't mark 0-param ctor explicit

Follow up to 4664578

* chore: fixup patch indices

* 4670865: Merge ObjectProxy::CallMethodAndBlock{,WithErrorDetails}.

4670865

* chore: follow-up ARC changes and missing guard corrections

* fixup: retain ElectronApplicationDelegate

* fix: correct rustc binary

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
This commit is contained in:
electron-roller[bot] 2023-07-19 00:26:27 +02:00 committed by GitHub
parent ee4460ac68
commit bbdd037219
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
77 changed files with 389 additions and 353 deletions

View file

@ -11,7 +11,9 @@
#import "shell/browser/ui/cocoa/electron_menu_controller.h"
using base::scoped_nsobject;
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron::api {
@ -41,10 +43,10 @@ class MenuMac : public Menu {
void ClosePopupOnUI(int32_t window_id);
void OnClosed(int32_t window_id, base::OnceClosure callback);
scoped_nsobject<ElectronMenuController> menu_controller_;
ElectronMenuController* __strong menu_controller_;
// window ID -> open context menu
std::map<int32_t, scoped_nsobject<ElectronMenuController>> popup_controllers_;
std::map<int32_t, ElectronMenuController*> popup_controllers_;
base::WeakPtrFactory<MenuMac> weak_factory_{this};
};

View file

@ -20,7 +20,7 @@
namespace {
static scoped_nsobject<NSMenu> applicationMenu_;
static NSMenu* __strong applicationMenu_;
ui::Accelerator GetAcceleratorFromKeyEquivalentAndModifierMask(
NSString* key_equivalent,
@ -75,16 +75,15 @@ v8::Local<v8::Value> Menu::GetUserAcceleratorAt(int command_id) const {
if (![NSMenuItem usesUserKeyEquivalents])
return v8::Null(isolate);
auto controller = base::scoped_nsobject<ElectronMenuController>(
[[ElectronMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO]);
auto controller = [[ElectronMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO];
int command_index = GetIndexOfCommandId(command_id);
if (command_index == -1)
return v8::Null(isolate);
base::scoped_nsobject<NSMenuItem> item =
[controller makeMenuItemForIndex:command_index fromModel:model()];
NSMenuItem* item = [controller makeMenuItemForIndex:command_index
fromModel:model()];
if ([[item userKeyEquivalent] length] == 0)
return v8::Null(isolate);
@ -109,9 +108,9 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
base::OnceClosure close_callback =
base::BindOnce(&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id,
std::move(callback));
popup_controllers_[window_id] = base::scoped_nsobject<ElectronMenuController>(
popup_controllers_[window_id] =
[[ElectronMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO]);
useDefaultAccelerator:NO];
NSMenu* menu = [popup_controllers_[window_id] menu];
NSView* view = [nswindow contentView];
@ -171,9 +170,9 @@ void MenuMac::ClosePopupAt(int32_t window_id) {
std::u16string MenuMac::GetAcceleratorTextAtForTesting(int index) const {
// A least effort to get the real shortcut text of NSMenuItem, the code does
// not need to be perfect since it is test only.
base::scoped_nsobject<ElectronMenuController> controller(
ElectronMenuController* controller =
[[ElectronMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO]);
useDefaultAccelerator:NO];
NSMenuItem* item = [[controller menu] itemAtIndex:index];
std::u16string text;
NSEventModifierFlags modifiers = [item keyEquivalentModifierMask];
@ -227,15 +226,15 @@ void MenuMac::OnClosed(int32_t window_id, base::OnceClosure callback) {
// static
void Menu::SetApplicationMenu(Menu* base_menu) {
MenuMac* menu = static_cast<MenuMac*>(base_menu);
base::scoped_nsobject<ElectronMenuController> menu_controller(
ElectronMenuController* menu_controller =
[[ElectronMenuController alloc] initWithModel:menu->model_.get()
useDefaultAccelerator:YES]);
useDefaultAccelerator:YES];
NSRunLoop* currentRunLoop = [NSRunLoop currentRunLoop];
[currentRunLoop cancelPerformSelector:@selector(setMainMenu:)
target:NSApp
argument:applicationMenu_];
applicationMenu_.reset([[menu_controller menu] retain]);
applicationMenu_ = [menu_controller menu];
[[NSRunLoop currentRunLoop]
performSelector:@selector(setMainMenu:)
target:NSApp
@ -243,8 +242,7 @@ void Menu::SetApplicationMenu(Menu* base_menu) {
order:0
modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
// Ensure the menu_controller_ is destroyed after main menu is set.
menu_controller.swap(menu->menu_controller_);
menu->menu_controller_ = menu_controller;
}
// static

View file

@ -6,6 +6,10 @@
#include "shell/browser/mac/electron_application.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron::api {
void NativeTheme::UpdateMacOSAppearanceForOverrideValue(

View file

@ -12,6 +12,10 @@
#include "shell/common/gin_converters/value_converter.h"
#include "shell/common/gin_helper/promise.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron::api {
v8::Local<v8::Promise> PushNotifications::RegisterForAPNSNotifications(

View file

@ -30,13 +30,17 @@
#include "skia/ext/skia_utils_mac.h"
#include "ui/native_theme/native_theme.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace gin {
template <>
struct Converter<NSAppearance*> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
NSAppearance** out) {
NSAppearance* __strong* out) {
if (val->IsNull()) {
*out = nil;
return true;
@ -409,7 +413,7 @@ std::string SystemPreferences::GetSystemColor(gin_helper::ErrorThrower thrower,
}
bool SystemPreferences::CanPromptTouchID() {
base::scoped_nsobject<LAContext> context([[LAContext alloc] init]);
LAContext* context = [[LAContext alloc] init];
LAPolicy auth_policy = LAPolicyDeviceOwnerAuthenticationWithBiometricsOrWatch;
if (![context canEvaluatePolicy:auth_policy error:nil])
return false;
@ -422,7 +426,7 @@ v8::Local<v8::Promise> SystemPreferences::PromptTouchID(
gin_helper::Promise<void> promise(isolate);
v8::Local<v8::Promise> handle = promise.GetHandle();
base::scoped_nsobject<LAContext> context([[LAContext alloc] init]);
LAContext* context = [[LAContext alloc] init];
base::ScopedCFTypeRef<SecAccessControlRef> access_control =
base::ScopedCFTypeRef<SecAccessControlRef>(
SecAccessControlCreateWithFlags(
@ -463,7 +467,8 @@ v8::Local<v8::Promise> SystemPreferences::PromptTouchID(
// static
bool SystemPreferences::IsTrustedAccessibilityClient(bool prompt) {
NSDictionary* options = @{(id)kAXTrustedCheckOptionPrompt : @(prompt)};
NSDictionary* options =
@{(__bridge id)kAXTrustedCheckOptionPrompt : @(prompt)};
return AXIsProcessTrustedWithOptions((CFDictionaryRef)options);
}

View file

@ -532,14 +532,10 @@ void Browser::ShowAboutPanel() {
// Credits must be a NSAttributedString instead of NSString
NSString* credits = (NSString*)options[@"Credits"];
if (credits != nil) {
base::scoped_nsobject<NSMutableDictionary> mutable_options(
[options mutableCopy]);
base::scoped_nsobject<NSAttributedString> creditString(
[[NSAttributedString alloc]
initWithString:credits
attributes:@{
NSForegroundColorAttributeName : [NSColor textColor]
}]);
NSMutableDictionary* mutable_options = [options mutableCopy];
NSAttributedString* creditString = [[NSAttributedString alloc]
initWithString:credits
attributes:@{NSForegroundColorAttributeName : [NSColor textColor]}];
[mutable_options setValue:creditString forKey:@"Credits"];
options = [NSDictionary dictionaryWithDictionary:mutable_options];

View file

@ -297,6 +297,10 @@ HidSystemTrayIcon* BrowserProcessImpl::hid_system_tray_icon() {
return nullptr;
}
UsbSystemTrayIcon* BrowserProcessImpl::usb_system_tray_icon() {
return nullptr;
}
void BrowserProcessImpl::SetSystemLocale(const std::string& locale) {
system_locale_ = locale;
}

View file

@ -107,6 +107,7 @@ class BrowserProcessImpl : public BrowserProcess {
resource_coordinator::TabManager* GetTabManager() override;
SerialPolicyAllowedPorts* serial_policy_allowed_ports() override;
HidSystemTrayIcon* hid_system_tray_icon() override;
UsbSystemTrayIcon* usb_system_tray_icon() override;
void CreateDevToolsProtocolHandler() override {}
void CreateDevToolsAutoOpener() override {}
void set_background_mode_manager_for_test(

View file

@ -17,13 +17,18 @@
#include "shell/common/electron_paths.h"
#include "ui/base/l10n/l10n_util_mac.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron {
static ElectronApplicationDelegate* __strong delegate_;
void ElectronBrowserMainParts::PreCreateMainMessageLoop() {
// Set our own application delegate.
ElectronApplicationDelegate* delegate =
[[ElectronApplicationDelegate alloc] init];
[NSApp setDelegate:delegate];
delegate_ = [[ElectronApplicationDelegate alloc] init];
[NSApp setDelegate:delegate_];
PreCreateMainMessageLoopCommon();
@ -40,7 +45,7 @@ void ElectronBrowserMainParts::PreCreateMainMessageLoop() {
}
void ElectronBrowserMainParts::FreeAppDelegate() {
[[NSApp delegate] release];
delegate_ = nil;
[NSApp setDelegate:nil];
}
@ -78,7 +83,6 @@ void ElectronBrowserMainParts::InitializeMainNib() {
}
[mainNib instantiateWithOwner:application topLevelObjects:nil];
[mainNib release];
}
std::string ElectronBrowserMainParts::GetCurrentSystemLocale() {

View file

@ -32,8 +32,7 @@ namespace extensions {
class ElectronGuestViewManagerDelegate
: public ExtensionsGuestViewManagerDelegate {
public:
explicit ElectronGuestViewManagerDelegate(content::BrowserContext* context)
: ExtensionsGuestViewManagerDelegate(context) {}
ElectronGuestViewManagerDelegate() : ExtensionsGuestViewManagerDelegate() {}
~ElectronGuestViewManagerDelegate() override = default;
// disable copy
@ -118,9 +117,8 @@ ElectronExtensionsAPIClient::CreateMimeHandlerViewGuestDelegate(
}
std::unique_ptr<guest_view::GuestViewManagerDelegate>
ElectronExtensionsAPIClient::CreateGuestViewManagerDelegate(
content::BrowserContext* context) const {
return std::make_unique<ElectronGuestViewManagerDelegate>(context);
ElectronExtensionsAPIClient::CreateGuestViewManagerDelegate() const {
return std::make_unique<ElectronGuestViewManagerDelegate>();
}
} // namespace extensions

View file

@ -27,8 +27,7 @@ class ElectronExtensionsAPIClient : public ExtensionsAPIClient {
MimeHandlerViewGuest* guest) const override;
ManagementAPIDelegate* CreateManagementAPIDelegate() const override;
std::unique_ptr<guest_view::GuestViewManagerDelegate>
CreateGuestViewManagerDelegate(
content::BrowserContext* context) const override;
CreateGuestViewManagerDelegate() const override;
private:
std::unique_ptr<ElectronMessagingDelegate> messaging_delegate_;

View file

@ -6,18 +6,21 @@
#define ELECTRON_SHELL_BROWSER_MAC_ELECTRON_APPLICATION_H_
#include "base/functional/callback.h"
#include "base/mac/scoped_nsobject.h"
#include "base/mac/scoped_sending_event.h"
#import <AVFoundation/AVFoundation.h>
#import <LocalAuthentication/LocalAuthentication.h>
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface AtomApplication : NSApplication <CrAppProtocol,
CrAppControlProtocol,
NSUserActivityDelegate> {
@private
BOOL handlingSendEvent_;
base::scoped_nsobject<NSUserActivity> currentActivity_;
NSUserActivity* __strong currentActivity_;
NSCondition* handoffLock_;
BOOL updateReceived_;
BOOL userStoppedShutdown_;

View file

@ -77,8 +77,7 @@ inline void dispatch_sync_main(dispatch_block_t block) {
- (void)setCurrentActivity:(NSString*)type
withUserInfo:(NSDictionary*)userInfo
withWebpageURL:(NSURL*)webpageURL {
currentActivity_ = base::scoped_nsobject<NSUserActivity>(
[[NSUserActivity alloc] initWithActivityType:type]);
currentActivity_ = [[NSUserActivity alloc] initWithActivityType:type];
[currentActivity_ setUserInfo:userInfo];
[currentActivity_ setWebpageURL:webpageURL];
[currentActivity_ setDelegate:self];
@ -87,13 +86,13 @@ inline void dispatch_sync_main(dispatch_block_t block) {
}
- (NSUserActivity*)getCurrentActivity {
return currentActivity_.get();
return currentActivity_;
}
- (void)invalidateCurrentActivity {
if (currentActivity_) {
[currentActivity_ invalidate];
currentActivity_.reset();
currentActivity_ = nil;
}
}

View file

@ -7,7 +7,6 @@
#import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
#include "shell/browser/native_browser_view.h"
namespace electron {

View file

@ -11,7 +11,6 @@
#include <string>
#include <vector>
#include "base/mac/scoped_nsobject.h"
#include "electron/shell/common/api/api.mojom.h"
#include "shell/browser/native_window.h"
#include "ui/display/display_observer.h"
@ -193,8 +192,8 @@ class NativeWindowMac : public NativeWindow,
kInactive,
};
ElectronPreviewItem* preview_item() const { return preview_item_.get(); }
ElectronTouchBar* touch_bar() const { return touch_bar_.get(); }
ElectronPreviewItem* preview_item() const { return preview_item_; }
ElectronTouchBar* touch_bar() const { return touch_bar_; }
bool zoom_to_page_width() const { return zoom_to_page_width_; }
bool always_simple_fullscreen() const { return always_simple_fullscreen_; }
@ -235,9 +234,9 @@ class NativeWindowMac : public NativeWindow,
ElectronNSWindow* window_; // Weak ref, managed by widget_.
base::scoped_nsobject<ElectronNSWindowDelegate> window_delegate_;
base::scoped_nsobject<ElectronPreviewItem> preview_item_;
base::scoped_nsobject<ElectronTouchBar> touch_bar_;
ElectronNSWindowDelegate* __strong window_delegate_;
ElectronPreviewItem* __strong preview_item_;
ElectronTouchBar* __strong touch_bar_;
// The views::View that fills the client area.
std::unique_ptr<RootViewMac> root_view_;
@ -266,7 +265,7 @@ class NativeWindowMac : public NativeWindow,
absl::optional<bool> window_button_visibility_;
// Controls the position and visibility of window buttons.
base::scoped_nsobject<WindowButtonsProxy> buttons_proxy_;
WindowButtonsProxy* __strong buttons_proxy_;
std::unique_ptr<SkRegion> draggable_region_;

View file

@ -306,13 +306,13 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
if (window->window_)
window->window_ = nil;
if (window->buttons_proxy_)
window->buttons_proxy_.reset();
window->buttons_proxy_ = nil;
},
this));
[window_ setEnableLargerThanScreen:enable_larger_than_screen()];
window_delegate_.reset([[ElectronNSWindowDelegate alloc] initWithShell:this]);
window_delegate_ = [[ElectronNSWindowDelegate alloc] initWithShell:this];
[window_ setDelegate:window_delegate_];
// Only use native parent window for non-modal windows.
@ -352,7 +352,7 @@ NativeWindowMac::NativeWindowMac(const gin_helper::Dictionary& options,
if (title_bar_style_ == TitleBarStyle::kNormal) {
InternalSetWindowButtonVisibility(false);
} else {
buttons_proxy_.reset([[WindowButtonsProxy alloc] initWithWindow:window_]);
buttons_proxy_ = [[WindowButtonsProxy alloc] initWithWindow:window_];
[buttons_proxy_ setHeight:titlebar_overlay_height()];
if (traffic_light_position_) {
[buttons_proxy_ setMargin:*traffic_light_position_];
@ -1555,10 +1555,9 @@ void NativeWindowMac::UpdateFrame() {
void NativeWindowMac::SetTouchBar(
std::vector<gin_helper::PersistentDictionary> items) {
touch_bar_.reset([[ElectronTouchBar alloc]
initWithDelegate:window_delegate_.get()
window:this
settings:std::move(items)]);
touch_bar_ = [[ElectronTouchBar alloc] initWithDelegate:window_delegate_
window:this
settings:std::move(items)];
[window_ setTouchBar:nil];
}
@ -1626,9 +1625,9 @@ void NativeWindowMac::SetAspectRatio(double aspect_ratio,
void NativeWindowMac::PreviewFile(const std::string& path,
const std::string& display_name) {
preview_item_.reset([[ElectronPreviewItem alloc]
preview_item_ = [[ElectronPreviewItem alloc]
initWithURL:[NSURL fileURLWithPath:base::SysUTF8ToNSString(path)]
title:base::SysUTF8ToNSString(display_name)]);
title:base::SysUTF8ToNSString(display_name)];
[[QLPreviewPanel sharedPreviewPanel] makeKeyAndOrderFront:nil];
}
@ -1799,7 +1798,7 @@ void NativeWindowMac::AddContentViewLayers() {
// There is no need to do so for frameless window, and doing so would make
// titleBarStyle stop working.
if (has_frame()) {
base::scoped_nsobject<CALayer> background_layer([[CALayer alloc] init]);
CALayer* background_layer = [[CALayer alloc] init];
[background_layer
setAutoresizingMask:kCALayerWidthSizable | kCALayerHeightSizable];
[[window_ contentView] setLayer:background_layer];

View file

@ -6,6 +6,10 @@
#include "base/apple/owned_objc.h"
#include "shell/browser/ui/cocoa/electron_inspectable_web_contents_view.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron {
DelayedNativeViewHost::DelayedNativeViewHost(gfx::NativeView native_view)

View file

@ -8,11 +8,14 @@
#import <AppKit/AppKit.h>
#include "base/apple/owned_objc.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/raw_ptr.h"
#include "chrome/browser/devtools/devtools_contents_resizing_strategy.h"
#include "ui/base/cocoa/base_view.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron {
class InspectableWebContentsViewMac;
}
@ -27,8 +30,8 @@ using electron::InspectableWebContentsViewMac;
@private
raw_ptr<electron::InspectableWebContentsViewMac> inspectableWebContentsView_;
base::scoped_nsobject<NSView> fake_view_;
base::scoped_nsobject<NSWindow> devtools_window_;
NSView* __strong fake_view_;
NSWindow* __strong devtools_window_;
BOOL devtools_visible_;
BOOL devtools_docked_;
BOOL devtools_is_first_responder_;

View file

@ -13,6 +13,10 @@
#include "ui/base/cocoa/base_view.h"
#include "ui/gfx/mac/scoped_cocoa_disable_screen_updates.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@implementation ElectronInspectableWebContentsView
- (instancetype)initWithInspectableWebContentsViewMac:
@ -28,7 +32,7 @@
attached_to_window_ = NO;
if (inspectableWebContentsView_->inspectable_web_contents()->IsGuest()) {
fake_view_.reset([[NSView alloc] init]);
fake_view_ = [[NSView alloc] init];
[fake_view_ setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[self addSubview:fake_view_];
} else {
@ -47,7 +51,6 @@
- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
- (void)resizeSubviewsWithOldSize:(NSSize)oldBoundsSize {
@ -126,7 +129,7 @@
} else {
[devtools_window_ setDelegate:nil];
[devtools_window_ close];
devtools_window_.reset();
devtools_window_ = nil;
}
}
}
@ -160,11 +163,11 @@
NSWindowStyleMaskResizable |
NSWindowStyleMaskTexturedBackground |
NSWindowStyleMaskUnifiedTitleAndToolbar;
devtools_window_.reset([[EventDispatchingWindow alloc]
devtools_window_ = [[EventDispatchingWindow alloc]
initWithContentRect:NSMakeRect(0, 0, 800, 600)
styleMask:styleMask
backing:NSBackingStoreBuffered
defer:YES]);
defer:YES];
[devtools_window_ setDelegate:self];
[devtools_window_ setFrameAutosaveName:@"electron.devtools"];
[devtools_window_ setTitle:@"Developer Tools"];

View file

@ -9,9 +9,12 @@
#import <Cocoa/Cocoa.h>
#include "base/functional/callback.h"
#include "base/mac/scoped_nsobject.h"
#include "base/memory/weak_ptr.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron {
class ElectronMenuModel;
}
@ -26,7 +29,9 @@ class ElectronMenuModel;
: NSObject <NSMenuDelegate, NSSharingServiceDelegate> {
@protected
base::WeakPtr<electron::ElectronMenuModel> model_;
base::scoped_nsobject<NSMenu> menu_;
NSMenu* __strong menu_;
NSMenuItem* __strong recentDocumentsMenuItem_;
NSMenu* __strong recentDocumentsMenuSwap_;
BOOL isMenuOpen_;
BOOL useDefaultAccelerator_;
base::OnceClosure closeCallback;
@ -52,9 +57,8 @@ class ElectronMenuModel;
// default initializer was used, then this will create the menu on first call.
- (NSMenu*)menu;
- (base::scoped_nsobject<NSMenuItem>)
makeMenuItemForIndex:(NSInteger)index
fromModel:(electron::ElectronMenuModel*)model;
- (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index
fromModel:(electron::ElectronMenuModel*)model;
// Whether the menu is currently open.
- (BOOL)isMenuOpen;

View file

@ -86,13 +86,13 @@ bool MenuHasVisibleItems(const electron::ElectronMenuModel* model) {
// Called when an empty submenu is created. This inserts a menu item labeled
// "(empty)" into the submenu. Matches Windows behavior.
NSMenu* MakeEmptySubmenu() {
base::scoped_nsobject<NSMenu> submenu([[NSMenu alloc] initWithTitle:@""]);
NSMenu* submenu = [[NSMenu alloc] initWithTitle:@""];
NSString* empty_menu_title =
l10n_util::GetNSString(IDS_APP_MENU_EMPTY_SUBMENU);
[submenu addItemWithTitle:empty_menu_title action:NULL keyEquivalent:@""];
[[submenu itemAtIndex:0] setEnabled:NO];
return submenu.autorelease();
return submenu;
}
// Convert an SharingItem to an array of NSObjects.
@ -130,8 +130,7 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
}
+ (instancetype)weakPtrForModel:(electron::ElectronMenuModel*)model {
return [[[WeakPtrToElectronMenuModelAsNSObject alloc] initWithModel:model]
autorelease];
return [[WeakPtrToElectronMenuModelAsNSObject alloc] initWithModel:model];
}
+ (electron::ElectronMenuModel*)getFrom:(id)instance {
@ -153,12 +152,6 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
@end
// Menu item is located for ease of removing it from the parent owner
static base::scoped_nsobject<NSMenuItem> recentDocumentsMenuItem_;
// Submenu retained to be swapped back to |recentDocumentsMenuItem_|
static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
@implementation ElectronMenuController
- (electron::ElectronMenuModel*)model {
@ -188,7 +181,6 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
[self cancel];
model_ = nullptr;
[super dealloc];
}
- (void)setCloseCallback:(base::OnceClosure)callback {
@ -204,8 +196,8 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
std::u16string title = u"Open Recent";
NSString* openTitle = l10n_util::FixUpWindowsStyleLabel(title);
recentDocumentsMenuItem_.reset([[[[[NSApp mainMenu]
itemWithTitle:@"Electron"] submenu] itemWithTitle:openTitle] retain]);
recentDocumentsMenuItem_ = [[[[NSApp mainMenu] itemWithTitle:@"Electron"]
submenu] itemWithTitle:openTitle];
}
model_ = model->GetWeakPtr();
@ -236,7 +228,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// Creates a NSMenu from the given model. If the model has submenus, this can
// be invoked recursively.
- (NSMenu*)menuFromModel:(electron::ElectronMenuModel*)model {
NSMenu* menu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
NSMenu* menu = [[NSMenu alloc] initWithTitle:@""];
const int count = model->GetItemCount();
for (int index = 0; index < count; index++) {
@ -261,7 +253,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
- (void)moveMenuItems:(NSMenu*)source to:(NSMenu*)destination {
const NSInteger count = [source numberOfItems];
for (NSInteger index = 0; index < count; index++) {
NSMenuItem* removedItem = [[[source itemAtIndex:0] retain] autorelease];
NSMenuItem* removedItem = [source itemAtIndex:0];
[source removeItemAtIndex:0];
[destination addItem:removedItem];
}
@ -270,8 +262,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
// Replaces the item's submenu instance with the singleton recent documents
// menu. Previously replaced menu items will be recovered.
- (void)replaceSubmenuShowingRecentDocuments:(NSMenuItem*)item {
NSMenu* recentDocumentsMenu =
[[[recentDocumentsMenuItem_ submenu] retain] autorelease];
NSMenu* recentDocumentsMenu = [recentDocumentsMenuItem_ submenu];
// Remove menu items in recent documents back to swap menu
[self moveMenuItems:recentDocumentsMenu to:recentDocumentsMenuSwap_];
@ -279,7 +270,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
[recentDocumentsMenuItem_ setSubmenu:recentDocumentsMenuSwap_];
// Retain the item's submenu for a future recovery
recentDocumentsMenuSwap_.reset([[item submenu] retain]);
recentDocumentsMenuSwap_ = [item submenu];
// Repopulate with items from the submenu to be replaced
[self moveMenuItems:recentDocumentsMenuSwap_ to:recentDocumentsMenu];
@ -292,7 +283,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
DCHECK_EQ([item target], recentDocumentsMenu);
// Remember the new menu item that carries the recent documents menu
recentDocumentsMenuItem_.reset([item retain]);
recentDocumentsMenuItem_ = item;
}
// Fill the menu with Share Menu items.
@ -300,36 +291,33 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
NSArray* items = ConvertSharingItemToNS(item);
if ([items count] == 0)
return MakeEmptySubmenu();
base::scoped_nsobject<NSMenu> menu([[NSMenu alloc] init]);
NSMenu* menu = [[NSMenu alloc] init];
NSArray* services = [NSSharingService sharingServicesForItems:items];
for (NSSharingService* service in services)
[menu addItem:[self menuItemForService:service withItems:items]];
return menu.autorelease();
return menu;
}
// Creates a menu item that calls |service| when invoked.
- (NSMenuItem*)menuItemForService:(NSSharingService*)service
withItems:(NSArray*)items {
base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
initWithTitle:service.menuItemTitle
action:@selector(performShare:)
keyEquivalent:@""]);
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:service.menuItemTitle
action:@selector(performShare:)
keyEquivalent:@""];
[item setTarget:self];
[item setImage:service.image];
[item setRepresentedObject:@{@"service" : service, @"items" : items}];
return item.autorelease();
return item;
}
- (base::scoped_nsobject<NSMenuItem>)
makeMenuItemForIndex:(NSInteger)index
fromModel:(electron::ElectronMenuModel*)model {
- (NSMenuItem*)makeMenuItemForIndex:(NSInteger)index
fromModel:(electron::ElectronMenuModel*)model {
std::u16string label16 = model->GetLabelAt(index);
NSString* label = l10n_util::FixUpWindowsStyleLabel(label16);
base::scoped_nsobject<NSMenuItem> item([[NSMenuItem alloc]
initWithTitle:label
action:@selector(itemSelected:)
keyEquivalent:@""]);
NSMenuItem* item = [[NSMenuItem alloc] initWithTitle:label
action:@selector(itemSelected:)
keyEquivalent:@""];
// If the menu item has an icon, set it.
ui::ImageModel icon = model->GetIconAt(index);
@ -348,7 +336,7 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
[item setTarget:nil];
[item setAction:nil];
NSMenu* submenu = [[[NSMenu alloc] initWithTitle:sub_label] autorelease];
NSMenu* submenu = [[NSMenu alloc] initWithTitle:sub_label];
[item setSubmenu:submenu];
[NSApp setServicesMenu:submenu];
} else if (role == u"sharemenu") {
@ -504,18 +492,18 @@ static base::scoped_nsobject<NSMenu> recentDocumentsMenuSwap_;
- (NSMenu*)menu {
if (menu_)
return menu_.get();
return menu_;
if (model_ && model_->GetSharingItem()) {
NSMenu* menu = [self createShareMenuForItem:*model_->GetSharingItem()];
menu_.reset([menu retain]);
menu_ = menu;
} else {
menu_.reset([[NSMenu alloc] initWithTitle:@""]);
menu_ = [[NSMenu alloc] initWithTitle:@""];
if (model_)
[self populateWithModel:model_.get()];
}
[menu_ setDelegate:self];
return menu_.get();
return menu_;
}
- (BOOL)isMenuOpen {

View file

@ -14,6 +14,10 @@
#import <objc/message.h>
#import <objc/runtime.h>
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron {
int ScopedDisableResize::disable_resize_ = 0;
@ -248,7 +252,7 @@ void SwizzleSwipeWithEvent(NSView* view, SEL swiz_selector) {
@"NSAccessibilityReparentingCellProxy"];
NSArray* children = [super accessibilityAttributeValue:attribute];
NSMutableArray* mutableChildren = [[children mutableCopy] autorelease];
NSMutableArray* mutableChildren = [children mutableCopy];
[mutableChildren filterUsingPredicate:predicate];
return mutableChildren;

View file

@ -11,11 +11,14 @@
#include <string>
#include <vector>
#include "base/mac/scoped_nsobject.h"
#include "base/memory/raw_ptr.h"
#include "shell/browser/native_window.h"
#include "shell/common/gin_helper/persistent_dictionary.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
@interface ElectronTouchBar : NSObject <NSScrubberDelegate,
NSScrubberDataSource,
NSScrubberFlowLayoutDelegate> {

View file

@ -55,10 +55,10 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
}
- (NSTouchBar*)touchBarFromItemIdentifiers:(NSMutableArray*)items {
base::scoped_nsobject<NSTouchBar> bar([[NSTouchBar alloc] init]);
NSTouchBar* bar = [[NSTouchBar alloc] init];
[bar setDelegate:delegate_];
[bar setDefaultItemIdentifiers:items];
return bar.autorelease();
return bar;
}
- (NSMutableArray*)identifiersFromSettings:
@ -349,15 +349,15 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
v8::HandleScope handle_scope(isolate);
gin_helper::PersistentDictionary settings = settings_[s_id];
base::scoped_nsobject<NSCustomTouchBarItem> item(
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
NSCustomTouchBarItem* item =
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
NSButton* button = [NSButton buttonWithTitle:@""
target:self
action:@selector(buttonAction:)];
button.tag = [id floatValue];
[item setView:button];
[self updateButton:item withSettings:settings];
return item.autorelease();
return item;
}
- (void)updateButton:(NSCustomTouchBarItem*)item
@ -410,11 +410,11 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
v8::HandleScope handle_scope(isolate);
gin_helper::PersistentDictionary settings = settings_[s_id];
base::scoped_nsobject<NSCustomTouchBarItem> item(
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
NSCustomTouchBarItem* item =
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
[item setView:[NSTextField labelWithString:@""]];
[self updateLabel:item withSettings:settings];
return item.autorelease();
return item;
}
- (void)updateLabel:(NSCustomTouchBarItem*)item
@ -447,20 +447,19 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
v8::HandleScope scope(isolate);
gin_helper::PersistentDictionary settings = settings_[s_id];
base::scoped_nsobject<NSColorPickerTouchBarItem> item(
[[NSColorPickerTouchBarItem alloc] initWithIdentifier:identifier]);
NSColorPickerTouchBarItem* item =
[[NSColorPickerTouchBarItem alloc] initWithIdentifier:identifier];
[item setTarget:self];
[item setAction:@selector(colorPickerAction:)];
[self updateColorPicker:item withSettings:settings];
return item.autorelease();
return item;
}
- (void)updateColorPicker:(NSColorPickerTouchBarItem*)item
withSettings:(const gin_helper::PersistentDictionary&)settings {
std::vector<std::string> colors;
if (settings.Get("availableColors", &colors) && !colors.empty()) {
NSColorList* color_list =
[[[NSColorList alloc] initWithName:@""] autorelease];
NSColorList* color_list = [[NSColorList alloc] initWithName:@""];
for (size_t i = 0; i < colors.size(); ++i) {
[color_list insertColor:[self colorFromHexColorString:colors[i]]
key:base::SysUTF8ToNSString(colors[i])
@ -485,12 +484,12 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
v8::HandleScope handle_scope(isolate);
gin_helper::PersistentDictionary settings = settings_[s_id];
base::scoped_nsobject<NSSliderTouchBarItem> item(
[[NSSliderTouchBarItem alloc] initWithIdentifier:identifier]);
NSSliderTouchBarItem* item =
[[NSSliderTouchBarItem alloc] initWithIdentifier:identifier];
[item setTarget:self];
[item setAction:@selector(sliderAction:)];
[self updateSlider:item withSettings:settings];
return item.autorelease();
return item;
}
- (void)updateSlider:(NSSliderTouchBarItem*)item
@ -521,10 +520,10 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
v8::HandleScope handle_scope(isolate);
gin_helper::PersistentDictionary settings = settings_[s_id];
base::scoped_nsobject<NSPopoverTouchBarItem> item(
[[NSPopoverTouchBarItem alloc] initWithIdentifier:identifier]);
NSPopoverTouchBarItem* item =
[[NSPopoverTouchBarItem alloc] initWithIdentifier:identifier];
[self updatePopover:item withSettings:settings];
return item.autorelease();
return item;
}
- (void)updatePopover:(NSPopoverTouchBarItem*)item
@ -613,8 +612,8 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
v8::HandleScope handle_scope(isolate);
gin_helper::PersistentDictionary settings = settings_[s_id];
base::scoped_nsobject<NSCustomTouchBarItem> item(
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
NSCustomTouchBarItem* item =
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
NSSegmentedControl* control = [NSSegmentedControl
segmentedControlWithLabels:[NSMutableArray array]
@ -625,7 +624,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
[item setView:control];
[self updateSegmentedControl:item withSettings:settings];
return item.autorelease();
return item;
}
- (void)updateSegmentedControl:(NSCustomTouchBarItem*)item
@ -700,11 +699,10 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
v8::HandleScope handle_scope(isolate);
gin_helper::PersistentDictionary settings = settings_[s_id];
base::scoped_nsobject<NSCustomTouchBarItem> item(
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier]);
NSCustomTouchBarItem* item =
[[NSCustomTouchBarItem alloc] initWithIdentifier:identifier];
NSScrubber* scrubber =
[[[NSScrubber alloc] initWithFrame:NSZeroRect] autorelease];
NSScrubber* scrubber = [[NSScrubber alloc] initWithFrame:NSZeroRect];
[scrubber registerClass:[NSScrubberTextItemView class]
forItemIdentifier:TextScrubberItemIdentifier];
@ -718,7 +716,7 @@ static NSString* const ImageScrubberItemIdentifier = @"scrubber.image.item";
[item setView:scrubber];
[self updateScrubber:item withSettings:settings];
return item.autorelease();
return item;
}
- (void)updateScrubber:(NSCustomTouchBarItem*)item

View file

@ -7,7 +7,6 @@
#import <Cocoa/Cocoa.h>
#include "base/mac/scoped_nsobject.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "ui/gfx/geometry/point.h"
@ -36,8 +35,8 @@
// Track mouse moves above window buttons.
BOOL show_on_hover_;
BOOL mouse_inside_;
base::scoped_nsobject<NSTrackingArea> tracking_area_;
base::scoped_nsobject<ButtonsAreaHoverView> hover_view_;
NSTrackingArea* __strong tracking_area_;
ButtonsAreaHoverView* __strong hover_view_;
}
- (id)initWithWindow:(NSWindow*)window;

View file

@ -70,12 +70,12 @@
// Put a transparent view above the window buttons so we can track mouse
// events when mouse enter/leave the window buttons.
if (show_on_hover_) {
hover_view_.reset([[ButtonsAreaHoverView alloc] initWithProxy:self]);
hover_view_ = [[ButtonsAreaHoverView alloc] initWithProxy:self];
[hover_view_ setFrame:[self getButtonsBounds]];
[titleBarContainer addSubview:hover_view_.get()];
[titleBarContainer addSubview:hover_view_];
} else {
[hover_view_ removeFromSuperview];
hover_view_.reset();
hover_view_ = nil;
}
[self updateButtonsVisibility];
}
@ -143,14 +143,14 @@
- (void)updateTrackingAreas {
if (tracking_area_)
[hover_view_ removeTrackingArea:tracking_area_.get()];
tracking_area_.reset([[NSTrackingArea alloc]
[hover_view_ removeTrackingArea:tracking_area_];
tracking_area_ = [[NSTrackingArea alloc]
initWithRect:NSZeroRect
options:NSTrackingMouseEnteredAndExited | NSTrackingActiveAlways |
NSTrackingInVisibleRect
owner:self
userInfo:nil]);
[hover_view_ addTrackingArea:tracking_area_.get()];
userInfo:nil];
[hover_view_ addTrackingArea:tracking_area_];
}
- (void)mouseEntered:(NSEvent*)event {

View file

@ -8,10 +8,12 @@
#include "shell/browser/ui/inspectable_web_contents_view.h"
#include "base/mac/scoped_nsobject.h"
@class ElectronInspectableWebContentsView;
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron {
class InspectableWebContentsViewMac : public InspectableWebContentsView {
@ -34,7 +36,7 @@ class InspectableWebContentsViewMac : public InspectableWebContentsView {
void SetTitle(const std::u16string& title) override;
private:
base::scoped_nsobject<ElectronInspectableWebContentsView> view_;
ElectronInspectableWebContentsView* __strong view_;
};
} // namespace electron

View file

@ -28,7 +28,7 @@ InspectableWebContentsViewMac::~InspectableWebContentsViewMac() {
}
gfx::NativeView InspectableWebContentsViewMac::GetNativeView() const {
return view_.get();
return view_;
}
void InspectableWebContentsViewMac::ShowDevTools(bool activate) {

View file

@ -9,12 +9,15 @@
#include <string>
#include "base/mac/scoped_nsobject.h"
#include "shell/browser/ui/tray_icon.h"
@class ElectronMenuController;
@class StatusItemView;
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace electron {
class TrayIconCocoa : public TrayIcon {
@ -38,10 +41,10 @@ class TrayIconCocoa : public TrayIcon {
private:
// Electron custom view for NSStatusItem.
base::scoped_nsobject<StatusItemView> status_item_view_;
StatusItemView* __strong status_item_view_;
// Status menu shown when right-clicking the system icon.
base::scoped_nsobject<ElectronMenuController> menu_;
ElectronMenuController* __strong menu_;
base::WeakPtrFactory<TrayIconCocoa> weak_factory_{this};
};

View file

@ -23,8 +23,8 @@
raw_ptr<electron::TrayIconCocoa> trayIcon_; // weak
ElectronMenuController* menuController_; // weak
BOOL ignoreDoubleClickEvents_;
base::scoped_nsobject<NSStatusItem> statusItem_;
base::scoped_nsobject<NSTrackingArea> trackingArea_;
NSStatusItem* __strong statusItem_;
NSTrackingArea* __strong trackingArea_;
}
@end // @interface StatusItemView
@ -34,7 +34,6 @@
- (void)dealloc {
trayIcon_ = nil;
menuController_ = nil;
[super dealloc];
}
- (id)initWithIcon:(electron::TrayIconCocoa*)icon {
@ -54,7 +53,7 @@
// Create the status item.
NSStatusItem* item = [[NSStatusBar systemStatusBar]
statusItemWithLength:NSVariableStatusItemLength];
statusItem_.reset([item retain]);
statusItem_ = item;
[[statusItem_ button] addSubview:self]; // inject custom view
[self updateDimensions];
}
@ -69,12 +68,12 @@
// Use NSTrackingArea for listening to mouseEnter, mouseExit, and mouseMove
// events.
[self removeTrackingArea:trackingArea_];
trackingArea_.reset([[NSTrackingArea alloc]
trackingArea_ = [[NSTrackingArea alloc]
initWithRect:[self bounds]
options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |
NSTrackingActiveAlways
owner:self
userInfo:nil]);
userInfo:nil];
[self addTrackingArea:trackingArea_];
}
@ -82,11 +81,11 @@
// Turn off tracking events to prevent crash.
if (trackingArea_) {
[self removeTrackingArea:trackingArea_];
trackingArea_.reset();
trackingArea_ = nil;
}
[[NSStatusBar systemStatusBar] removeStatusItem:statusItem_];
[self removeFromSuperview];
statusItem_.reset();
statusItem_ = nil;
}
- (void)setImage:(NSImage*)image {
@ -216,21 +215,13 @@
// Show a custom menu.
if (menu_model) {
base::scoped_nsobject<ElectronMenuController> menuController(
ElectronMenuController* menuController =
[[ElectronMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
useDefaultAccelerator:NO];
// Hacky way to mimic design of ordinary tray menu.
[statusItem_ setMenu:[menuController menu]];
// -performClick: is a blocking call, which will run the task loop inside
// itself. This can potentially include running JS, which can result in
// this object being released. We take a temporary reference here to make
// sure we stay alive long enough to successfully return from this
// function.
// TODO(nornagon/codebytere): Avoid nesting task loops here.
[self retain];
[[statusItem_ button] performClick:self];
[statusItem_ setMenu:[menuController_ menu]];
[self release];
return;
}
@ -326,7 +317,7 @@
namespace electron {
TrayIconCocoa::TrayIconCocoa() {
status_item_view_.reset([[StatusItemView alloc] initWithIcon:this]);
status_item_view_ = [[StatusItemView alloc] initWithIcon:this];
}
TrayIconCocoa::~TrayIconCocoa() {
@ -382,12 +373,12 @@ void TrayIconCocoa::CloseContextMenu() {
void TrayIconCocoa::SetContextMenu(raw_ptr<ElectronMenuModel> menu_model) {
if (menu_model) {
// Create native menu.
menu_.reset([[ElectronMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO]);
menu_ = [[ElectronMenuController alloc] initWithModel:menu_model
useDefaultAccelerator:NO];
} else {
menu_.reset();
menu_ = nil;
}
[status_item_view_ setMenuController:menu_.get()];
[status_item_view_ setMenuController:menu_];
}
gfx::Rect TrayIconCocoa::GetBounds() {

View file

@ -45,8 +45,11 @@ bool ShouldUseGlobalMenuBar() {
dbus::ObjectProxy* object_proxy =
bus->GetObjectProxy(DBUS_SERVICE_DBUS, dbus::ObjectPath(DBUS_PATH_DBUS));
dbus::MethodCall method_call(DBUS_INTERFACE_DBUS, "ListNames");
std::unique_ptr<dbus::Response> response(object_proxy->CallMethodAndBlock(
&method_call, dbus::ObjectProxy::TIMEOUT_USE_DEFAULT));
std::unique_ptr<dbus::Response> response =
object_proxy
->CallMethodAndBlock(&method_call,
dbus::ObjectProxy::TIMEOUT_USE_DEFAULT)
.value_or(nullptr);
if (!response) {
bus->ShutdownAndBlock();
return false;

View file

@ -73,6 +73,14 @@ class ElectronUsbDelegate : public content::UsbDelegate {
Observer* observer) override;
void RemoveObserver(content::BrowserContext* browser_context,
Observer* observer) override;
// TODO: See if we can separate these from Profiles upstream.
void IncrementConnectionCount(content::BrowserContext* browser_context,
const url::Origin& origin) override {}
void DecrementConnectionCount(content::BrowserContext* browser_context,
const url::Origin& origin) override {}
bool IsServiceWorkerAllowedForOrigin(const url::Origin& origin) override;
void DeleteControllerForFrame(content::RenderFrameHost* render_frame_host);