Compare commits

..

15 Commits

Author SHA1 Message Date
Sudowoodo Release Bot
31e877515c Bump v17.0.0-nightly.20211103 2021-11-03 06:05:31 -07:00
Milan Burda
65a980c673 refactor: replace deprecated DISALLOW_COPY_AND_ASSIGN (#31633) 2021-11-03 20:41:45 +09:00
Sudowoodo Release Bot
2a2a1a834c Bump v17.0.0-nightly.20211102 2021-11-02 06:04:29 -07:00
Cheng Zhao
c4d35cd18c fix: do not run dialog callback inside transaction commit (#31606) 2021-11-01 17:08:31 -04:00
electron-roller[bot]
1e618ef06c chore: bump node to v16.13.0 (main) (#31607)
* chore: bump node in DEPS to v16.13.0

* chore: update patches

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2021-11-01 16:58:35 -04:00
John Kleinschmidt
c40a292099 test: fix test-datetime-change-notify after daylight change (#31654) 2021-11-01 16:31:12 -04:00
John Kleinschmidt
5899a72df9 fix: clipboard.read() to recognize custom types (#31623) 2021-11-01 10:00:36 -04:00
John Kleinschmidt
a938af3f54 fix: use disable-hid-blocklist to allow FIDO (#31626) 2021-11-01 10:00:07 -04:00
Sudowoodo Release Bot
97a109991e Bump v17.0.0-nightly.20211101 2021-11-01 06:04:57 -07:00
Shelley Vohr
20b4813cf8 fix: crash on close window when webContents destroyed (#31620) 2021-11-01 13:32:54 +09:00
Sudowoodo Release Bot
a6e5ff3607 Bump v17.0.0-nightly.20211029 2021-10-29 06:02:06 -07:00
Shelley Vohr
639f4428a5 fix: navigator.keyboard.lock() not working (#31572)
* fix: navigator.keyboard.lock() not working

* chore: address review feedback
2021-10-28 10:23:05 -04:00
Sudowoodo Release Bot
120cff38c5 Bump v17.0.0-nightly.20211028 2021-10-28 06:01:45 -07:00
Erick Zhao
ec34c6c6e7 docs: update test automation doc (#31506)
* Update WebdriverIO documentation

* Update docs/tutorial/using-selenium-and-webdriver.md

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

* Update docs/tutorial/using-selenium-and-webdriver.md

Co-authored-by: Jeremy Rose <nornagon@nornagon.net>

* docs: update automated testing docs

* lint

* update

* Update docs/tutorial/automated-testing.md

Co-authored-by: Christian Bromann <github@christian-bromann.com>

* fixes

Co-authored-by: Christian Bromann <github@christian-bromann.com>
Co-authored-by: Jeremy Rose <nornagon@nornagon.net>
2021-10-28 11:17:43 +09:00
Robo
3bf42593ba fix: use shorter paths for creating singleton sockets (#31608) 2021-10-27 12:25:08 -07:00
257 changed files with 1497 additions and 988 deletions

2
DEPS
View File

@@ -17,7 +17,7 @@ vars = {
'chromium_version':
'96.0.4664.4',
'node_version':
'v16.12.0',
'v16.13.0',
'nan_version':
# The following commit hash of NAN is v2.14.2 with *only* changes to the
# test suite. This should be updated to a specific tag when one becomes

View File

@@ -1 +1 @@
17.0.0-nightly.20211027
17.0.0-nightly.20211103

View File

@@ -15,6 +15,8 @@ static_library("chrome") {
sources = [
"//chrome/browser/accessibility/accessibility_ui.cc",
"//chrome/browser/accessibility/accessibility_ui.h",
"//chrome/browser/app_mode/app_mode_utils.cc",
"//chrome/browser/app_mode/app_mode_utils.h",
"//chrome/browser/browser_process.cc",
"//chrome/browser/browser_process.h",
"//chrome/browser/devtools/devtools_contents_resizing_strategy.cc",
@@ -51,6 +53,20 @@ static_library("chrome") {
"//chrome/browser/process_singleton.h",
"//chrome/browser/ui/browser_dialogs.cc",
"//chrome/browser/ui/browser_dialogs.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_bubble_type.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_controller_base.h",
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.cc",
"//chrome/browser/ui/exclusive_access/exclusive_access_manager.h",
"//chrome/browser/ui/exclusive_access/fullscreen_controller.cc",
"//chrome/browser/ui/exclusive_access/fullscreen_controller.h",
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.cc",
"//chrome/browser/ui/exclusive_access/fullscreen_within_tab_helper.h",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/keyboard_lock_controller.h",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.cc",
"//chrome/browser/ui/exclusive_access/mouse_lock_controller.h",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.cc",
"//chrome/browser/ui/views/autofill/autofill_popup_view_utils.h",
"//chrome/browser/ui/views/eye_dropper/eye_dropper.cc",
@@ -114,6 +130,7 @@ static_library("chrome") {
"//components/keyed_service/content",
"//components/paint_preview/buildflags",
"//components/proxy_config",
"//components/services/language_detection/public/mojom",
"//content/public/browser",
"//services/strings",
]

View File

@@ -9,7 +9,6 @@
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "net/cert/nss_cert_database.h"
@@ -31,6 +30,10 @@ class CertificateManagerModel {
static void Create(content::BrowserContext* browser_context,
CreationCallback callback);
// disable copy
CertificateManagerModel(const CertificateManagerModel&) = delete;
CertificateManagerModel& operator=(const CertificateManagerModel&) = delete;
~CertificateManagerModel();
bool is_user_db_available() const { return is_user_db_available_; }
@@ -108,8 +111,6 @@ class CertificateManagerModel {
// Whether the certificate database has a public slot associated with the
// profile. If not set, importing certificates is not allowed with this model.
bool is_user_db_available_;
DISALLOW_COPY_AND_ASSIGN(CertificateManagerModel);
};
#endif // CHROME_BROWSER_CERTIFICATE_MANAGER_MODEL_H_

View File

@@ -59,10 +59,9 @@ an issue:
* [Testing and Debugging](tutorial/application-debugging.md)
* [Debugging the Main Process](tutorial/debugging-main-process.md)
* [Debugging with Visual Studio Code](tutorial/debugging-vscode.md)
* [Using Selenium and WebDriver](tutorial/using-selenium-and-webdriver.md)
* [Testing on Headless CI Systems (Travis, Jenkins)](tutorial/testing-on-headless-ci.md)
* [DevTools Extension](tutorial/devtools-extension.md)
* [Automated Testing with a Custom Driver](tutorial/automated-testing-with-a-custom-driver.md)
* [Automated Testing](tutorial/automated-testing.md)
* [REPL](tutorial/repl.md)
* [Distribution](tutorial/application-distribution.md)
* [Supported Platforms](tutorial/support.md#supported-platforms)

View File

@@ -197,7 +197,7 @@ Returns `Boolean` - Whether the clipboard supports the specified `format`.
```js
const { clipboard } = require('electron')
const hasFormat = clipboard.has('<p>selection</p>')
const hasFormat = clipboard.has('public/utf8-plain-text')
console.log(hasFormat)
// 'true' or 'false'
```

View File

@@ -1,48 +1,7 @@
# Accessibility
Making accessible applications is important and we're happy to provide
functionality to [Devtron][devtron] and [Spectron][spectron] that gives
developers the opportunity to make their apps better for everyone.
---
Accessibility concerns in Electron applications are similar to those of
websites because they're both ultimately HTML. With Electron apps, however,
you can't use the online resources for accessibility audits because your app
doesn't have a URL to point the auditor to.
These features bring those auditing tools to your Electron app. You can
choose to add audits to your tests with Spectron or use them within DevTools
with Devtron. Read on for a summary of the tools.
## Spectron
In the testing framework Spectron, you can now audit each window and `<webview>`
tag in your application. For example:
```javascript
app.client.auditAccessibility().then((audit) => {
if (audit.failed) {
console.error(audit.message)
}
})
```
You can read more about this feature in [Spectron's documentation][spectron-a11y].
## Devtron
In Devtron, there is an accessibility tab which will allow you to audit a
page in your app, sort and filter the results.
![devtron screenshot][devtron-screenshot]
Both of these tools are using the [Accessibility Developer Tools][a11y-devtools]
library built by Google for Chrome. You can learn more about the accessibility
audit rules this library uses on that [repository's wiki][a11y-devtools-wiki].
If you know of other great accessibility tools for Electron, add them to the
accessibility documentation with a pull request.
websites because they're both ultimately HTML.
## Manually enabling accessibility features
@@ -84,10 +43,6 @@ CFStringRef kAXManualAccessibility = CFSTR("AXManualAccessibility");
}
```
[devtron]: https://electronjs.org/devtron
[devtron-screenshot]: https://cloud.githubusercontent.com/assets/1305617/17156618/9f9bcd72-533f-11e6-880d-389115f40a2a.png
[spectron]: https://electronjs.org/spectron
[spectron-a11y]: https://github.com/electron/spectron#accessibility-testing
[a11y-docs]: https://www.chromium.org/developers/design-documents/accessibility#TOC-How-Chrome-detects-the-presence-of-Assistive-Technology
[a11y-devtools]: https://github.com/GoogleChrome/accessibility-developer-tools
[a11y-devtools-wiki]: https://github.com/GoogleChrome/accessibility-developer-tools/wiki/Audit-Rules

View File

@@ -1,135 +0,0 @@
# Automated Testing with a Custom Driver
To write automated tests for your Electron app, you will need a way to "drive" your application. [Spectron](https://electronjs.org/spectron) is a commonly-used solution which lets you emulate user actions via [WebDriver](https://webdriver.io/). However, it's also possible to write your own custom driver using node's builtin IPC-over-STDIO. The benefit of a custom driver is that it tends to require less overhead than Spectron, and lets you expose custom methods to your test suite.
To create a custom driver, we'll use Node.js' [child_process](https://nodejs.org/api/child_process.html) API. The test suite will spawn the Electron process, then establish a simple messaging protocol:
```js
const childProcess = require('child_process')
const electronPath = require('electron')
// spawn the process
const env = { /* ... */ }
const stdio = ['inherit', 'inherit', 'inherit', 'ipc']
const appProcess = childProcess.spawn(electronPath, ['./app'], { stdio, env })
// listen for IPC messages from the app
appProcess.on('message', (msg) => {
// ...
})
// send an IPC message to the app
appProcess.send({ my: 'message' })
```
From within the Electron app, you can listen for messages and send replies using the Node.js [process](https://nodejs.org/api/process.html) API:
```js
// listen for IPC messages from the test suite
process.on('message', (msg) => {
// ...
})
// send an IPC message to the test suite
process.send({ my: 'message' })
```
We can now communicate from the test suite to the Electron app using the `appProcess` object.
For convenience, you may want to wrap `appProcess` in a driver object that provides more high-level functions. Here is an example of how you can do this:
```js
class TestDriver {
constructor ({ path, args, env }) {
this.rpcCalls = []
// start child process
env.APP_TEST_DRIVER = 1 // let the app know it should listen for messages
this.process = childProcess.spawn(path, args, { stdio: ['inherit', 'inherit', 'inherit', 'ipc'], env })
// handle rpc responses
this.process.on('message', (message) => {
// pop the handler
const rpcCall = this.rpcCalls[message.msgId]
if (!rpcCall) return
this.rpcCalls[message.msgId] = null
// reject/resolve
if (message.reject) rpcCall.reject(message.reject)
else rpcCall.resolve(message.resolve)
})
// wait for ready
this.isReady = this.rpc('isReady').catch((err) => {
console.error('Application failed to start', err)
this.stop()
process.exit(1)
})
}
// simple RPC call
// to use: driver.rpc('method', 1, 2, 3).then(...)
async rpc (cmd, ...args) {
// send rpc request
const msgId = this.rpcCalls.length
this.process.send({ msgId, cmd, args })
return new Promise((resolve, reject) => this.rpcCalls.push({ resolve, reject }))
}
stop () {
this.process.kill()
}
}
```
In the app, you'd need to write a simple handler for the RPC calls:
```js
const METHODS = {
isReady () {
// do any setup needed
return true
}
// define your RPC-able methods here
}
const onMessage = async ({ msgId, cmd, args }) => {
let method = METHODS[cmd]
if (!method) method = () => new Error('Invalid method: ' + cmd)
try {
const resolve = await method(...args)
process.send({ msgId, resolve })
} catch (err) {
const reject = {
message: err.message,
stack: err.stack,
name: err.name
}
process.send({ msgId, reject })
}
}
if (process.env.APP_TEST_DRIVER) {
process.on('message', onMessage)
}
```
Then, in your test suite, you can use your test-driver as follows:
```js
const test = require('ava')
const electronPath = require('electron')
const app = new TestDriver({
path: electronPath,
args: ['./app'],
env: {
NODE_ENV: 'test'
}
})
test.before(async t => {
await app.isReady
})
test.after.always('cleanup', async t => {
await app.stop()
})
```

View File

@@ -0,0 +1,265 @@
# Automated Testing
Test automation is an efficient way of validating that your application code works as intended.
While Electron doesn't actively maintain its own testing solution, this guide will go over a couple
ways you can run end-to-end automated tests on your Electron app.
## Using the WebDriver interface
From [ChromeDriver - WebDriver for Chrome][chrome-driver]:
> WebDriver is an open source tool for automated testing of web apps across many
> browsers. It provides capabilities for navigating to web pages, user input,
> JavaScript execution, and more. ChromeDriver is a standalone server which
> implements WebDriver's wire protocol for Chromium. It is being developed by
> members of the Chromium and WebDriver teams.
There are a few ways that you can set up testing using WebDriver.
### With WebdriverIO
[WebdriverIO](https://webdriver.io/) (WDIO) is a test automation framework that provides a
Node.js package for testing with WebDriver. Its ecosystem also includes various plugins
(e.g. reporter and services) that can help you put together your test setup.
#### Install the testrunner
First you need to run the WebdriverIO starter toolkit in your project root directory:
```sh npm2yarn
npx wdio . --yes
```
This installs all necessary packages for you and generates a `wdio.conf.js` configuration file.
#### Connect WDIO to your Electron app
Update the capabilities in your configuration file to point to your Electron app binary:
```javascript title='wdio.conf.js'
export.config = {
// ...
capabilities: [{
browserName: 'chrome',
'goog:chromeOptions': {
binary: '/path/to/your/electron/binary', // Path to your Electron binary.
args: [/* cli arguments */] // Optional, perhaps 'app=' + /path/to/your/app/
}
}]
// ...
}
```
#### Run your tests
To run your tests:
```sh
$ npx wdio run wdio.conf.js
```
[chrome-driver]: https://sites.google.com/chromium.org/driver/
### With Selenium
[Selenium](https://www.selenium.dev/) is a web automation framework that
exposes bindings to WebDriver APIs in many languages. Their Node.js bindings
are available under the `selenium-webdriver` package on NPM.
#### Run a ChromeDriver server
In order to use Selenium with Electron, you need to download the `electron-chromedriver`
binary, and run it:
```sh npm2yarn
npm install --save-dev electron-chromedriver
./node_modules/.bin/chromedriver
Starting ChromeDriver (v2.10.291558) on port 9515
Only local connections are allowed.
```
Remember the port number `9515`, which will be used later.
#### Connect Selenium to ChromeDriver
Next, install Selenium into your project:
```sh npm2yarn
npm install --save-dev selenium-webdriver
```
Usage of `selenium-webdriver` with Electron is the same as with
normal websites, except that you have to manually specify how to connect
ChromeDriver and where to find the binary of your Electron app:
```js title='test.js'
const webdriver = require('selenium-webdriver')
const driver = new webdriver.Builder()
// The "9515" is the port opened by ChromeDriver.
.usingServer('http://localhost:9515')
.withCapabilities({
'goog:chromeOptions': {
// Here is the path to your Electron binary.
binary: '/Path-to-Your-App.app/Contents/MacOS/Electron'
}
})
.forBrowser('chrome') // note: use .forBrowser('electron') for selenium-webdriver <= 3.6.0
.build()
driver.get('http://www.google.com')
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver')
driver.findElement(webdriver.By.name('btnG')).click()
driver.wait(() => {
return driver.getTitle().then((title) => {
return title === 'webdriver - Google Search'
})
}, 1000)
driver.quit()
```
## Using a custom test driver
It's also possible to write your own custom driver using Node.js' built-in IPC-over-STDIO.
Custom test drivers require you to write additional app code, but have lower overhead and let you
expose custom methods to your test suite.
To create a custom driver, we'll use Node.js' [`child_process`](https://nodejs.org/api/child_process.html) API.
The test suite will spawn the Electron process, then establish a simple messaging protocol:
```js title='testDriver.js'
const childProcess = require('child_process')
const electronPath = require('electron')
// spawn the process
const env = { /* ... */ }
const stdio = ['inherit', 'inherit', 'inherit', 'ipc']
const appProcess = childProcess.spawn(electronPath, ['./app'], { stdio, env })
// listen for IPC messages from the app
appProcess.on('message', (msg) => {
// ...
})
// send an IPC message to the app
appProcess.send({ my: 'message' })
```
From within the Electron app, you can listen for messages and send replies using the Node.js
[`process`](https://nodejs.org/api/process.html) API:
```js title='main.js'
// listen for messages from the test suite
process.on('message', (msg) => {
// ...
})
// send a message to the test suite
process.send({ my: 'message' })
```
We can now communicate from the test suite to the Electron app using the `appProcess` object.
For convenience, you may want to wrap `appProcess` in a driver object that provides more
high-level functions. Here is an example of how you can do this. Let's start by creating
a `TestDriver` class:
```js title='testDriver.js'
class TestDriver {
constructor ({ path, args, env }) {
this.rpcCalls = []
// start child process
env.APP_TEST_DRIVER = 1 // let the app know it should listen for messages
this.process = childProcess.spawn(path, args, { stdio: ['inherit', 'inherit', 'inherit', 'ipc'], env })
// handle rpc responses
this.process.on('message', (message) => {
// pop the handler
const rpcCall = this.rpcCalls[message.msgId]
if (!rpcCall) return
this.rpcCalls[message.msgId] = null
// reject/resolve
if (message.reject) rpcCall.reject(message.reject)
else rpcCall.resolve(message.resolve)
})
// wait for ready
this.isReady = this.rpc('isReady').catch((err) => {
console.error('Application failed to start', err)
this.stop()
process.exit(1)
})
}
// simple RPC call
// to use: driver.rpc('method', 1, 2, 3).then(...)
async rpc (cmd, ...args) {
// send rpc request
const msgId = this.rpcCalls.length
this.process.send({ msgId, cmd, args })
return new Promise((resolve, reject) => this.rpcCalls.push({ resolve, reject }))
}
stop () {
this.process.kill()
}
}
module.exports = { TestDriver };
```
In your app code, can then write a simple handler to receive RPC calls:
```js title='main.js'
const METHODS = {
isReady () {
// do any setup needed
return true
}
// define your RPC-able methods here
}
const onMessage = async ({ msgId, cmd, args }) => {
let method = METHODS[cmd]
if (!method) method = () => new Error('Invalid method: ' + cmd)
try {
const resolve = await method(...args)
process.send({ msgId, resolve })
} catch (err) {
const reject = {
message: err.message,
stack: err.stack,
name: err.name
}
process.send({ msgId, reject })
}
}
if (process.env.APP_TEST_DRIVER) {
process.on('message', onMessage)
}
```
Then, in your test suite, you can use your `TestDriver` class with the test automation
framework of your choosing. The following example uses
[`ava`](https://www.npmjs.com/package/ava), but other popular choices like Jest
or Mocha would work as well:
```js title='test.js'
const test = require('ava')
const electronPath = require('electron')
const { TestDriver } = require('./testDriver')
const app = new TestDriver({
path: electronPath,
args: ['./app'],
env: {
NODE_ENV: 'test'
}
})
test.before(async t => {
await app.isReady
})
test.after.always('cleanup', async t => {
await app.stop()
})
```

View File

@@ -1,173 +0,0 @@
# Selenium and WebDriver
From [ChromeDriver - WebDriver for Chrome][chrome-driver]:
> WebDriver is an open source tool for automated testing of web apps across many
> browsers. It provides capabilities for navigating to web pages, user input,
> JavaScript execution, and more. ChromeDriver is a standalone server which
> implements WebDriver's wire protocol for Chromium. It is being developed by
> members of the Chromium and WebDriver teams.
## Setting up Spectron
[Spectron][spectron] is the officially supported ChromeDriver testing framework
for Electron. It is built on top of [WebdriverIO](https://webdriver.io/) and
has helpers to access Electron APIs in your tests and bundles ChromeDriver.
```sh
$ npm install --save-dev spectron
```
```javascript
// A simple test to verify a visible window is opened with a title
const Application = require('spectron').Application
const assert = require('assert')
const myApp = new Application({
path: '/Applications/MyApp.app/Contents/MacOS/MyApp'
})
const verifyWindowIsVisibleWithTitle = async (app) => {
await app.start()
try {
// Check if the window is visible
const isVisible = await app.browserWindow.isVisible()
// Verify the window is visible
assert.strictEqual(isVisible, true)
// Get the window's title
const title = await app.client.getTitle()
// Verify the window's title
assert.strictEqual(title, 'My App')
} catch (error) {
// Log any failures
console.error('Test failed', error.message)
}
// Stop the application
await app.stop()
}
verifyWindowIsVisibleWithTitle(myApp)
```
## Setting up with WebDriverJs
[WebDriverJs](https://www.selenium.dev/selenium/docs/api/javascript/index.html) provides
a Node package for testing with web driver, we will use it as an example.
### 1. Start ChromeDriver
First you need to download the `chromedriver` binary, and run it:
```sh
$ npm install electron-chromedriver
$ ./node_modules/.bin/chromedriver
Starting ChromeDriver (v2.10.291558) on port 9515
Only local connections are allowed.
```
Remember the port number `9515`, which will be used later
### 2. Install WebDriverJS
```sh
$ npm install selenium-webdriver
```
### 3. Connect to ChromeDriver
The usage of `selenium-webdriver` with Electron is the same with
upstream, except that you have to manually specify how to connect
chrome driver and where to find Electron's binary:
```javascript
const webdriver = require('selenium-webdriver')
const driver = new webdriver.Builder()
// The "9515" is the port opened by chrome driver.
.usingServer('http://localhost:9515')
.withCapabilities({
'goog:chromeOptions': {
// Here is the path to your Electron binary.
binary: '/Path-to-Your-App.app/Contents/MacOS/Electron'
}
})
.forBrowser('chrome') // note: use .forBrowser('electron') for selenium-webdriver <= 3.6.0
.build()
driver.get('http://www.google.com')
driver.findElement(webdriver.By.name('q')).sendKeys('webdriver')
driver.findElement(webdriver.By.name('btnG')).click()
driver.wait(() => {
return driver.getTitle().then((title) => {
return title === 'webdriver - Google Search'
})
}, 1000)
driver.quit()
```
## Setting up with WebdriverIO
[WebdriverIO](https://webdriver.io/) provides a Node package for testing with web
driver.
### 1. Start ChromeDriver
First you need to download the `chromedriver` binary, and run it:
```sh
$ npm install electron-chromedriver
$ ./node_modules/.bin/chromedriver --url-base=wd/hub --port=9515
Starting ChromeDriver (v2.10.291558) on port 9515
Only local connections are allowed.
```
Remember the port number `9515`, which will be used later
### 2. Install WebdriverIO
```sh
$ npm install webdriverio
```
### 3. Connect to chrome driver
```javascript
const webdriverio = require('webdriverio')
const options = {
host: 'localhost', // Use localhost as chrome driver server
port: 9515, // "9515" is the port opened by chrome driver.
desiredCapabilities: {
browserName: 'chrome',
'goog:chromeOptions': {
binary: '/Path-to-Your-App/electron', // Path to your Electron binary.
args: [/* cli arguments */] // Optional, perhaps 'app=' + /path/to/your/app/
}
}
}
const client = webdriverio.remote(options)
client
.init()
.url('http://google.com')
.setValue('#q', 'webdriverio')
.click('#btnG')
.getTitle().then((title) => {
console.log('Title was: ' + title)
})
.end()
```
## Workflow
To test your application without rebuilding Electron,
[place](application-distribution.md)
your app source into Electron's resource directory.
Alternatively, pass an argument to run with your Electron binary that points to
your app's folder. This eliminates the need to copy-paste your app into
Electron's resource directory.
[chrome-driver]: https://sites.google.com/a/chromium.org/chromedriver/
[spectron]: https://electronjs.org/spectron

View File

@@ -1,6 +1,6 @@
{
"name": "electron",
"version": "17.0.0-nightly.20211027",
"version": "17.0.0-nightly.20211103",
"repository": "https://github.com/electron/electron",
"description": "Build cross platform desktop apps with JavaScript, HTML, and CSS",
"devDependencies": {

View File

@@ -109,3 +109,4 @@ fix_expose_decrementcapturercount_in_web_contents_impl.patch
feat_add_data_parameter_to_processsingleton.patch
mas_gate_private_enterprise_APIs
load_v8_snapshot_in_browser_process.patch
fix_patch_out_permissions_checks_in_exclusive_access.patch

View File

@@ -61,7 +61,7 @@ index eec994c4252f17d9c9c41e66d5dae6509ed98a18..e538c9b76da4d4435e10cd3848438446
#if defined(OS_WIN)
bool EscapeVirtualization(const base::FilePath& user_data_dir);
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
index 727333dd6abec99643e31bc77ed2cc8f3d5a0a0b..e5361397f78636816507355e7db6a9e55e6ed234 100644
index a04d139f958a7aaef9b96e8c29317ccf7c97f009..29188668a69047b3ad3bebd1f0057565a330b509 100644
--- a/chrome/browser/process_singleton_posix.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -567,6 +567,7 @@ class ProcessSingleton::LinuxWatcher

View File

@@ -0,0 +1,51 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shelley Vohr <shelley.vohr@gmail.com>
Date: Mon, 25 Oct 2021 21:45:57 +0200
Subject: fix: patch out permissions checks in exclusive_access
This patch is necessary in order to properly enable
navigator.keyboard.{(un)?lock}() functionality. We don't have a concept
of PermissionManager nor of a Profile, so this would not affect usage of
the API.
We might consider potentially using our own permissions handler,
but it's not strictly necessary for this API to work to spec.
Profile check has been upstreamed at https://chromium-review.googlesource.com/c/chromium/src/+/3247196
diff --git a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
index e9c8a4a4bb7334682ceeec05b3a3e872de0192ab..861307591f3721c398c454126cb5a9be9a5e9764 100644
--- a/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
+++ b/chrome/browser/ui/exclusive_access/fullscreen_controller.cc
@@ -368,13 +368,9 @@ void FullscreenController::EnterFullscreenModeInternal(
// Do not enter fullscreen mode if disallowed by pref. This prevents the user
// from manually entering fullscreen mode and also disables kiosk mode on
// desktop platforms.
- if (!exclusive_access_manager()
- ->context()
- ->GetProfile()
- ->GetPrefs()
- ->GetBoolean(prefs::kFullscreenAllowed)) {
+ auto* profile = exclusive_access_manager()->context()->GetProfile();
+ if (!profile || !profile->GetPrefs()->GetBoolean(prefs::kFullscreenAllowed))
return;
- }
#endif
toggled_into_fullscreen_ = true;
@@ -387,6 +383,7 @@ void FullscreenController::EnterFullscreenModeInternal(
url = extension_caused_fullscreen_;
}
+#if 0
if (display_id != display::kInvalidDisplayId) {
// Check, but do not prompt, for permission to request a specific screen.
// Sites generally need permission to get the display id in the first place.
@@ -400,6 +397,7 @@ void FullscreenController::EnterFullscreenModeInternal(
display_id = display::kInvalidDisplayId;
}
}
+#endif
if (option == BROWSER)
base::RecordAction(base::UserMetricsAction("ToggleFullscreen"));

View File

@@ -76,7 +76,7 @@ index 0d7c1db6489d95a40c66808c3f838b0740e46ff6..eec994c4252f17d9c9c41e66d5dae650
#if defined(OS_MAC)
diff --git a/chrome/browser/process_singleton_posix.cc b/chrome/browser/process_singleton_posix.cc
index 4547eb8563e1af57aad991d9d1e2cf02c778380a..727333dd6abec99643e31bc77ed2cc8f3d5a0a0b 100644
index 4547eb8563e1af57aad991d9d1e2cf02c778380a..a04d139f958a7aaef9b96e8c29317ccf7c97f009 100644
--- a/chrome/browser/process_singleton_posix.cc
+++ b/chrome/browser/process_singleton_posix.cc
@@ -80,6 +80,7 @@
@@ -171,7 +171,7 @@ index 4547eb8563e1af57aad991d9d1e2cf02c778380a..727333dd6abec99643e31bc77ed2cc8f
ProcessSingleton::NotifyResult
ProcessSingleton::NotifyOtherProcessWithTimeoutOrCreate(
const base::CommandLine& command_line,
@@ -999,12 +1039,26 @@ bool ProcessSingleton::Create() {
@@ -999,14 +1039,32 @@ bool ProcessSingleton::Create() {
#endif
}
@@ -180,15 +180,15 @@ index 4547eb8563e1af57aad991d9d1e2cf02c778380a..727333dd6abec99643e31bc77ed2cc8f
- // do not support Unix domain sockets.
- if (!socket_dir_.CreateUniqueTempDir()) {
- LOG(ERROR) << "Failed to create socket directory.";
- return false;
+ base::FilePath tmp_dir;
+ if (!base::GetTempDir(&tmp_dir)) {
+ LOG(ERROR) << "Failed to get temporary directory.";
return false;
}
+ if (IsAppSandboxed()) {
+ // For sandboxed applications, the tmp dir could be too long to fit
+ // addr->sun_path, so we need to make it as short as possible.
+ base::FilePath tmp_dir;
+ if (!base::GetTempDir(&tmp_dir)) {
+ LOG(ERROR) << "Failed to get temporary directory.";
+ return false;
+ }
+ if (!socket_dir_.Set(tmp_dir.Append("S"))) {
+ LOG(ERROR) << "Failed to set socket directory.";
+ return false;
@@ -197,14 +197,19 @@ index 4547eb8563e1af57aad991d9d1e2cf02c778380a..727333dd6abec99643e31bc77ed2cc8f
+ // Create the socket file somewhere in /tmp which is usually mounted as a
+ // normal filesystem. Some network filesystems (notably AFS) are screwy and
+ // do not support Unix domain sockets.
+ if (!socket_dir_.CreateUniqueTempDir()) {
+ // Prefer CreateUniqueTempDirUnderPath rather than CreateUniqueTempDir as
+ // the latter will calculate unique paths based on bundle ids which can
+ // increase the socket path length than what is allowed.
+ if (!socket_dir_.CreateUniqueTempDirUnderPath(tmp_dir)) {
+ LOG(ERROR) << "Failed to create socket directory.";
+ return false;
+ }
}
+ }
+
// Check that the directory was created with the correct permissions.
@@ -1046,10 +1100,13 @@ bool ProcessSingleton::Create() {
int dir_mode = 0;
CHECK(base::GetPosixFilePermissions(socket_dir_.GetPath(), &dir_mode) &&
@@ -1046,10 +1104,13 @@ bool ProcessSingleton::Create() {
if (listen(sock, 5) < 0)
NOTREACHED() << "listen failed: " << base::safe_strerror(errno);

View File

@@ -24,3 +24,4 @@ repl_fix_crash_when_sharedarraybuffer_disabled.patch
fix_readbarrier_undefined_symbol_error_on_woa_arm64.patch
chore_fix_-wimplicit-fallthrough.patch
fix_event_with_invalid_timestamp_in_trace_log.patch
test_fix_test-datetime-change-notify_after_daylight_change.patch

View File

@@ -1772,7 +1772,7 @@ index 0000000000000000000000000000000000000000..d1d6b51e8c0c5bc6a5d09e217eb30483
+ args = rebase_path(inputs + outputs, root_build_dir)
+}
diff --git a/src/node_version.h b/src/node_version.h
index 7d8e7e507b2481e1f49c8da7c75a58dc8f90640e..d8ed5d33c3cf786ba2df9d37083c1ef103e06489 100644
index 08e957472cfeca84af8cdc951af3c0de99c7b56c..330d77e868a50e1d0b71d773ab6b4b337ab20428 100644
--- a/src/node_version.h
+++ b/src/node_version.h
@@ -89,7 +89,10 @@

View File

@@ -0,0 +1,39 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Piotr Rybak <rybak.piotr@yahoo.com>
Date: Sun, 31 Oct 2021 17:58:09 +0900
Subject: test: fix test-datetime-change-notify after daylight change
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Add standard timezone name for Dublin without daylight saving
PR-URL: https://github.com/nodejs/node/pull/40684
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Voltrex <mohammadkeyvanzade94@gmail.com>
(cherry picked from commit 747ef34fb0c9c1f2924ab1b79ea000c87e67a8eb)
diff --git a/test/parallel/test-datetime-change-notify.js b/test/parallel/test-datetime-change-notify.js
index 9cd6d7abfd898ac6781b04422362a6b459b7dc2c..01843511907077857be22c9bc7e7f8568fc677d1 100644
--- a/test/parallel/test-datetime-change-notify.js
+++ b/test/parallel/test-datetime-change-notify.js
@@ -18,15 +18,15 @@ const cases = [
},
{
timeZone: 'America/New_York',
- expected: /Eastern (Standard|Daylight) Time/,
+ expected: /Eastern (?:Standard|Daylight) Time/,
},
{
timeZone: 'America/Los_Angeles',
- expected: /Pacific (Standard|Daylight) Time/,
+ expected: /Pacific (?:Standard|Daylight) Time/,
},
{
timeZone: 'Europe/Dublin',
- expected: /Irish/,
+ expected: /Irish Standard Time|Greenwich Mean Time/,
},
];

View File

@@ -90,6 +90,7 @@ const LINTERS = [{
spawnAndCheckExitCode('python', ['script/run-clang-format.py', ...filenames]);
}
const filter = [
'-readability/braces',
'-readability/casting',
'-whitespace/braces',
'-whitespace/indent',

View File

@@ -17,6 +17,10 @@ class ElectronContentClient : public content::ContentClient {
ElectronContentClient();
~ElectronContentClient() override;
// disable copy
ElectronContentClient(const ElectronContentClient&) = delete;
ElectronContentClient& operator=(const ElectronContentClient&) = delete;
protected:
// content::ContentClient:
std::u16string GetLocalizedString(int message_id) override;
@@ -30,9 +34,6 @@ class ElectronContentClient : public content::ContentClient {
void AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronContentClient);
};
} // namespace electron

View File

@@ -9,7 +9,6 @@
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/no_destructor.h"
#include "build/build_config.h"
#include "components/crash/core/app/crash_reporter_client.h"
@@ -18,6 +17,11 @@ class ElectronCrashReporterClient : public crash_reporter::CrashReporterClient {
public:
static void Create();
// disable copy
ElectronCrashReporterClient(const ElectronCrashReporterClient&) = delete;
ElectronCrashReporterClient& operator=(const ElectronCrashReporterClient&) =
delete;
static ElectronCrashReporterClient* Get();
void SetCollectStatsConsent(bool upload_allowed);
void SetUploadUrl(const std::string& url);
@@ -85,8 +89,6 @@ class ElectronCrashReporterClient : public crash_reporter::CrashReporterClient {
ElectronCrashReporterClient();
~ElectronCrashReporterClient() override;
DISALLOW_COPY_AND_ASSIGN(ElectronCrashReporterClient);
};
#endif // SHELL_APP_ELECTRON_CRASH_REPORTER_CLIENT_H_

View File

@@ -24,6 +24,7 @@
#include <tchar.h>
#include "base/environment.h"
#include "base/macros.h"
#include "base/process/launch.h"
#include "base/strings/utf_string_conversions.h"
#include "base/win/windows_version.h"

View File

@@ -26,6 +26,10 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
ElectronMainDelegate();
~ElectronMainDelegate() override;
// disable copy
ElectronMainDelegate(const ElectronMainDelegate&) = delete;
ElectronMainDelegate& operator=(const ElectronMainDelegate&) = delete;
protected:
// content::ContentMainDelegate:
bool BasicStartupComplete(int* exit_code) override;
@@ -58,8 +62,6 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
std::unique_ptr<content::ContentRendererClient> renderer_client_;
std::unique_ptr<content::ContentUtilityClient> utility_client_;
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
DISALLOW_COPY_AND_ASSIGN(ElectronMainDelegate);
};
} // namespace electron

View File

@@ -22,6 +22,10 @@ class UvTaskRunner : public base::SingleThreadTaskRunner {
public:
explicit UvTaskRunner(uv_loop_t* loop);
// disable copy
UvTaskRunner(const UvTaskRunner&) = delete;
UvTaskRunner& operator=(const UvTaskRunner&) = delete;
// base::SingleThreadTaskRunner:
bool PostDelayedTask(const base::Location& from_here,
base::OnceClosure task,
@@ -39,8 +43,6 @@ class UvTaskRunner : public base::SingleThreadTaskRunner {
uv_loop_t* loop_;
std::map<uv_timer_t*, base::OnceClosure> tasks_;
DISALLOW_COPY_AND_ASSIGN(UvTaskRunner);
};
} // namespace electron

View File

@@ -79,6 +79,10 @@ class App : public ElectronBrowserClient::Delegate,
App();
// disable copy
App(const App&) = delete;
App& operator=(const App&) = delete;
private:
~App() override;
@@ -261,8 +265,6 @@ class App : public ElectronBrowserClient::Delegate,
bool disable_hw_acceleration_ = false;
bool disable_domain_blocking_for_3DAPIs_ = false;
DISALLOW_COPY_AND_ASSIGN(App);
};
} // namespace api

View File

@@ -30,6 +30,10 @@ class AutoUpdater : public gin::Wrappable<AutoUpdater>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
AutoUpdater(const AutoUpdater&) = delete;
AutoUpdater& operator=(const AutoUpdater&) = delete;
protected:
AutoUpdater();
~AutoUpdater() override;
@@ -54,8 +58,6 @@ class AutoUpdater : public gin::Wrappable<AutoUpdater>,
std::string GetFeedURL();
void SetFeedURL(gin::Arguments* args);
void QuitAndInstall();
DISALLOW_COPY_AND_ASSIGN(AutoUpdater);
};
} // namespace api

View File

@@ -54,6 +54,10 @@ class BrowserView : public gin::Wrappable<BrowserView>,
int32_t ID() const { return id_; }
// disable copy
BrowserView(const BrowserView&) = delete;
BrowserView& operator=(const BrowserView&) = delete;
protected:
BrowserView(gin::Arguments* args, const gin_helper::Dictionary& options);
~BrowserView() override;
@@ -78,8 +82,6 @@ class BrowserView : public gin::Wrappable<BrowserView>,
std::unique_ptr<NativeBrowserView> view_;
int32_t id_;
DISALLOW_COPY_AND_ASSIGN(BrowserView);
};
} // namespace api

View File

@@ -254,7 +254,7 @@ void BrowserWindow::OnCloseButtonClicked(bool* prevent_default) {
ScheduleUnresponsiveEvent(5000);
// Already closed by renderer.
if (!web_contents())
if (!web_contents() || !api_web_contents_)
return;
// Required to make beforeunload handler work.

View File

@@ -37,6 +37,10 @@ class BrowserWindow : public BaseWindow,
return weak_factory_.GetWeakPtr();
}
// disable copy
BrowserWindow(const BrowserWindow&) = delete;
BrowserWindow& operator=(const BrowserWindow&) = delete;
protected:
BrowserWindow(gin::Arguments* args, const gin_helper::Dictionary& options);
~BrowserWindow() override;
@@ -123,8 +127,6 @@ class BrowserWindow : public BaseWindow,
base::WeakPtr<api::WebContents> api_web_contents_;
base::WeakPtrFactory<BrowserWindow> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(BrowserWindow);
};
} // namespace api

View File

@@ -41,6 +41,10 @@ class Cookies : public gin::Wrappable<Cookies>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
Cookies(const Cookies&) = delete;
Cookies& operator=(const Cookies&) = delete;
protected:
Cookies(v8::Isolate* isolate, ElectronBrowserContext* browser_context);
~Cookies() override;
@@ -62,8 +66,6 @@ class Cookies : public gin::Wrappable<Cookies>,
// Weak reference; ElectronBrowserContext is guaranteed to outlive us.
ElectronBrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(Cookies);
};
} // namespace api

View File

@@ -57,6 +57,10 @@ class DataPipeReader {
~DataPipeReader() = default;
// disable copy
DataPipeReader(const DataPipeReader&) = delete;
DataPipeReader& operator=(const DataPipeReader&) = delete;
private:
// Callback invoked by DataPipeGetter::Read.
void ReadCallback(int32_t status, uint64_t size) {
@@ -137,8 +141,6 @@ class DataPipeReader {
uint64_t remaining_size_ = 0;
base::WeakPtrFactory<DataPipeReader> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DataPipeReader);
};
} // namespace

View File

@@ -37,14 +37,16 @@ class DataPipeHolder : public gin::Wrappable<DataPipeHolder> {
// The unique ID that can be used to receive the object.
const std::string& id() const { return id_; }
// disable copy
DataPipeHolder(const DataPipeHolder&) = delete;
DataPipeHolder& operator=(const DataPipeHolder&) = delete;
private:
explicit DataPipeHolder(const network::DataElement& element);
~DataPipeHolder() override;
std::string id_;
mojo::Remote<network::mojom::DataPipeGetter> data_pipe_;
DISALLOW_COPY_AND_ASSIGN(DataPipeHolder);
};
} // namespace api

View File

@@ -40,6 +40,10 @@ class Debugger : public gin::Wrappable<Debugger>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
Debugger(const Debugger&) = delete;
Debugger& operator=(const Debugger&) = delete;
protected:
Debugger(v8::Isolate* isolate, content::WebContents* web_contents);
~Debugger() override;
@@ -68,8 +72,6 @@ class Debugger : public gin::Wrappable<Debugger>,
PendingRequestMap pending_requests_;
int previous_request_id_ = 0;
DISALLOW_COPY_AND_ASSIGN(Debugger);
};
} // namespace api

View File

@@ -45,6 +45,10 @@ class DesktopCapturer : public gin::Wrappable<DesktopCapturer>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
DesktopCapturer(const DesktopCapturer&) = delete;
DesktopCapturer& operator=(const DesktopCapturer&) = delete;
protected:
explicit DesktopCapturer(v8::Isolate* isolate);
~DesktopCapturer() override;
@@ -71,8 +75,6 @@ class DesktopCapturer : public gin::Wrappable<DesktopCapturer>,
#endif // defined(OS_WIN)
base::WeakPtrFactory<DesktopCapturer> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DesktopCapturer);
};
} // namespace api

View File

@@ -43,6 +43,10 @@ class DownloadItem : public gin::Wrappable<DownloadItem>,
base::FilePath GetSavePath() const;
file_dialog::DialogSettings GetSaveDialogOptions() const;
// disable copy
DownloadItem(const DownloadItem&) = delete;
DownloadItem& operator=(const DownloadItem&) = delete;
private:
DownloadItem(v8::Isolate* isolate, download::DownloadItem* item);
~DownloadItem() override;
@@ -81,8 +85,6 @@ class DownloadItem : public gin::Wrappable<DownloadItem>,
v8::Isolate* isolate_;
base::WeakPtrFactory<DownloadItem> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DownloadItem);
};
} // namespace api

View File

@@ -29,6 +29,10 @@ class GlobalShortcut : public extensions::GlobalShortcutListener::Observer,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
GlobalShortcut(const GlobalShortcut&) = delete;
GlobalShortcut& operator=(const GlobalShortcut&) = delete;
protected:
explicit GlobalShortcut(v8::Isolate* isolate);
~GlobalShortcut() override;
@@ -50,8 +54,6 @@ class GlobalShortcut : public extensions::GlobalShortcutListener::Observer,
void OnKeyPressed(const ui::Accelerator& accelerator) override;
AcceleratorCallbackMap accelerator_callback_map_;
DISALLOW_COPY_AND_ASSIGN(GlobalShortcut);
};
} // namespace api

View File

@@ -32,6 +32,10 @@ class InAppPurchase : public gin::Wrappable<InAppPurchase>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
InAppPurchase(const InAppPurchase&) = delete;
InAppPurchase& operator=(const InAppPurchase&) = delete;
protected:
InAppPurchase();
~InAppPurchase() override;
@@ -45,9 +49,6 @@ class InAppPurchase : public gin::Wrappable<InAppPurchase>,
// TransactionObserver:
void OnTransactionsUpdated(
const std::vector<in_app_purchase::Transaction>& transactions) override;
private:
DISALLOW_COPY_AND_ASSIGN(InAppPurchase);
};
} // namespace api

View File

@@ -46,6 +46,10 @@ class Menu : public gin::Wrappable<Menu>,
ElectronMenuModel* model() const { return model_.get(); }
// disable copy
Menu(const Menu&) = delete;
Menu& operator=(const Menu&) = delete;
protected:
explicit Menu(gin::Arguments* args);
~Menu() override;
@@ -117,8 +121,6 @@ class Menu : public gin::Wrappable<Menu>,
bool IsEnabledAt(int index) const;
bool IsVisibleAt(int index) const;
bool WorksWhenHiddenAt(int index) const;
DISALLOW_COPY_AND_ASSIGN(Menu);
};
} // namespace api

View File

@@ -48,8 +48,6 @@ class MenuMac : public Menu {
std::map<int32_t, scoped_nsobject<ElectronMenuController>> popup_controllers_;
base::WeakPtrFactory<MenuMac> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MenuMac);
};
} // namespace api

View File

@@ -37,8 +37,6 @@ class MenuViews : public Menu {
std::map<int32_t, std::unique_ptr<views::MenuRunner>> menu_runners_;
base::WeakPtrFactory<MenuViews> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(MenuViews);
};
} // namespace api

View File

@@ -27,6 +27,10 @@ class NativeTheme : public gin::Wrappable<NativeTheme>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
NativeTheme(const NativeTheme&) = delete;
NativeTheme& operator=(const NativeTheme&) = delete;
protected:
NativeTheme(v8::Isolate* isolate,
ui::NativeTheme* ui_theme,
@@ -50,8 +54,6 @@ class NativeTheme : public gin::Wrappable<NativeTheme>,
private:
ui::NativeTheme* ui_theme_;
ui::NativeTheme* web_theme_;
DISALLOW_COPY_AND_ASSIGN(NativeTheme);
};
} // namespace api

View File

@@ -7,7 +7,6 @@
#include "base/callback.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "gin/handle.h"
@@ -45,6 +44,10 @@ class NetLog : public gin::Wrappable<NetLog> {
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
NetLog(const NetLog&) = delete;
NetLog& operator=(const NetLog&) = delete;
protected:
explicit NetLog(v8::Isolate* isolate,
ElectronBrowserContext* browser_context);
@@ -68,8 +71,6 @@ class NetLog : public gin::Wrappable<NetLog> {
scoped_refptr<base::TaskRunner> file_task_runner_;
base::WeakPtrFactory<NetLog> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(NetLog);
};
} // namespace api

View File

@@ -56,6 +56,10 @@ class Notification : public gin::Wrappable<Notification>,
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
// disable copy
Notification(const Notification&) = delete;
Notification& operator=(const Notification&) = delete;
protected:
explicit Notification(gin::Arguments* args);
~Notification() override;
@@ -111,8 +115,6 @@ class Notification : public gin::Wrappable<Notification>,
electron::NotificationPresenter* presenter_;
base::WeakPtr<electron::Notification> notification_;
DISALLOW_COPY_AND_ASSIGN(Notification);
};
} // namespace api

View File

@@ -33,6 +33,10 @@ class PowerMonitor : public gin::Wrappable<PowerMonitor>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
PowerMonitor(const PowerMonitor&) = delete;
PowerMonitor& operator=(const PowerMonitor&) = delete;
private:
explicit PowerMonitor(v8::Isolate* isolate);
~PowerMonitor() override;
@@ -80,8 +84,6 @@ class PowerMonitor : public gin::Wrappable<PowerMonitor>,
#if defined(OS_LINUX)
PowerObserverLinux power_observer_linux_{this};
#endif
DISALLOW_COPY_AND_ASSIGN(PowerMonitor);
};
} // namespace api

View File

@@ -27,6 +27,10 @@ class PowerSaveBlocker : public gin::Wrappable<PowerSaveBlocker> {
static gin::WrapperInfo kWrapperInfo;
// disable copy
PowerSaveBlocker(const PowerSaveBlocker&) = delete;
PowerSaveBlocker& operator=(const PowerSaveBlocker&) = delete;
protected:
explicit PowerSaveBlocker(v8::Isolate* isolate);
~PowerSaveBlocker() override;
@@ -50,8 +54,6 @@ class PowerSaveBlocker : public gin::Wrappable<PowerSaveBlocker> {
WakeLockTypeMap wake_lock_types_;
mojo::Remote<device::mojom::WakeLock> wake_lock_;
DISALLOW_COPY_AND_ASSIGN(PowerSaveBlocker);
};
} // namespace api

View File

@@ -34,6 +34,10 @@ class Screen : public gin::Wrappable<Screen>,
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
Screen(const Screen&) = delete;
Screen& operator=(const Screen&) = delete;
protected:
Screen(v8::Isolate* isolate, display::Screen* screen);
~Screen() override;
@@ -52,8 +56,6 @@ class Screen : public gin::Wrappable<Screen>,
private:
display::Screen* screen_;
DISALLOW_COPY_AND_ASSIGN(Screen);
};
} // namespace api

View File

@@ -43,6 +43,10 @@ class ServiceWorkerContext
v8::Isolate* isolate) override;
const char* GetTypeName() override;
// disable copy
ServiceWorkerContext(const ServiceWorkerContext&) = delete;
ServiceWorkerContext& operator=(const ServiceWorkerContext&) = delete;
protected:
explicit ServiceWorkerContext(v8::Isolate* isolate,
ElectronBrowserContext* browser_context);
@@ -52,8 +56,6 @@ class ServiceWorkerContext
content::ServiceWorkerContext* service_worker_context_;
base::WeakPtrFactory<ServiceWorkerContext> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ServiceWorkerContext);
};
} // namespace api

View File

@@ -155,6 +155,10 @@ class Session : public gin::Wrappable<Session>,
extensions::UnloadedExtensionReason reason) override;
#endif
// disable copy
Session(const Session&) = delete;
Session& operator=(const Session&) = delete;
protected:
Session(v8::Isolate* isolate, ElectronBrowserContext* browser_context);
~Session() override;
@@ -187,8 +191,6 @@ class Session : public gin::Wrappable<Session>,
base::UnguessableToken network_emulation_token_;
ElectronBrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(Session);
};
} // namespace api

View File

@@ -121,6 +121,10 @@ class SystemPreferences
bool IsHighContrastColorScheme();
v8::Local<v8::Value> GetAnimationSettings(v8::Isolate* isolate);
// disable copy
SystemPreferences(const SystemPreferences&) = delete;
SystemPreferences& operator=(const SystemPreferences&) = delete;
protected:
SystemPreferences();
~SystemPreferences() override;
@@ -162,7 +166,6 @@ class SystemPreferences
std::unique_ptr<gfx::ScopedSysColorChangeListener> color_change_listener_;
#endif
DISALLOW_COPY_AND_ASSIGN(SystemPreferences);
};
} // namespace api

View File

@@ -52,6 +52,10 @@ class Tray : public gin::Wrappable<Tray>,
// gin::Wrappable
static gin::WrapperInfo kWrapperInfo;
// disable copy
Tray(const Tray&) = delete;
Tray& operator=(const Tray&) = delete;
private:
Tray(v8::Isolate* isolate,
v8::Local<v8::Value> image,
@@ -105,8 +109,6 @@ class Tray : public gin::Wrappable<Tray>,
v8::Global<v8::Value> menu_;
std::unique_ptr<TrayIcon> tray_icon_;
DISALLOW_COPY_AND_ASSIGN(Tray);
};
} // namespace api

View File

@@ -30,6 +30,10 @@ class View : public gin_helper::Wrappable<View> {
views::View* view() const { return view_; }
// disable copy
View(const View&) = delete;
View& operator=(const View&) = delete;
protected:
explicit View(views::View* view);
View();
@@ -43,8 +47,6 @@ class View : public gin_helper::Wrappable<View> {
bool delete_view_ = true;
views::View* view_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(View);
};
} // namespace api

View File

@@ -15,6 +15,7 @@
#include "base/containers/id_map.h"
#include "base/files/file_util.h"
#include "base/json/json_reader.h"
#include "base/macros.h"
#include "base/no_destructor.h"
#include "base/strings/utf_string_conversions.h"
#include "base/task/current_thread.h"
@@ -26,6 +27,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "base/values.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
#include "chrome/browser/ui/views/eye_dropper/eye_dropper.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
@@ -630,6 +632,7 @@ WebContents::WebContents(v8::Isolate* isolate,
id_(GetAllWebContents().Add(this)),
devtools_file_system_indexer_(
base::MakeRefCounted<DevToolsFileSystemIndexer>()),
exclusive_access_manager_(std::make_unique<ExclusiveAccessManager>(this)),
file_task_runner_(
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
#if BUILDFLAG(ENABLE_PRINTING)
@@ -668,6 +671,7 @@ WebContents::WebContents(v8::Isolate* isolate,
id_(GetAllWebContents().Add(this)),
devtools_file_system_indexer_(
base::MakeRefCounted<DevToolsFileSystemIndexer>()),
exclusive_access_manager_(std::make_unique<ExclusiveAccessManager>(this)),
file_task_runner_(
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
#if BUILDFLAG(ENABLE_PRINTING)
@@ -688,6 +692,7 @@ WebContents::WebContents(v8::Isolate* isolate,
: id_(GetAllWebContents().Add(this)),
devtools_file_system_indexer_(
base::MakeRefCounted<DevToolsFileSystemIndexer>()),
exclusive_access_manager_(std::make_unique<ExclusiveAccessManager>(this)),
file_task_runner_(
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
#if BUILDFLAG(ENABLE_PRINTING)
@@ -1252,6 +1257,40 @@ void WebContents::ContentsZoomChange(bool zoom_in) {
Emit("zoom-changed", zoom_in ? "in" : "out");
}
Profile* WebContents::GetProfile() {
return nullptr;
}
bool WebContents::IsFullscreen() const {
return owner_window_ && owner_window_->IsFullscreen();
}
void WebContents::EnterFullscreen(const GURL& url,
ExclusiveAccessBubbleType bubble_type,
const int64_t display_id) {}
void WebContents::ExitFullscreen() {}
void WebContents::UpdateExclusiveAccessExitBubbleContent(
const GURL& url,
ExclusiveAccessBubbleType bubble_type,
ExclusiveAccessBubbleHideCallback bubble_first_hide_callback,
bool force_update) {}
void WebContents::OnExclusiveAccessUserInput() {}
content::WebContents* WebContents::GetActiveWebContents() {
return web_contents();
}
bool WebContents::CanUserExitFullscreen() const {
return true;
}
bool WebContents::IsExclusiveAccessBubbleDisplayed() const {
return false;
}
void WebContents::EnterFullscreenModeForTab(
content::RenderFrameHost* requesting_frame,
const blink::mojom::FullscreenOptions& options) {
@@ -1262,6 +1301,8 @@ void WebContents::EnterFullscreenModeForTab(
base::BindRepeating(&WebContents::OnEnterFullscreenModeForTab,
base::Unretained(this), requesting_frame, options);
permission_helper->RequestFullscreenPermission(callback);
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
}
void WebContents::OnEnterFullscreenModeForTab(
@@ -1298,6 +1339,9 @@ void WebContents::ExitFullscreenModeForTab(content::WebContents* source) {
// `chrome/browser/ui/exclusive_access/fullscreen_controller.cc`.
source->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}
exclusive_access_manager_->fullscreen_controller()->ExitFullscreenModeForTab(
source);
}
void WebContents::RendererUnresponsive(
@@ -1346,6 +1390,18 @@ void WebContents::FindReply(content::WebContents* web_contents,
Emit("found-in-page", result.GetHandle());
}
void WebContents::RequestKeyboardLock(content::WebContents* web_contents,
bool esc_key_locked) {
exclusive_access_manager_->keyboard_lock_controller()->RequestKeyboardLock(
web_contents, esc_key_locked);
}
void WebContents::CancelKeyboardLockRequest(
content::WebContents* web_contents) {
exclusive_access_manager_->keyboard_lock_controller()
->CancelKeyboardLockRequest(web_contents);
}
bool WebContents::CheckMediaAccessPermission(
content::RenderFrameHost* render_frame_host,
const GURL& security_origin,

View File

@@ -16,6 +16,7 @@
#include "base/observer_list_types.h"
#include "chrome/browser/devtools/devtools_eye_dropper.h"
#include "chrome/browser/devtools/devtools_file_system_indexer.h"
#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h" // nogncheck
#include "content/common/cursors/webcursor.h"
#include "content/common/frame.mojom.h"
#include "content/public/browser/devtools_agent_host.h"
@@ -74,6 +75,8 @@ namespace gin {
class Arguments;
}
class ExclusiveAccessManager;
namespace electron {
class ElectronBrowserContext;
@@ -98,7 +101,8 @@ using DevicePermissionMap = std::map<
std::map<url::Origin, std::vector<std::unique_ptr<base::Value>>>>>;
// Wrapper around the content::WebContents.
class WebContents : public gin::Wrappable<WebContents>,
class WebContents : public ExclusiveAccessContext,
public gin::Wrappable<WebContents>,
public gin_helper::EventEmitterMixin<WebContents>,
public gin_helper::Constructible<WebContents>,
public gin_helper::Pinnable<WebContents>,
@@ -443,6 +447,10 @@ class WebContents : public gin::Wrappable<WebContents>,
content::PermissionType permissionType,
content::RenderFrameHost* render_frame_host);
// disable copy
WebContents(const WebContents&) = delete;
WebContents& operator=(const WebContents&) = delete;
private:
// Does not manage lifetime of |web_contents|.
WebContents(v8::Isolate* isolate, content::WebContents* web_contents);
@@ -549,6 +557,9 @@ class WebContents : public gin::Wrappable<WebContents>,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) override;
void RequestKeyboardLock(content::WebContents* web_contents,
bool esc_key_locked) override;
void CancelKeyboardLockRequest(content::WebContents* web_contents) override;
bool CheckMediaAccessPermission(content::RenderFrameHost* render_frame_host,
const GURL& security_origin,
blink::mojom::MediaStreamType type) override;
@@ -647,6 +658,24 @@ class WebContents : public gin::Wrappable<WebContents>,
void EnumerateDirectory(content::WebContents* web_contents,
scoped_refptr<content::FileSelectListener> listener,
const base::FilePath& path) override;
// ExclusiveAccessContext:
Profile* GetProfile() override;
bool IsFullscreen() const override;
void EnterFullscreen(const GURL& url,
ExclusiveAccessBubbleType bubble_type,
const int64_t display_id) override;
void ExitFullscreen() override;
void UpdateExclusiveAccessExitBubbleContent(
const GURL& url,
ExclusiveAccessBubbleType bubble_type,
ExclusiveAccessBubbleHideCallback bubble_first_hide_callback,
bool force_update) override;
void OnExclusiveAccessUserInput() override;
content::WebContents* GetActiveWebContents() override;
bool CanUserExitFullscreen() const override;
bool IsExclusiveAccessBubbleDisplayed() const override;
bool IsFullscreenForTabOrPending(const content::WebContents* source) override;
blink::SecurityStyle GetSecurityStyle(
content::WebContents* web_contents,
@@ -760,6 +789,8 @@ class WebContents : public gin::Wrappable<WebContents>,
scoped_refptr<DevToolsFileSystemIndexer> devtools_file_system_indexer_;
std::unique_ptr<ExclusiveAccessManager> exclusive_access_manager_;
std::unique_ptr<DevToolsEyeDropper> eye_dropper_;
ElectronBrowserContext* browser_context_;
@@ -793,8 +824,6 @@ class WebContents : public gin::Wrappable<WebContents>,
DevicePermissionMap granted_devices_;
base::WeakPtrFactory<WebContents> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(WebContents);
};
} // namespace api

View File

@@ -51,8 +51,6 @@ class WebContentsView : public View, public content::WebContentsObserver {
// Keep a reference to v8 wrapper.
v8::Global<v8::Value> web_contents_;
api::WebContents* api_web_contents_;
DISALLOW_COPY_AND_ASSIGN(WebContentsView);
};
} // namespace api

View File

@@ -59,6 +59,10 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
content::RenderFrameHost* render_frame_host() const { return render_frame_; }
// disable copy
WebFrameMain(const WebFrameMain&) = delete;
WebFrameMain& operator=(const WebFrameMain&) = delete;
protected:
explicit WebFrameMain(content::RenderFrameHost* render_frame);
~WebFrameMain() override;
@@ -124,8 +128,6 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
bool render_frame_disposed_ = false;
base::WeakPtrFactory<WebFrameMain> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(WebFrameMain);
};
} // namespace api

View File

@@ -29,6 +29,10 @@ class Event : public gin::Wrappable<Event> {
// `invoke` calls.
bool SendReply(v8::Isolate* isolate, v8::Local<v8::Value> result);
// disable copy
Event(const Event&) = delete;
Event& operator=(const Event&) = delete;
protected:
Event();
~Event() override;
@@ -41,8 +45,6 @@ class Event : public gin::Wrappable<Event> {
private:
// Replyer for the synchronous messages.
InvokeCallback callback_;
DISALLOW_COPY_AND_ASSIGN(Event);
};
} // namespace gin_helper

View File

@@ -38,6 +38,10 @@ class FrameSubscriber : public content::WebContentsObserver,
bool only_dirty);
~FrameSubscriber() override;
// disable copy
FrameSubscriber(const FrameSubscriber&) = delete;
FrameSubscriber& operator=(const FrameSubscriber&) = delete;
private:
void AttachToHost(content::RenderWidgetHost* host);
void DetachFromHost();
@@ -69,8 +73,6 @@ class FrameSubscriber : public content::WebContentsObserver,
std::unique_ptr<viz::ClientFrameSinkVideoCapturer> video_capturer_;
base::WeakPtrFactory<FrameSubscriber> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(FrameSubscriber);
};
} // namespace api

View File

@@ -22,6 +22,11 @@ class GPUInfoManager : public content::GpuDataManagerObserver {
GPUInfoManager();
~GPUInfoManager() override;
// disable copy
GPUInfoManager(const GPUInfoManager&) = delete;
GPUInfoManager& operator=(const GPUInfoManager&) = delete;
bool NeedsCompleteGpuInfoCollection() const;
void FetchCompleteInfo(gin_helper::Promise<base::DictionaryValue> promise);
void FetchBasicInfo(gin_helper::Promise<base::DictionaryValue> promise);
@@ -40,8 +45,6 @@ class GPUInfoManager : public content::GpuDataManagerObserver {
std::vector<gin_helper::Promise<base::DictionaryValue>>
complete_info_promise_set_;
content::GpuDataManagerImpl* gpu_data_manager_;
DISALLOW_COPY_AND_ASSIGN(GPUInfoManager);
};
} // namespace electron

View File

@@ -30,9 +30,6 @@ class ImageView : public View {
views::ImageView* image_view() const {
return static_cast<views::ImageView*>(view());
}
private:
DISALLOW_COPY_AND_ASSIGN(ImageView);
};
} // namespace api

View File

@@ -8,7 +8,6 @@
#include <map>
#include <string>
#include "base/macros.h"
#include "build/build_config.h"
namespace base {
@@ -53,6 +52,12 @@ class AutoUpdater {
public:
typedef std::map<std::string, std::string> HeaderMap;
AutoUpdater() = delete;
// disable copy
AutoUpdater(const AutoUpdater&) = delete;
AutoUpdater& operator=(const AutoUpdater&) = delete;
// Gets/Sets the delegate.
static Delegate* GetDelegate();
static void SetDelegate(Delegate* delegate);
@@ -67,8 +72,6 @@ class AutoUpdater {
private:
static Delegate* delegate_;
DISALLOW_IMPLICIT_CONSTRUCTORS(AutoUpdater);
};
} // namespace auto_updater

View File

@@ -8,7 +8,6 @@
#include <memory>
#include <string>
#include "base/macros.h"
#include "components/keyed_service/core/keyed_service.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
@@ -32,6 +31,10 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService {
BadgeManager();
~BadgeManager() override;
// disable copy
BadgeManager(const BadgeManager&) = delete;
BadgeManager& operator=(const BadgeManager&) = delete;
static void BindFrameReceiver(
content::RenderFrameHost* frame,
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
@@ -98,8 +101,6 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService {
// Delegate which handles actual setting and clearing of the badge.
// Note: This is currently only set on Windows and MacOS.
// std::unique_ptr<BadgeManagerDelegate> delegate_;
DISALLOW_COPY_AND_ASSIGN(BadgeManager);
};
} // namespace badging

View File

@@ -5,7 +5,6 @@
#ifndef SHELL_BROWSER_BADGING_BADGE_MANAGER_FACTORY_H_
#define SHELL_BROWSER_BADGING_BADGE_MANAGER_FACTORY_H_
#include "base/macros.h"
#include "components/keyed_service/content/browser_context_keyed_service_factory.h"
namespace base {
@@ -26,6 +25,10 @@ class BadgeManagerFactory : public BrowserContextKeyedServiceFactory {
// Returns the BadgeManagerFactory singleton.
static BadgeManagerFactory* GetInstance();
// disable copy
BadgeManagerFactory(const BadgeManagerFactory&) = delete;
BadgeManagerFactory& operator=(const BadgeManagerFactory&) = delete;
private:
friend struct base::DefaultSingletonTraits<BadgeManagerFactory>;
@@ -35,8 +38,6 @@ class BadgeManagerFactory : public BrowserContextKeyedServiceFactory {
// BrowserContextKeyedServiceFactory
KeyedService* BuildServiceInstanceFor(
content::BrowserContext* context) const override;
DISALLOW_COPY_AND_ASSIGN(BadgeManagerFactory);
};
} // namespace badging

View File

@@ -10,7 +10,6 @@
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/observer_list.h"
#include "base/task/cancelable_task_tracker.h"
#include "base/values.h"
@@ -47,6 +46,10 @@ class Browser : public WindowListObserver {
Browser();
~Browser() override;
// disable copy
Browser(const Browser&) = delete;
Browser& operator=(const Browser&) = delete;
static Browser* Get();
// Try to close all windows and quit the application.
@@ -371,8 +374,6 @@ class Browser : public WindowListObserver {
// In charge of running taskbar related APIs.
TaskbarHost taskbar_host_;
#endif
DISALLOW_COPY_AND_ASSIGN(Browser);
};
} // namespace electron

View File

@@ -14,7 +14,6 @@
#include <string>
#include "base/command_line.h"
#include "base/macros.h"
#include "chrome/browser/browser_process.h"
#include "components/prefs/pref_service.h"
#include "components/prefs/value_map_pref_store.h"
@@ -36,6 +35,10 @@ class BrowserProcessImpl : public BrowserProcess {
BrowserProcessImpl();
~BrowserProcessImpl() override;
// disable copy
BrowserProcessImpl(const BrowserProcessImpl&) = delete;
BrowserProcessImpl& operator=(const BrowserProcessImpl&) = delete;
static void ApplyProxyModeFromCommandLine(ValueMapPrefStore* pref_store);
BuildState* GetBuildState() override;
@@ -109,8 +112,6 @@ class BrowserProcessImpl : public BrowserProcess {
#endif
std::unique_ptr<PrefService> local_state_;
std::string locale_;
DISALLOW_COPY_AND_ASSIGN(BrowserProcessImpl);
};
#endif // SHELL_BROWSER_BROWSER_PROCESS_IMPL_H_

View File

@@ -17,6 +17,10 @@ struct ChildWebContentsTracker
: public content::WebContentsUserData<ChildWebContentsTracker> {
~ChildWebContentsTracker() override;
// disable copy
ChildWebContentsTracker(const ChildWebContentsTracker&) = delete;
ChildWebContentsTracker& operator=(const ChildWebContentsTracker&) = delete;
GURL url;
std::string frame_name;
content::Referrer referrer;
@@ -28,8 +32,6 @@ struct ChildWebContentsTracker
friend class content::WebContentsUserData<ChildWebContentsTracker>;
WEB_CONTENTS_USER_DATA_KEY_DECL();
DISALLOW_COPY_AND_ASSIGN(ChildWebContentsTracker);
};
} // namespace electron

View File

@@ -6,7 +6,6 @@
#define SHELL_BROWSER_COOKIE_CHANGE_NOTIFIER_H_
#include "base/callback_list.h"
#include "base/macros.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "net/cookies/cookie_change_dispatcher.h"
#include "services/network/public/mojom/cookie_manager.mojom.h"
@@ -21,6 +20,10 @@ class CookieChangeNotifier : public network::mojom::CookieChangeListener {
explicit CookieChangeNotifier(ElectronBrowserContext* browser_context);
~CookieChangeNotifier() override;
// disable copy
CookieChangeNotifier(const CookieChangeNotifier&) = delete;
CookieChangeNotifier& operator=(const CookieChangeNotifier&) = delete;
// Register callbacks that needs to notified on any cookie store changes.
base::CallbackListSubscription RegisterCookieChangeCallback(
const base::RepeatingCallback<void(const net::CookieChangeInfo& change)>&
@@ -38,8 +41,6 @@ class CookieChangeNotifier : public network::mojom::CookieChangeListener {
cookie_change_sub_list_;
mojo::Receiver<network::mojom::CookieChangeListener> receiver_;
DISALLOW_COPY_AND_ASSIGN(CookieChangeNotifier);
};
} // namespace electron

View File

@@ -31,6 +31,7 @@
#include "chrome/common/chrome_version.h"
#include "components/net_log/chrome_net_log.h"
#include "components/network_hints/common/network_hints.mojom.h"
#include "content/browser/keyboard_lock/keyboard_lock_service_impl.h" // nogncheck
#include "content/browser/site_instance_impl.h" // nogncheck
#include "content/public/browser/browser_main_runner.h"
#include "content/public/browser/browser_ppapi_host.h"
@@ -1145,6 +1146,10 @@ class FileURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
return pending_remote;
}
// disable copy
FileURLLoaderFactory(const FileURLLoaderFactory&) = delete;
FileURLLoaderFactory& operator=(const FileURLLoaderFactory&) = delete;
private:
explicit FileURLLoaderFactory(
int child_id,
@@ -1176,8 +1181,6 @@ class FileURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
}
int child_id_;
DISALLOW_COPY_AND_ASSIGN(FileURLLoaderFactory);
};
} // namespace
@@ -1571,6 +1574,8 @@ void ElectronBrowserClient::RegisterBrowserInterfaceBindersForFrame(
base::BindRepeating(&badging::BadgeManager::BindFrameReceiver));
map->Add<electron::mojom::ElectronBrowser>(
base::BindRepeating(&BindElectronBrowser));
map->Add<blink::mojom::KeyboardLockService>(base::BindRepeating(
&content::KeyboardLockServiceImpl::CreateMojoService));
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
map->Add<extensions::mime_handler::MimeHandlerService>(
base::BindRepeating(&BindMimeHandlerService));

View File

@@ -49,6 +49,10 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
ElectronBrowserClient();
~ElectronBrowserClient() override;
// disable copy
ElectronBrowserClient(const ElectronBrowserClient&) = delete;
ElectronBrowserClient& operator=(const ElectronBrowserClient&) = delete;
using Delegate = content::ContentBrowserClient;
void set_delegate(Delegate* delegate) { delegate_ = delegate; }
@@ -318,8 +322,6 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
#if defined(OS_MAC)
ElectronBrowserMainParts* browser_main_parts_ = nullptr;
#endif
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserClient);
};
} // namespace electron

View File

@@ -48,6 +48,10 @@ class ProtocolRegistry;
class ElectronBrowserContext : public content::BrowserContext {
public:
// disable copy
ElectronBrowserContext(const ElectronBrowserContext&) = delete;
ElectronBrowserContext& operator=(const ElectronBrowserContext&) = delete;
// partition_id => browser_context
struct PartitionKey {
std::string partition;
@@ -184,8 +188,6 @@ class ElectronBrowserContext : public content::BrowserContext {
mojo::Remote<network::mojom::SSLConfigClient> ssl_config_client_;
base::WeakPtrFactory<ElectronBrowserContext> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserContext);
};
} // namespace electron

View File

@@ -8,7 +8,6 @@
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "content/public/browser/web_contents_observer.h"
#include "electron/shell/common/api/api.mojom.h"
@@ -29,6 +28,11 @@ class ElectronBrowserHandlerImpl : public mojom::ElectronBrowser,
static void Create(content::RenderFrameHost* frame_host,
mojo::PendingReceiver<mojom::ElectronBrowser> receiver);
// disable copy
ElectronBrowserHandlerImpl(const ElectronBrowserHandlerImpl&) = delete;
ElectronBrowserHandlerImpl& operator=(const ElectronBrowserHandlerImpl&) =
delete;
// mojom::ElectronBrowser:
void Message(bool internal,
const std::string& channel,
@@ -74,8 +78,6 @@ class ElectronBrowserHandlerImpl : public mojom::ElectronBrowser,
mojo::Receiver<mojom::ElectronBrowser> receiver_{this};
base::WeakPtrFactory<ElectronBrowserHandlerImpl> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserHandlerImpl);
};
} // namespace electron
#endif // SHELL_BROWSER_ELECTRON_BROWSER_HANDLER_IMPL_H_

View File

@@ -76,6 +76,10 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
explicit ElectronBrowserMainParts(const content::MainFunctionParams& params);
~ElectronBrowserMainParts() override;
// disable copy
ElectronBrowserMainParts(const ElectronBrowserMainParts&) = delete;
ElectronBrowserMainParts& operator=(const ElectronBrowserMainParts&) = delete;
static ElectronBrowserMainParts* Get();
// Sets the exit code, will fail if the message loop is not ready.
@@ -175,8 +179,6 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
#endif
static ElectronBrowserMainParts* self_;
DISALLOW_COPY_AND_ASSIGN(ElectronBrowserMainParts);
};
} // namespace electron

View File

@@ -84,6 +84,10 @@ class ShutdownDetector : public base::PlatformThread::Delegate {
base::OnceCallback<void()> shutdown_callback,
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner);
// disable copy
ShutdownDetector(const ShutdownDetector&) = delete;
ShutdownDetector& operator=(const ShutdownDetector&) = delete;
// base::PlatformThread::Delegate:
void ThreadMain() override;
@@ -91,8 +95,6 @@ class ShutdownDetector : public base::PlatformThread::Delegate {
const int shutdown_fd_;
base::OnceCallback<void()> shutdown_callback_;
const scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
DISALLOW_COPY_AND_ASSIGN(ShutdownDetector);
};
ShutdownDetector::ShutdownDetector(

View File

@@ -9,6 +9,7 @@
#include "base/bind.h"
#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "chrome/common/pref_names.h"

View File

@@ -25,6 +25,12 @@ class ElectronDownloadManagerDelegate
explicit ElectronDownloadManagerDelegate(content::DownloadManager* manager);
~ElectronDownloadManagerDelegate() override;
// disable copy
ElectronDownloadManagerDelegate(const ElectronDownloadManagerDelegate&) =
delete;
ElectronDownloadManagerDelegate& operator=(
const ElectronDownloadManagerDelegate&) = delete;
// content::DownloadManagerDelegate:
void Shutdown() override;
bool DetermineDownloadTarget(
@@ -54,8 +60,6 @@ class ElectronDownloadManagerDelegate
content::DownloadManager* download_manager_;
base::WeakPtrFactory<ElectronDownloadManagerDelegate> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ElectronDownloadManagerDelegate);
};
} // namespace electron

View File

@@ -13,11 +13,12 @@ class ElectronGpuClient : public content::ContentGpuClient {
public:
ElectronGpuClient();
// disable copy
ElectronGpuClient(const ElectronGpuClient&) = delete;
ElectronGpuClient& operator=(const ElectronGpuClient&) = delete;
// content::ContentGpuClient:
void PreCreateMessageLoop() override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronGpuClient);
};
} // namespace electron

View File

@@ -14,15 +14,17 @@ class ElectronNavigationThrottle : public content::NavigationThrottle {
explicit ElectronNavigationThrottle(content::NavigationHandle* handle);
~ElectronNavigationThrottle() override;
// disable copy
ElectronNavigationThrottle(const ElectronNavigationThrottle&) = delete;
ElectronNavigationThrottle& operator=(const ElectronNavigationThrottle&) =
delete;
ElectronNavigationThrottle::ThrottleCheckResult WillStartRequest() override;
ElectronNavigationThrottle::ThrottleCheckResult WillRedirectRequest()
override;
const char* GetNameForLogging() override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronNavigationThrottle);
};
} // namespace electron

View File

@@ -29,6 +29,11 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
ElectronPermissionManager();
~ElectronPermissionManager() override;
// disable copy
ElectronPermissionManager(const ElectronPermissionManager&) = delete;
ElectronPermissionManager& operator=(const ElectronPermissionManager&) =
delete;
using StatusCallback =
base::OnceCallback<void(blink::mojom::PermissionStatus)>;
using StatusesCallback = base::OnceCallback<void(
@@ -126,8 +131,6 @@ class ElectronPermissionManager : public content::PermissionControllerDelegate {
DeviceCheckHandler device_permission_handler_;
PendingRequestsMap pending_requests_;
DISALLOW_COPY_AND_ASSIGN(ElectronPermissionManager);
};
} // namespace electron

View File

@@ -19,6 +19,12 @@ class ElectronQuotaPermissionContext : public content::QuotaPermissionContext {
ElectronQuotaPermissionContext();
// disable copy
ElectronQuotaPermissionContext(const ElectronQuotaPermissionContext&) =
delete;
ElectronQuotaPermissionContext& operator=(
const ElectronQuotaPermissionContext&) = delete;
// content::QuotaPermissionContext:
void RequestQuotaPermission(const content::StorageQuotaParams& params,
int render_process_id,
@@ -26,8 +32,6 @@ class ElectronQuotaPermissionContext : public content::QuotaPermissionContext {
private:
~ElectronQuotaPermissionContext() override;
DISALLOW_COPY_AND_ASSIGN(ElectronQuotaPermissionContext);
};
} // namespace electron

View File

@@ -7,7 +7,6 @@
#include <vector>
#include "base/macros.h"
#include "content/public/browser/speech_recognition_event_listener.h"
#include "content/public/browser/speech_recognition_manager_delegate.h"
@@ -20,6 +19,12 @@ class ElectronSpeechRecognitionManagerDelegate
ElectronSpeechRecognitionManagerDelegate();
~ElectronSpeechRecognitionManagerDelegate() override;
// disable copy
ElectronSpeechRecognitionManagerDelegate(
const ElectronSpeechRecognitionManagerDelegate&) = delete;
ElectronSpeechRecognitionManagerDelegate& operator=(
const ElectronSpeechRecognitionManagerDelegate&) = delete;
// content::SpeechRecognitionEventListener:
void OnRecognitionStart(int session_id) override;
void OnAudioStart(int session_id) override;
@@ -45,9 +50,6 @@ class ElectronSpeechRecognitionManagerDelegate
override;
content::SpeechRecognitionEventListener* GetEventListener() override;
bool FilterProfanities(int render_process_id) override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronSpeechRecognitionManagerDelegate);
};
} // namespace electron

View File

@@ -7,7 +7,6 @@
#include <memory>
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "content/public/browser/web_ui_controller_factory.h"
@@ -24,6 +23,12 @@ class ElectronWebUIControllerFactory : public content::WebUIControllerFactory {
ElectronWebUIControllerFactory();
~ElectronWebUIControllerFactory() override;
// disable copy
ElectronWebUIControllerFactory(const ElectronWebUIControllerFactory&) =
delete;
ElectronWebUIControllerFactory& operator=(
const ElectronWebUIControllerFactory&) = delete;
// content::WebUIControllerFactory:
content::WebUI::TypeID GetWebUIType(content::BrowserContext* browser_context,
const GURL& url) override;
@@ -35,8 +40,6 @@ class ElectronWebUIControllerFactory : public content::WebUIControllerFactory {
private:
friend struct base::DefaultSingletonTraits<ElectronWebUIControllerFactory>;
DISALLOW_COPY_AND_ASSIGN(ElectronWebUIControllerFactory);
};
} // namespace electron

View File

@@ -20,6 +20,10 @@ v8::Local<v8::FunctionTemplate> GetEventEmitterTemplate(v8::Isolate* isolate);
template <typename T>
class EventEmitterMixin {
public:
// disable copy
EventEmitterMixin(const EventEmitterMixin&) = delete;
EventEmitterMixin& operator=(const EventEmitterMixin&) = delete;
// this.emit(name, new Event(), args...);
// Returns true if event.preventDefault() was called during processing.
template <typename... Args>
@@ -87,8 +91,6 @@ class EventEmitterMixin {
}
return false;
}
DISALLOW_COPY_AND_ASSIGN(EventEmitterMixin);
};
} // namespace gin_helper

View File

@@ -10,7 +10,6 @@
#include <utility>
#include "base/bind.h"
#include "base/macros.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
@@ -44,11 +43,15 @@ class ManagementSetEnabledFunctionInstallPromptDelegate
}
~ManagementSetEnabledFunctionInstallPromptDelegate() override = default;
// disable copy
ManagementSetEnabledFunctionInstallPromptDelegate(
const ManagementSetEnabledFunctionInstallPromptDelegate&) = delete;
ManagementSetEnabledFunctionInstallPromptDelegate& operator=(
const ManagementSetEnabledFunctionInstallPromptDelegate&) = delete;
private:
base::WeakPtrFactory<ManagementSetEnabledFunctionInstallPromptDelegate>
weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ManagementSetEnabledFunctionInstallPromptDelegate);
};
class ManagementUninstallFunctionUninstallDialogDelegate
@@ -63,8 +66,11 @@ class ManagementUninstallFunctionUninstallDialogDelegate
~ManagementUninstallFunctionUninstallDialogDelegate() override = default;
private:
DISALLOW_COPY_AND_ASSIGN(ManagementUninstallFunctionUninstallDialogDelegate);
// disable copy
ManagementUninstallFunctionUninstallDialogDelegate(
const ManagementUninstallFunctionUninstallDialogDelegate&) = delete;
ManagementUninstallFunctionUninstallDialogDelegate& operator=(
const ManagementUninstallFunctionUninstallDialogDelegate&) = delete;
};
} // namespace

View File

@@ -5,7 +5,6 @@
#ifndef SHELL_BROWSER_EXTENSIONS_API_RESOURCES_PRIVATE_RESOURCES_PRIVATE_API_H_
#define SHELL_BROWSER_EXTENSIONS_API_RESOURCES_PRIVATE_RESOURCES_PRIVATE_API_H_
#include "base/macros.h"
#include "extensions/browser/extension_function.h"
namespace extensions {
@@ -16,14 +15,17 @@ class ResourcesPrivateGetStringsFunction : public ExtensionFunction {
RESOURCESPRIVATE_GETSTRINGS)
ResourcesPrivateGetStringsFunction();
// disable copy
ResourcesPrivateGetStringsFunction(
const ResourcesPrivateGetStringsFunction&) = delete;
ResourcesPrivateGetStringsFunction& operator=(
const ResourcesPrivateGetStringsFunction&) = delete;
protected:
~ResourcesPrivateGetStringsFunction() override;
// Override from ExtensionFunction:
ExtensionFunction::ResponseAction Run() override;
private:
DISALLOW_COPY_AND_ASSIGN(ResourcesPrivateGetStringsFunction);
};
} // namespace extensions

View File

@@ -7,7 +7,6 @@
#include <string>
#include "base/macros.h"
#include "extensions/browser/api/runtime/runtime_api_delegate.h"
namespace content {
@@ -21,6 +20,11 @@ class ElectronRuntimeAPIDelegate : public RuntimeAPIDelegate {
explicit ElectronRuntimeAPIDelegate(content::BrowserContext* browser_context);
~ElectronRuntimeAPIDelegate() override;
// disable copy
ElectronRuntimeAPIDelegate(const ElectronRuntimeAPIDelegate&) = delete;
ElectronRuntimeAPIDelegate& operator=(const ElectronRuntimeAPIDelegate&) =
delete;
// RuntimeAPIDelegate implementation.
void AddUpdateObserver(UpdateObserver* observer) override;
void RemoveUpdateObserver(UpdateObserver* observer) override;
@@ -33,8 +37,6 @@ class ElectronRuntimeAPIDelegate : public RuntimeAPIDelegate {
private:
content::BrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(ElectronRuntimeAPIDelegate);
};
} // namespace extensions

View File

@@ -7,7 +7,6 @@
#include <string>
#include "base/macros.h"
#include "third_party/blink/public/mojom/loader/transferrable_url_loader.mojom.h"
namespace extensions {

View File

@@ -11,7 +11,6 @@
#include <string>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "extensions/browser/component_extension_resource_manager.h"
#include "ui/base/webui/resource_path.h"
@@ -25,6 +24,12 @@ class ElectronComponentExtensionResourceManager
ElectronComponentExtensionResourceManager();
~ElectronComponentExtensionResourceManager() override;
// disable copy
ElectronComponentExtensionResourceManager(
const ElectronComponentExtensionResourceManager&) = delete;
ElectronComponentExtensionResourceManager& operator=(
const ElectronComponentExtensionResourceManager&) = delete;
// Overridden from ComponentExtensionResourceManager:
bool IsComponentExtensionResource(const base::FilePath& extension_path,
const base::FilePath& resource_path,
@@ -43,8 +48,6 @@ class ElectronComponentExtensionResourceManager
// A map from an extension ID to its i18n template replacements.
std::map<std::string, ui::TemplateReplacements>
extension_template_replacements_;
DISALLOW_COPY_AND_ASSIGN(ElectronComponentExtensionResourceManager);
};
} // namespace extensions

View File

@@ -5,7 +5,6 @@
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_DISPLAY_INFO_PROVIDER_H_
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_DISPLAY_INFO_PROVIDER_H_
#include "base/macros.h"
#include "extensions/browser/api/system_display/display_info_provider.h"
namespace extensions {
@@ -14,8 +13,10 @@ class ElectronDisplayInfoProvider : public DisplayInfoProvider {
public:
ElectronDisplayInfoProvider();
private:
DISALLOW_COPY_AND_ASSIGN(ElectronDisplayInfoProvider);
// disable copy
ElectronDisplayInfoProvider(const ElectronDisplayInfoProvider&) = delete;
ElectronDisplayInfoProvider& operator=(const ElectronDisplayInfoProvider&) =
delete;
};
} // namespace extensions

View File

@@ -8,7 +8,6 @@
#include <memory>
#include <string>
#include "base/macros.h"
#include "extensions/browser/extension_host_delegate.h"
namespace extensions {
@@ -19,6 +18,11 @@ class ElectronExtensionHostDelegate : public ExtensionHostDelegate {
ElectronExtensionHostDelegate();
~ElectronExtensionHostDelegate() override;
// disable copy
ElectronExtensionHostDelegate(const ElectronExtensionHostDelegate&) = delete;
ElectronExtensionHostDelegate& operator=(
const ElectronExtensionHostDelegate&) = delete;
// ExtensionHostDelegate implementation.
void OnExtensionHostCreated(content::WebContents* web_contents) override;
void OnMainFrameCreatedForBackgroundPage(ExtensionHost* host) override;
@@ -41,9 +45,6 @@ class ElectronExtensionHostDelegate : public ExtensionHostDelegate {
const viz::SurfaceId& surface_id,
const gfx::Size& natural_size) override;
void ExitPictureInPicture() override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionHostDelegate);
};
} // namespace extensions

View File

@@ -9,7 +9,6 @@
#include <utility>
#include "base/callback.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "extensions/browser/extension_registrar.h"
@@ -33,6 +32,10 @@ class ElectronExtensionLoader : public ExtensionRegistrar::Delegate {
explicit ElectronExtensionLoader(content::BrowserContext* browser_context);
~ElectronExtensionLoader() override;
// disable copy
ElectronExtensionLoader(const ElectronExtensionLoader&) = delete;
ElectronExtensionLoader& operator=(const ElectronExtensionLoader&) = delete;
// Loads an unpacked extension from a directory synchronously. Returns the
// extension on success, or nullptr otherwise.
void LoadExtension(const base::FilePath& extension_dir,
@@ -91,8 +94,6 @@ class ElectronExtensionLoader : public ExtensionRegistrar::Delegate {
bool did_schedule_reload_ = false;
base::WeakPtrFactory<ElectronExtensionLoader> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionLoader);
};
} // namespace extensions

View File

@@ -8,7 +8,6 @@
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/sequenced_task_runner_helpers.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
@@ -31,6 +30,12 @@ class ElectronExtensionMessageFilter : public content::BrowserMessageFilter {
ElectronExtensionMessageFilter(int render_process_id,
content::BrowserContext* browser_context);
// disable copy
ElectronExtensionMessageFilter(const ElectronExtensionMessageFilter&) =
delete;
ElectronExtensionMessageFilter& operator=(
const ElectronExtensionMessageFilter&) = delete;
// content::BrowserMessageFilter methods:
bool OnMessageReceived(const IPC::Message& message) override;
void OverrideThreadForMessage(const IPC::Message& message,
@@ -59,8 +64,6 @@ class ElectronExtensionMessageFilter : public content::BrowserMessageFilter {
// may outlive |browser_context_|, so make sure to NULL check if in doubt;
// async calls and the like.
content::BrowserContext* browser_context_;
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionMessageFilter);
};
} // namespace electron

View File

@@ -9,7 +9,6 @@
#include <string>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/one_shot_event.h"
@@ -38,6 +37,10 @@ class ElectronExtensionSystem : public ExtensionSystem {
explicit ElectronExtensionSystem(content::BrowserContext* browser_context);
~ElectronExtensionSystem() override;
// disable copy
ElectronExtensionSystem(const ElectronExtensionSystem&) = delete;
ElectronExtensionSystem& operator=(const ElectronExtensionSystem&) = delete;
// Loads an unpacked extension from a directory. Returns the extension on
// success, or nullptr otherwise.
void LoadExtension(
@@ -115,8 +118,6 @@ class ElectronExtensionSystem : public ExtensionSystem {
base::OneShotEvent ready_;
base::WeakPtrFactory<ElectronExtensionSystem> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionSystem);
};
} // namespace extensions

View File

@@ -5,7 +5,6 @@
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_FACTORY_H_
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_SYSTEM_FACTORY_H_
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "extensions/browser/extension_system_provider.h"
@@ -20,6 +19,12 @@ class ElectronExtensionSystemFactory : public ExtensionSystemProvider {
static ElectronExtensionSystemFactory* GetInstance();
// disable copy
ElectronExtensionSystemFactory(const ElectronExtensionSystemFactory&) =
delete;
ElectronExtensionSystemFactory& operator=(
const ElectronExtensionSystemFactory&) = delete;
private:
friend struct base::DefaultSingletonTraits<ElectronExtensionSystemFactory>;
@@ -32,8 +37,6 @@ class ElectronExtensionSystemFactory : public ExtensionSystemProvider {
content::BrowserContext* GetBrowserContextToUse(
content::BrowserContext* context) const override;
bool ServiceIsCreatedWithBrowserContext() const override;
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionSystemFactory);
};
} // namespace extensions

View File

@@ -5,7 +5,6 @@
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSION_WEB_CONTENTS_OBSERVER_H_
#include "base/macros.h"
#include "content/public/browser/web_contents_user_data.h"
#include "extensions/browser/extension_web_contents_observer.h"
@@ -19,6 +18,12 @@ class ElectronExtensionWebContentsObserver
public:
~ElectronExtensionWebContentsObserver() override;
// disable copy
ElectronExtensionWebContentsObserver(
const ElectronExtensionWebContentsObserver&) = delete;
ElectronExtensionWebContentsObserver& operator=(
const ElectronExtensionWebContentsObserver&) = delete;
// Creates and initializes an instance of this class for the given
// |web_contents|, if it doesn't already exist.
static void CreateForWebContents(content::WebContents* web_contents);
@@ -31,8 +36,6 @@ class ElectronExtensionWebContentsObserver
content::WebContents* web_contents);
WEB_CONTENTS_USER_DATA_KEY_DECL();
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionWebContentsObserver);
};
} // namespace extensions

View File

@@ -37,15 +37,18 @@ class ElectronGuestViewManagerDelegate
: ExtensionsGuestViewManagerDelegate(context) {}
~ElectronGuestViewManagerDelegate() override = default;
// disable copy
ElectronGuestViewManagerDelegate(const ElectronGuestViewManagerDelegate&) =
delete;
ElectronGuestViewManagerDelegate& operator=(
const ElectronGuestViewManagerDelegate&) = delete;
// GuestViewManagerDelegate:
void OnGuestAdded(content::WebContents* guest_web_contents) const override {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope scope(isolate);
electron::api::WebContents::FromOrCreate(isolate, guest_web_contents);
}
private:
DISALLOW_COPY_AND_ASSIGN(ElectronGuestViewManagerDelegate);
};
class ElectronMimeHandlerViewGuestDelegate
@@ -54,6 +57,12 @@ class ElectronMimeHandlerViewGuestDelegate
ElectronMimeHandlerViewGuestDelegate() = default;
~ElectronMimeHandlerViewGuestDelegate() override = default;
// disable copy
ElectronMimeHandlerViewGuestDelegate(
const ElectronMimeHandlerViewGuestDelegate&) = delete;
ElectronMimeHandlerViewGuestDelegate& operator=(
const ElectronMimeHandlerViewGuestDelegate&) = delete;
// MimeHandlerViewGuestDelegate.
bool HandleContextMenu(content::WebContents* web_contents,
const content::ContextMenuParams& params) override {
@@ -63,9 +72,6 @@ class ElectronMimeHandlerViewGuestDelegate
}
void RecordLoadMetric(bool in_main_frame,
const std::string& mime_type) override {}
private:
DISALLOW_COPY_AND_ASSIGN(ElectronMimeHandlerViewGuestDelegate);
};
ElectronExtensionsAPIClient::ElectronExtensionsAPIClient() = default;

View File

@@ -5,7 +5,6 @@
#ifndef SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_API_PROVIDER_H_
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_EXTENSIONS_BROWSER_API_PROVIDER_H_
#include "base/macros.h"
#include "extensions/browser/extensions_browser_api_provider.h"
namespace extensions {
@@ -16,10 +15,13 @@ class ElectronExtensionsBrowserAPIProvider
ElectronExtensionsBrowserAPIProvider();
~ElectronExtensionsBrowserAPIProvider() override;
void RegisterExtensionFunctions(ExtensionFunctionRegistry* registry) override;
// disable copy
ElectronExtensionsBrowserAPIProvider(
const ElectronExtensionsBrowserAPIProvider&) = delete;
ElectronExtensionsBrowserAPIProvider& operator=(
const ElectronExtensionsBrowserAPIProvider&) = delete;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionsBrowserAPIProvider);
void RegisterExtensionFunctions(ExtensionFunctionRegistry* registry) override;
};
} // namespace extensions

View File

@@ -10,7 +10,6 @@
#include <vector>
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "build/build_config.h"
#include "extensions/browser/extensions_browser_client.h"
#include "extensions/browser/kiosk/kiosk_delegate.h"
@@ -39,6 +38,12 @@ class ElectronExtensionsBrowserClient
ElectronExtensionsBrowserClient();
~ElectronExtensionsBrowserClient() override;
// disable copy
ElectronExtensionsBrowserClient(const ElectronExtensionsBrowserClient&) =
delete;
ElectronExtensionsBrowserClient& operator=(
const ElectronExtensionsBrowserClient&) = delete;
// ExtensionsBrowserClient overrides:
bool IsShuttingDown() override;
bool AreExtensionsDisabled(const base::CommandLine& command_line,
@@ -138,8 +143,6 @@ class ElectronExtensionsBrowserClient
std::unique_ptr<extensions::ElectronComponentExtensionResourceManager>
resource_manager_;
DISALLOW_COPY_AND_ASSIGN(ElectronExtensionsBrowserClient);
};
} // namespace electron

View File

@@ -18,6 +18,11 @@ class ElectronMessagingDelegate : public MessagingDelegate {
ElectronMessagingDelegate();
~ElectronMessagingDelegate() override;
// disable copy
ElectronMessagingDelegate(const ElectronMessagingDelegate&) = delete;
ElectronMessagingDelegate& operator=(const ElectronMessagingDelegate&) =
delete;
// MessagingDelegate:
PolicyPermission IsNativeMessagingHostAllowed(
content::BrowserContext* browser_context,
@@ -48,9 +53,6 @@ class ElectronMessagingDelegate : public MessagingDelegate {
content::WebContents* source_contents,
const GURL& url,
base::OnceCallback<void(bool)> callback) override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronMessagingDelegate);
};
} // namespace extensions

View File

@@ -7,7 +7,6 @@
#include <memory>
#include "base/macros.h"
#include "content/public/browser/navigation_ui_data.h"
#include "extensions/browser/extension_navigation_ui_data.h"
@@ -25,6 +24,10 @@ class ElectronNavigationUIData : public content::NavigationUIData {
content::NavigationHandle* navigation_handle);
~ElectronNavigationUIData() override;
// disable copy
ElectronNavigationUIData(const ElectronNavigationUIData&) = delete;
ElectronNavigationUIData& operator=(const ElectronNavigationUIData&) = delete;
// Creates a new ChromeNavigationUIData that is a deep copy of the original.
// Any changes to the original after the clone is created will not be
// reflected in the clone. |extension_data_| is deep copied.
@@ -40,8 +43,6 @@ class ElectronNavigationUIData : public content::NavigationUIData {
private:
// Manages the lifetime of optional ExtensionNavigationUIData information.
std::unique_ptr<ExtensionNavigationUIData> extension_data_;
DISALLOW_COPY_AND_ASSIGN(ElectronNavigationUIData);
};
} // namespace extensions

View File

@@ -6,7 +6,6 @@
#define SHELL_BROWSER_EXTENSIONS_ELECTRON_PROCESS_MANAGER_DELEGATE_H_
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "extensions/browser/process_manager_delegate.h"
@@ -23,6 +22,12 @@ class ElectronProcessManagerDelegate : public ProcessManagerDelegate {
ElectronProcessManagerDelegate();
~ElectronProcessManagerDelegate() override;
// disable copy
ElectronProcessManagerDelegate(const ElectronProcessManagerDelegate&) =
delete;
ElectronProcessManagerDelegate& operator=(
const ElectronProcessManagerDelegate&) = delete;
// ProcessManagerDelegate implementation:
bool AreBackgroundPagesAllowedForContext(
content::BrowserContext* context) const override;
@@ -31,9 +36,6 @@ class ElectronProcessManagerDelegate : public ProcessManagerDelegate {
const Extension& extension) const override;
bool DeferCreatingStartupBackgroundHosts(
content::BrowserContext* context) const override;
private:
DISALLOW_COPY_AND_ASSIGN(ElectronProcessManagerDelegate);
};
} // namespace extensions

View File

@@ -5,7 +5,6 @@
#ifndef SHELL_BROWSER_FAKE_LOCATION_PROVIDER_H_
#define SHELL_BROWSER_FAKE_LOCATION_PROVIDER_H_
#include "base/macros.h"
#include "services/device/public/cpp/geolocation/location_provider.h"
#include "services/device/public/mojom/geoposition.mojom.h"
@@ -16,6 +15,10 @@ class FakeLocationProvider : public device::LocationProvider {
FakeLocationProvider();
~FakeLocationProvider() override;
// disable copy
FakeLocationProvider(const FakeLocationProvider&) = delete;
FakeLocationProvider& operator=(const FakeLocationProvider&) = delete;
// LocationProvider Implementation:
void SetUpdateCallback(
const LocationProviderUpdateCallback& callback) override;
@@ -27,8 +30,6 @@ class FakeLocationProvider : public device::LocationProvider {
private:
device::mojom::Geoposition position_;
LocationProviderUpdateCallback callback_;
DISALLOW_COPY_AND_ASSIGN(FakeLocationProvider);
};
} // namespace electron

Some files were not shown because too many files have changed in this diff Show More