mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
Compare commits
7 Commits
codesign-f
...
flake-fix
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2b83114b75 | ||
|
|
cee51785e1 | ||
|
|
b253d52faf | ||
|
|
4d060afc98 | ||
|
|
8eb580e79a | ||
|
|
42087e306c | ||
|
|
2ea569e0d2 |
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-123.0.6264.0
|
||||
image: e-123.0.6272.0
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
version: 1.0.{build}
|
||||
build_cloud: electronhq-16-core
|
||||
image: e-123.0.6264.0
|
||||
image: e-123.0.6272.0
|
||||
environment:
|
||||
GIT_CACHE_PATH: C:\Users\appveyor\libcc_cache
|
||||
ELECTRON_OUT_DIR: Default
|
||||
|
||||
@@ -345,6 +345,10 @@ A `Integer` property representing the unique ID of the window. Each ID is unique
|
||||
|
||||
A `View` property for the content view of the window.
|
||||
|
||||
#### `win.tabbingIdentifier` _macOS_ _Readonly_
|
||||
|
||||
A `string` (optional) property that is equal to the `tabbingIdentifier` passed to the `BrowserWindow` constructor or `undefined` if none was set.
|
||||
|
||||
#### `win.autoHideMenuBar`
|
||||
|
||||
A `boolean` property that determines whether the window menu bar should hide itself automatically. Once set, the menu bar will only show when users press the single `Alt` key.
|
||||
@@ -519,7 +523,7 @@ Hides the window.
|
||||
|
||||
#### `win.isVisible()`
|
||||
|
||||
Returns `boolean` - Whether the window is visible to the user.
|
||||
Returns `boolean` - Whether the window is visible to the user in the foreground of the app.
|
||||
|
||||
#### `win.isModal()`
|
||||
|
||||
@@ -557,6 +561,8 @@ Returns `boolean` - Whether the window is minimized.
|
||||
|
||||
Sets whether the window should be in fullscreen mode.
|
||||
|
||||
**Note:** On macOS, fullscreen transitions take place asynchronously. If further actions depend on the fullscreen state, use the ['enter-full-screen'](base-window.md#event-enter-full-screen) or ['leave-full-screen'](base-window.md#event-leave-full-screen) events.
|
||||
|
||||
#### `win.isFullScreen()`
|
||||
|
||||
Returns `boolean` - Whether the window is in fullscreen mode.
|
||||
@@ -669,10 +675,14 @@ win.setBounds({ width: 100 })
|
||||
console.log(win.getBounds())
|
||||
```
|
||||
|
||||
**Note:** On macOS, the y-coordinate value cannot be smaller than the [Tray](tray.md) height. The tray height has changed over time and depends on the operating system, but is between 20-40px. Passing a value lower than the tray height will result in a window that is flush to the tray.
|
||||
|
||||
#### `win.getBounds()`
|
||||
|
||||
Returns [`Rectangle`](structures/rectangle.md) - The `bounds` of the window as `Object`.
|
||||
|
||||
**Note:** On macOS, the y-coordinate value returned will be at minimum the [Tray](tray.md) height. For example, calling `win.setBounds({ x: 25, y: 20, width: 800, height: 600 })` with a tray height of 38 means that `win.getBounds()` will return `{ x: 25, y: 38, width: 800, height: 600 }`.
|
||||
|
||||
#### `win.getBackgroundColor()`
|
||||
|
||||
Returns `string` - Gets the background color of the window in Hex (`#RRGGBB`) format.
|
||||
@@ -903,8 +913,8 @@ window.
|
||||
* `offsetX` Float (optional)
|
||||
|
||||
Changes the attachment point for sheets on macOS. By default, sheets are
|
||||
attached just below the window frame, but you may want to offset them. For
|
||||
example:
|
||||
attached just below the window frame, but you may want to display them beneath
|
||||
a HTML-rendered toolbar. For example:
|
||||
|
||||
```js
|
||||
const { BaseWindow } = require('electron')
|
||||
@@ -1289,6 +1299,10 @@ tabs in the window.
|
||||
Selects the next tab when native tabs are enabled and there are other
|
||||
tabs in the window.
|
||||
|
||||
#### `win.showAllTabs()` _macOS_
|
||||
|
||||
Shows or hides the tab overview when native tabs are enabled.
|
||||
|
||||
#### `win.mergeAllWindows()` _macOS_
|
||||
|
||||
Merges all windows into one window with multiple tabs when native tabs
|
||||
@@ -1312,15 +1326,26 @@ Adds a window as a tab on this window, after the tab for the window instance.
|
||||
|
||||
#### `win.setVibrancy(type)` _macOS_
|
||||
|
||||
* `type` string | null - Can be `appearance-based`, `light`, `dark`, `titlebar`,
|
||||
`selection`, `menu`, `popover`, `sidebar`, `medium-light`, `ultra-dark`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. See
|
||||
* `type` string | null - Can be `titlebar`, `selection`, `menu`, `popover`, `sidebar`, `header`, `sheet`, `window`, `hud`, `fullscreen-ui`, `tooltip`, `content`, `under-window`, or `under-page`. See
|
||||
the [macOS documentation][vibrancy-docs] for more details.
|
||||
|
||||
Adds a vibrancy effect to the window. Passing `null` or an empty string
|
||||
will remove the vibrancy effect on the window.
|
||||
|
||||
Note that `appearance-based`, `light`, `dark`, `medium-light`, and `ultra-dark` have been
|
||||
deprecated and will be removed in an upcoming version of macOS.
|
||||
#### `win.setBackgroundMaterial(material)` _Windows_
|
||||
|
||||
* `material` string
|
||||
* `auto` - Let the Desktop Window Manager (DWM) automatically decide the system-drawn backdrop material for this window. This is the default.
|
||||
* `none` - Don't draw any system backdrop.
|
||||
* `mica` - Draw the backdrop material effect corresponding to a long-lived window.
|
||||
* `acrylic` - Draw the backdrop material effect corresponding to a transient window.
|
||||
* `tabbed` - Draw the backdrop material effect corresponding to a window with a tabbed title bar.
|
||||
|
||||
This method sets the browser window's system-drawn background material, including behind the non-client area.
|
||||
|
||||
See the [Windows documentation](https://learn.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwm_systembackdrop_type) for more details.
|
||||
|
||||
**Note:** This method is only supported on Windows 11 22H2 and up.
|
||||
|
||||
#### `win.setWindowButtonPosition(position)` _macOS_
|
||||
|
||||
@@ -1334,25 +1359,6 @@ Passing `null` will reset the position to default.
|
||||
Returns `Point | null` - The custom position for the traffic light buttons in
|
||||
frameless window, `null` will be returned when there is no custom position.
|
||||
|
||||
#### `win.setTrafficLightPosition(position)` _macOS_ _Deprecated_
|
||||
|
||||
* `position` [Point](structures/point.md)
|
||||
|
||||
Set a custom position for the traffic light buttons in frameless window.
|
||||
Passing `{ x: 0, y: 0 }` will reset the position to default.
|
||||
|
||||
> **Note**
|
||||
> This function is deprecated. Use [setWindowButtonPosition](#winsetwindowbuttonpositionposition-macos) instead.
|
||||
|
||||
#### `win.getTrafficLightPosition()` _macOS_ _Deprecated_
|
||||
|
||||
Returns `Point` - The custom position for the traffic light buttons in
|
||||
frameless window, `{ x: 0, y: 0 }` will be returned when there is no custom
|
||||
position.
|
||||
|
||||
> **Note**
|
||||
> This function is deprecated. Use [getWindowButtonPosition](#wingetwindowbuttonposition-macos) instead.
|
||||
|
||||
#### `win.setTouchBar(touchBar)` _macOS_
|
||||
|
||||
* `touchBar` TouchBar | null
|
||||
|
||||
@@ -752,16 +752,16 @@ Examples of valid `backgroundColor` values:
|
||||
* #ffffff (RGB)
|
||||
* #ffffffff (ARGB)
|
||||
* RGB
|
||||
* rgb\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+)\)
|
||||
* `rgb\(([\d]+),\s*([\d]+),\s*([\d]+)\)`
|
||||
* e.g. rgb(255, 255, 255)
|
||||
* RGBA
|
||||
* rgba\((\[\d]+),\s*(\[\d]+),\s*(\[\d]+),\s*(\[\d.]+)\)
|
||||
* `rgba\(([\d]+),\s*([\d]+),\s*([\d]+),\s*([\d.]+)\)`
|
||||
* e.g. rgba(255, 255, 255, 1.0)
|
||||
* HSL
|
||||
* hsl\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%\)
|
||||
* `hsl\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%\)`
|
||||
* e.g. hsl(200, 20%, 50%)
|
||||
* HSLA
|
||||
* hsla\((-?\[\d.]+),\s*(\[\d.]+)%,\s*(\[\d.]+)%,\s*(\[\d.]+)\)
|
||||
* `hsla\((-?[\d.]+),\s*([\d.]+)%,\s*([\d.]+)%,\s*([\d.]+)\)`
|
||||
* e.g. hsla(200, 20%, 50%, 0.5)
|
||||
* Color name
|
||||
* Options are listed in [SkParseColor.cpp](https://source.chromium.org/chromium/chromium/src/+/main:third_party/skia/src/utils/SkParseColor.cpp;l=11-152;drc=eea4bf52cb0d55e2a39c828b017c80a5ee054148)
|
||||
|
||||
@@ -51,6 +51,13 @@ Check the _Size requirements_ section in [this article][icons].
|
||||
|
||||
[icons]: https://learn.microsoft.com/en-us/windows/win32/uxguide/vis-icons
|
||||
|
||||
:::note
|
||||
|
||||
EXIF metadata is currently not supported and will not be taken into account during
|
||||
image encoding and decoding.
|
||||
|
||||
:::
|
||||
|
||||
## High Resolution Image
|
||||
|
||||
On platforms that have high-DPI support such as Apple Retina displays, you can
|
||||
|
||||
@@ -126,7 +126,7 @@ folder of your project:
|
||||
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
@@ -420,9 +420,8 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||
|
||||
```html
|
||||
<!--index.html-->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<!-- https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP -->
|
||||
|
||||
@@ -1,27 +1,15 @@
|
||||
{
|
||||
"src/electron/patches/chromium": "src",
|
||||
|
||||
"src/electron/patches/boringssl": "src/third_party/boringssl/src",
|
||||
|
||||
"src/electron/patches/devtools_frontend": "src/third_party/devtools-frontend/src",
|
||||
|
||||
"src/electron/patches/ffmpeg": "src/third_party/ffmpeg",
|
||||
|
||||
"src/electron/patches/v8": "src/v8",
|
||||
|
||||
"src/electron/patches/node": "src/third_party/electron_node",
|
||||
|
||||
"src/electron/patches/nan": "src/third_party/nan",
|
||||
|
||||
"src/electron/patches/perfetto": "src/third_party/perfetto",
|
||||
|
||||
"src/electron/patches/squirrel.mac": "src/third_party/squirrel.mac",
|
||||
|
||||
"src/electron/patches/Mantle": "src/third_party/squirrel.mac/vendor/Mantle",
|
||||
|
||||
"src/electron/patches/ReactiveObjC": "src/third_party/squirrel.mac/vendor/ReactiveObjC",
|
||||
|
||||
"src/electron/patches/webrtc": "src/third_party/webrtc",
|
||||
|
||||
"src/electron/patches/reclient-configs": "src/third_party/engflow-reclient-configs"
|
||||
}
|
||||
[
|
||||
{ "patch_dir": "src/electron/patches/chromium", "repo": "src" },
|
||||
{ "patch_dir": "src/electron/patches/boringssl", "repo": "src/third_party/boringssl/src" },
|
||||
{ "patch_dir": "src/electron/patches/devtools_frontend", "repo": "src/third_party/devtools-frontend/src" },
|
||||
{ "patch_dir": "src/electron/patches/ffmpeg", "repo": "src/third_party/ffmpeg" },
|
||||
{ "patch_dir": "src/electron/patches/v8", "repo": "src/v8" },
|
||||
{ "patch_dir": "src/electron/patches/node", "repo": "src/third_party/electron_node" },
|
||||
{ "patch_dir": "src/electron/patches/nan", "repo": "src/third_party/nan" },
|
||||
{ "patch_dir": "src/electron/patches/perfetto", "repo": "src/third_party/perfetto" },
|
||||
{ "patch_dir": "src/electron/patches/squirrel.mac", "repo": "src/third_party/squirrel.mac" },
|
||||
{ "patch_dir": "src/electron/patches/Mantle", "repo": "src/third_party/squirrel.mac/vendor/Mantle" },
|
||||
{ "patch_dir": "src/electron/patches/ReactiveObjC", "repo": "src/third_party/squirrel.mac/vendor/ReactiveObjC" },
|
||||
{ "patch_dir": "src/electron/patches/webrtc", "repo": "src/third_party/webrtc" },
|
||||
{ "patch_dir": "src/electron/patches/reclient-configs", "repo": "src/third_party/engflow-reclient-configs" }
|
||||
]
|
||||
|
||||
@@ -3,19 +3,30 @@
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from lib import git
|
||||
from lib.patches import patch_from_dir
|
||||
|
||||
THREEWAY = "ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES" in os.environ
|
||||
|
||||
def apply_patches(dirs):
|
||||
threeway = os.environ.get("ELECTRON_USE_THREE_WAY_MERGE_FOR_PATCHES")
|
||||
for patch_dir, repo in dirs.items():
|
||||
if os.path.exists(repo):
|
||||
git.import_patches(repo=repo, patch_data=patch_from_dir(patch_dir),
|
||||
threeway=threeway is not None,
|
||||
committer_name="Electron Scripts", committer_email="scripts@electron")
|
||||
def apply_patches(target):
|
||||
repo = target.get('repo')
|
||||
if not os.path.exists(repo):
|
||||
warnings.warn('repo not found: %s' % repo)
|
||||
return
|
||||
patch_dir = target.get('patch_dir')
|
||||
git.import_patches(
|
||||
committer_email="scripts@electron",
|
||||
committer_name="Electron Scripts",
|
||||
patch_data=patch_from_dir(patch_dir),
|
||||
repo=repo,
|
||||
threeway=THREEWAY,
|
||||
)
|
||||
|
||||
def apply_config(config):
|
||||
for target in config:
|
||||
apply_patches(target)
|
||||
|
||||
def parse_args():
|
||||
parser = argparse.ArgumentParser(description='Apply Electron patches')
|
||||
@@ -26,9 +37,8 @@ def parse_args():
|
||||
|
||||
|
||||
def main():
|
||||
configs = parse_args().config
|
||||
for config_json in configs:
|
||||
apply_patches(json.load(config_json))
|
||||
for config_json in parse_args().config:
|
||||
apply_config(json.load(config_json))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -3,14 +3,27 @@
|
||||
import argparse
|
||||
import json
|
||||
import os
|
||||
import warnings
|
||||
|
||||
from lib import git
|
||||
|
||||
|
||||
def export_patches(dirs, dry_run):
|
||||
for patch_dir, repo in dirs.items():
|
||||
if os.path.exists(repo):
|
||||
git.export_patches(repo=repo, out_dir=patch_dir, dry_run=dry_run)
|
||||
def export_patches(target, dry_run):
|
||||
repo = target.get('repo')
|
||||
if not os.path.exists(repo):
|
||||
warnings.warn('repo not found: %s' % repo)
|
||||
return
|
||||
git.export_patches(
|
||||
dry_run=dry_run,
|
||||
grep=target.get('grep'),
|
||||
out_dir=target.get('patch_dir'),
|
||||
repo=repo
|
||||
)
|
||||
|
||||
|
||||
def export_config(config, dry_run):
|
||||
for target in config:
|
||||
export_patches(target, dry_run)
|
||||
|
||||
|
||||
def parse_args():
|
||||
@@ -28,7 +41,7 @@ def main():
|
||||
configs = parse_args().config
|
||||
dry_run = parse_args().dry_run
|
||||
for config_json in configs:
|
||||
export_patches(json.load(config_json), dry_run)
|
||||
export_config(json.load(config_json), dry_run)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -10,13 +10,15 @@ def main(argv):
|
||||
parser.add_argument("-o", "--output",
|
||||
help="directory into which exported patches will be written",
|
||||
required=True)
|
||||
parser.add_argument("--grep",
|
||||
help="only export patches matching a keyword")
|
||||
parser.add_argument("patch_range",
|
||||
nargs='?',
|
||||
help="range of patches to export. Defaults to all commits since the "
|
||||
"most recent tag or remote branch.")
|
||||
args = parser.parse_args(argv)
|
||||
|
||||
git.export_patches('.', args.output, patch_range=args.patch_range)
|
||||
git.export_patches('.', args.output, patch_range=args.patch_range, grep=args.grep)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -149,6 +149,7 @@ def format_patch(repo, since):
|
||||
'format-patch',
|
||||
'--keep-subject',
|
||||
'--no-stat',
|
||||
'--notes',
|
||||
'--stdout',
|
||||
|
||||
# Per RFC 3676 the signature is separated from the body by a line with
|
||||
@@ -181,6 +182,16 @@ def split_patches(patch_data):
|
||||
patches[-1].append(line)
|
||||
return patches
|
||||
|
||||
def filter_patches(patches, key):
|
||||
"""Return patches that include the specified key"""
|
||||
if key is None:
|
||||
return patches
|
||||
matches = []
|
||||
for patch in patches:
|
||||
if any(key in line for line in patch):
|
||||
matches.append(patch)
|
||||
continue
|
||||
return matches
|
||||
|
||||
def munge_subject_to_filename(subject):
|
||||
"""Derive a suitable filename from a commit's subject"""
|
||||
@@ -227,7 +238,7 @@ def remove_patch_filename(patch):
|
||||
force_keep_next_line = l.startswith('Subject: ')
|
||||
|
||||
|
||||
def export_patches(repo, out_dir, patch_range=None, dry_run=False):
|
||||
def export_patches(repo, out_dir, patch_range=None, dry_run=False, grep=None):
|
||||
if not os.path.exists(repo):
|
||||
sys.stderr.write(
|
||||
"Skipping patches in {} because it does not exist.\n".format(repo)
|
||||
@@ -239,6 +250,8 @@ def export_patches(repo, out_dir, patch_range=None, dry_run=False):
|
||||
num_patches, repo, patch_range[0:7]))
|
||||
patch_data = format_patch(repo, patch_range)
|
||||
patches = split_patches(patch_data)
|
||||
if grep:
|
||||
patches = filter_patches(patches, grep)
|
||||
|
||||
try:
|
||||
os.mkdir(out_dir)
|
||||
|
||||
@@ -201,10 +201,9 @@ const LINTERS = [{
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const config = JSON.parse(fs.readFileSync(patchesConfig, 'utf8'));
|
||||
for (const key of Object.keys(config)) {
|
||||
for (const target of JSON.parse(fs.readFileSync(patchesConfig, 'utf8'))) {
|
||||
// The directory the config points to should exist
|
||||
const targetPatchesDir = path.resolve(__dirname, '../../..', key);
|
||||
const targetPatchesDir = path.resolve(__dirname, '../../..', target.patch_dir);
|
||||
if (!fs.existsSync(targetPatchesDir)) {
|
||||
console.error(`target patch directory: "${targetPatchesDir}" does not exist`);
|
||||
process.exit(1);
|
||||
|
||||
@@ -12,7 +12,9 @@ from lib.patches import patch_from_dir
|
||||
|
||||
|
||||
def patched_file_paths(patches_config):
|
||||
for patch_dir, repo in patches_config.items():
|
||||
for target in patches_config:
|
||||
patch_dir = target.get('patch_dir')
|
||||
repo = target.get('repo')
|
||||
for line in patch_from_dir(patch_dir).split("\n"):
|
||||
if line.startswith("+++"):
|
||||
yield posixpath.join(repo, line[6:])
|
||||
|
||||
@@ -1681,7 +1681,7 @@ gin::ObjectTemplateBuilder App::GetObjectTemplateBuilder(v8::Isolate* isolate) {
|
||||
.SetMethod("setBadgeCount",
|
||||
base::BindRepeating(&Browser::SetBadgeCount, browser))
|
||||
.SetMethod("getBadgeCount",
|
||||
base::BindRepeating(&Browser::GetBadgeCount, browser))
|
||||
base::BindRepeating(&Browser::badge_count, browser))
|
||||
.SetMethod("getLoginItemSettings", &App::GetLoginItemSettings)
|
||||
.SetMethod("setLoginItemSettings",
|
||||
base::BindRepeating(&Browser::SetLoginItemSettings, browser))
|
||||
|
||||
@@ -31,7 +31,7 @@ bool IsEncryptionAvailable() {
|
||||
return OSCrypt::IsEncryptionAvailable() ||
|
||||
(use_password_v10 &&
|
||||
static_cast<BrowserProcessImpl*>(g_browser_process)
|
||||
->GetLinuxStorageBackend() == "basic_text");
|
||||
->linux_storage_backend() == "basic_text");
|
||||
#else
|
||||
return OSCrypt::IsEncryptionAvailable();
|
||||
#endif
|
||||
@@ -46,7 +46,7 @@ std::string GetSelectedLinuxBackend() {
|
||||
if (!Browser::Get()->is_ready())
|
||||
return "unknown";
|
||||
return static_cast<BrowserProcessImpl*>(g_browser_process)
|
||||
->GetLinuxStorageBackend();
|
||||
->linux_storage_backend();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -852,7 +852,7 @@ WebContents::WebContents(v8::Isolate* isolate,
|
||||
session_.Reset(isolate, session.ToV8());
|
||||
|
||||
std::unique_ptr<content::WebContents> web_contents;
|
||||
if (IsGuest()) {
|
||||
if (is_guest()) {
|
||||
scoped_refptr<content::SiteInstance> site_instance =
|
||||
content::SiteInstance::CreateForURL(session->browser_context(),
|
||||
GURL("chrome-guest://fake-host"));
|
||||
@@ -922,7 +922,7 @@ void WebContents::InitWithSessionAndOptions(
|
||||
const gin_helper::Dictionary& options) {
|
||||
Observe(owned_web_contents.get());
|
||||
InitWithWebContents(std::move(owned_web_contents), session->browser_context(),
|
||||
IsGuest());
|
||||
is_guest());
|
||||
|
||||
inspectable_web_contents_->GetView()->SetDelegate(this);
|
||||
|
||||
@@ -982,7 +982,7 @@ void WebContents::InitWithSessionAndOptions(
|
||||
|
||||
SetUserAgent(GetBrowserContext()->GetUserAgent());
|
||||
|
||||
if (IsGuest()) {
|
||||
if (is_guest()) {
|
||||
NativeWindow* owner_window = nullptr;
|
||||
if (embedder_) {
|
||||
// New WebContents's owner_window is the embedder's owner_window.
|
||||
@@ -1017,7 +1017,7 @@ void WebContents::InitWithExtensionView(v8::Isolate* isolate,
|
||||
// Allow toggling DevTools for background pages
|
||||
Observe(web_contents);
|
||||
InitWithWebContents(std::unique_ptr<content::WebContents>(web_contents),
|
||||
GetBrowserContext(), IsGuest());
|
||||
GetBrowserContext(), is_guest());
|
||||
inspectable_web_contents_->GetView()->SetDelegate(this);
|
||||
}
|
||||
#endif
|
||||
@@ -1066,7 +1066,7 @@ WebContents::~WebContents() {
|
||||
|
||||
// For guest view based on OOPIF, the WebContents is released by the embedder
|
||||
// frame, and we need to clear the reference to the memory.
|
||||
bool not_owned_by_this = IsGuest() && attached_;
|
||||
bool not_owned_by_this = is_guest() && attached_;
|
||||
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
|
||||
// And background pages are owned by extensions::ExtensionHost.
|
||||
if (type_ == Type::kBackgroundPage)
|
||||
@@ -1096,7 +1096,7 @@ void WebContents::DeleteThisIfAlive() {
|
||||
void WebContents::Destroy() {
|
||||
// The content::WebContents should be destroyed asynchronously when possible
|
||||
// as user may choose to destroy WebContents during an event of it.
|
||||
if (Browser::Get()->is_shutting_down() || IsGuest()) {
|
||||
if (Browser::Get()->is_shutting_down() || is_guest()) {
|
||||
DeleteThisIfAlive();
|
||||
} else {
|
||||
content::GetUIThreadTaskRunner({})->PostTask(
|
||||
@@ -2155,7 +2155,7 @@ void WebContents::DidFinishNavigation(
|
||||
Emit("did-navigate", url, http_response_code, http_status_text);
|
||||
}
|
||||
}
|
||||
if (IsGuest())
|
||||
if (is_guest())
|
||||
Emit("load-commit", url, is_main_frame);
|
||||
} else {
|
||||
auto url = navigation_handle->GetURL();
|
||||
@@ -2374,10 +2374,6 @@ base::ProcessId WebContents::GetOSProcessID() const {
|
||||
return base::GetProcId(process_handle);
|
||||
}
|
||||
|
||||
WebContents::Type WebContents::GetType() const {
|
||||
return type_;
|
||||
}
|
||||
|
||||
bool WebContents::Equal(const WebContents* web_contents) const {
|
||||
return ID() == web_contents->ID();
|
||||
}
|
||||
@@ -3371,7 +3367,7 @@ bool WebContents::IsFocused() const {
|
||||
if (!view)
|
||||
return false;
|
||||
|
||||
if (GetType() != Type::kBackgroundPage) {
|
||||
if (type() != Type::kBackgroundPage) {
|
||||
auto* window = web_contents()->GetNativeView()->GetToplevelWindow();
|
||||
if (window && !window->IsVisible())
|
||||
return false;
|
||||
@@ -3567,10 +3563,6 @@ void WebContents::OnCursorChanged(const ui::Cursor& cursor) {
|
||||
}
|
||||
}
|
||||
|
||||
bool WebContents::IsGuest() const {
|
||||
return type_ == Type::kWebView;
|
||||
}
|
||||
|
||||
void WebContents::AttachToIframe(content::WebContents* embedder_web_contents,
|
||||
int embedder_frame_id) {
|
||||
attached_ = true;
|
||||
@@ -3782,7 +3774,7 @@ void WebContents::SetImageAnimationPolicy(const std::string& new_policy) {
|
||||
}
|
||||
|
||||
void WebContents::SetBackgroundColor(std::optional<SkColor> maybe_color) {
|
||||
SkColor color = maybe_color.value_or((IsGuest() && guest_transparent_) ||
|
||||
SkColor color = maybe_color.value_or((is_guest() && guest_transparent_) ||
|
||||
type_ == Type::kBrowserView
|
||||
? SK_ColorTRANSPARENT
|
||||
: SK_ColorWHITE);
|
||||
@@ -4304,7 +4296,7 @@ void WebContents::UpdateHtmlApiFullscreen(bool fullscreen) {
|
||||
}
|
||||
|
||||
// Make sure all child webviews quit html fullscreen.
|
||||
if (!fullscreen && !IsGuest()) {
|
||||
if (!fullscreen && !is_guest()) {
|
||||
auto* manager = WebViewManager::GetWebViewManager(web_contents());
|
||||
manager->ForEachGuest(web_contents(), [&](content::WebContents* guest) {
|
||||
WebContents* api_web_contents = WebContents::From(guest);
|
||||
@@ -4416,7 +4408,7 @@ void WebContents::FillObjectTemplate(v8::Isolate* isolate,
|
||||
.SetMethod("getZoomLevel", &WebContents::GetZoomLevel)
|
||||
.SetMethod("setZoomFactor", &WebContents::SetZoomFactor)
|
||||
.SetMethod("getZoomFactor", &WebContents::GetZoomFactor)
|
||||
.SetMethod("getType", &WebContents::GetType)
|
||||
.SetMethod("getType", &WebContents::type)
|
||||
.SetMethod("_getPreloadPaths", &WebContents::GetPreloadPaths)
|
||||
.SetMethod("getLastWebPreferences", &WebContents::GetLastWebPreferences)
|
||||
.SetMethod("getOwnerBrowserWindow", &WebContents::GetOwnerBrowserWindow)
|
||||
|
||||
@@ -173,7 +173,7 @@ class WebContents : public ExclusiveAccessContext,
|
||||
void SetBackgroundThrottling(bool allowed);
|
||||
int GetProcessID() const;
|
||||
base::ProcessId GetOSProcessID() const;
|
||||
Type GetType() const;
|
||||
[[nodiscard]] Type type() const { return type_; }
|
||||
bool Equal(const WebContents* web_contents) const;
|
||||
void LoadURL(const GURL& url, const gin_helper::Dictionary& options);
|
||||
void Reload();
|
||||
@@ -292,7 +292,7 @@ class WebContents : public ExclusiveAccessContext,
|
||||
v8::Local<v8::Promise> CapturePage(gin::Arguments* args);
|
||||
|
||||
// Methods for creating <webview>.
|
||||
bool IsGuest() const;
|
||||
[[nodiscard]] bool is_guest() const { return type_ == Type::kWebView; }
|
||||
void AttachToIframe(content::WebContents* embedder_web_contents,
|
||||
int embedder_frame_id);
|
||||
void DetachFromOuterFrame();
|
||||
|
||||
@@ -24,7 +24,7 @@ bool WebContents::IsFocused() const {
|
||||
if (!view)
|
||||
return false;
|
||||
|
||||
if (GetType() != Type::kBackgroundPage) {
|
||||
if (type() != Type::kBackgroundPage) {
|
||||
auto window = [web_contents()->GetNativeView().GetNativeNSView() window];
|
||||
// On Mac the render widget host view does not lose focus when the window
|
||||
// loses focus so check if the top level window is the key window.
|
||||
|
||||
@@ -159,10 +159,6 @@ void Browser::SetName(const std::string& name) {
|
||||
OverriddenApplicationName() = name;
|
||||
}
|
||||
|
||||
int Browser::GetBadgeCount() {
|
||||
return badge_count_;
|
||||
}
|
||||
|
||||
bool Browser::OpenFile(const std::string& file_path) {
|
||||
bool prevent_default = false;
|
||||
for (BrowserObserver& observer : observers_)
|
||||
|
||||
@@ -110,7 +110,7 @@ class Browser : public WindowListObserver {
|
||||
|
||||
// Set/Get the badge count.
|
||||
bool SetBadgeCount(std::optional<int> count);
|
||||
int GetBadgeCount();
|
||||
[[nodiscard]] int badge_count() const { return badge_count_; }
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
struct LaunchItem {
|
||||
|
||||
@@ -340,10 +340,6 @@ void BrowserProcessImpl::SetLinuxStorageBackend(
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
const std::string& BrowserProcessImpl::GetLinuxStorageBackend() const {
|
||||
return selected_linux_storage_backend_;
|
||||
}
|
||||
#endif // BUILDFLAG(IS_LINUX)
|
||||
|
||||
void BrowserProcessImpl::SetApplicationLocale(const std::string& locale) {
|
||||
|
||||
@@ -59,7 +59,9 @@ class BrowserProcessImpl : public BrowserProcess {
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
void SetLinuxStorageBackend(os_crypt::SelectedLinuxBackend selected_backend);
|
||||
const std::string& GetLinuxStorageBackend() const;
|
||||
[[nodiscard]] const std::string& linux_storage_backend() const {
|
||||
return selected_linux_storage_backend_;
|
||||
}
|
||||
#endif
|
||||
|
||||
void EndSession() override {}
|
||||
|
||||
@@ -520,14 +520,6 @@ bool NativeWindow::IsMenuBarVisible() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
double NativeWindow::GetAspectRatio() const {
|
||||
return aspect_ratio_;
|
||||
}
|
||||
|
||||
gfx::Size NativeWindow::GetAspectRatioExtraSize() const {
|
||||
return aspect_ratio_extraSize_;
|
||||
}
|
||||
|
||||
void NativeWindow::SetAspectRatio(double aspect_ratio,
|
||||
const gfx::Size& extra_size) {
|
||||
aspect_ratio_ = aspect_ratio;
|
||||
|
||||
@@ -264,8 +264,10 @@ class NativeWindow : public base::SupportsUserData,
|
||||
virtual bool IsMenuBarVisible() const;
|
||||
|
||||
// Set the aspect ratio when resizing window.
|
||||
double GetAspectRatio() const;
|
||||
gfx::Size GetAspectRatioExtraSize() const;
|
||||
[[nodiscard]] double aspect_ratio() const { return aspect_ratio_; }
|
||||
[[nodiscard]] gfx::Size aspect_ratio_extra_size() const {
|
||||
return aspect_ratio_extraSize_;
|
||||
}
|
||||
virtual void SetAspectRatio(double aspect_ratio, const gfx::Size& extra_size);
|
||||
|
||||
// File preview APIs.
|
||||
|
||||
@@ -641,7 +641,7 @@ bool NativeWindowMac::IsMaximized() const {
|
||||
if (HasStyleMask(NSWindowStyleMaskResizable) != 0)
|
||||
return [window_ isZoomed];
|
||||
|
||||
NSRect rectScreen = GetAspectRatio() > 0.0
|
||||
NSRect rectScreen = aspect_ratio() > 0.0
|
||||
? default_frame_for_zoom()
|
||||
: [[NSScreen mainScreen] visibleFrame];
|
||||
|
||||
|
||||
@@ -231,7 +231,7 @@ void AutofillPopup::SetItems(const std::vector<std::u16string>& values,
|
||||
void AutofillPopup::AcceptSuggestion(int index) {
|
||||
mojo::AssociatedRemote<mojom::ElectronAutofillAgent> autofill_agent;
|
||||
frame_host_->GetRemoteAssociatedInterfaces()->GetInterface(&autofill_agent);
|
||||
autofill_agent->AcceptDataListSuggestion(GetValueAt(index));
|
||||
autofill_agent->AcceptDataListSuggestion(value_at(index));
|
||||
}
|
||||
|
||||
void AutofillPopup::UpdatePopupBounds() {
|
||||
@@ -272,11 +272,10 @@ int AutofillPopup::GetDesiredPopupWidth() {
|
||||
int popup_width = element_bounds_.width();
|
||||
|
||||
for (size_t i = 0; i < values_.size(); ++i) {
|
||||
int row_size =
|
||||
kEndPadding + 2 * kPopupBorderThickness +
|
||||
gfx::GetStringWidth(GetValueAt(i), GetValueFontListForRow(i)) +
|
||||
gfx::GetStringWidth(GetLabelAt(i), GetLabelFontListForRow(i));
|
||||
if (!GetLabelAt(i).empty())
|
||||
int row_size = kEndPadding + 2 * kPopupBorderThickness +
|
||||
gfx::GetStringWidth(value_at(i), GetValueFontListForRow(i)) +
|
||||
gfx::GetStringWidth(label_at(i), GetLabelFontListForRow(i));
|
||||
if (!label_at(i).empty())
|
||||
row_size += kNamePadding + kEndPadding;
|
||||
|
||||
popup_width = std::max(popup_width, row_size);
|
||||
@@ -307,18 +306,6 @@ ui::ColorId AutofillPopup::GetBackgroundColorIDForRow(int index) const {
|
||||
: ui::kColorResultsTableNormalBackground;
|
||||
}
|
||||
|
||||
int AutofillPopup::GetLineCount() {
|
||||
return values_.size();
|
||||
}
|
||||
|
||||
std::u16string AutofillPopup::GetValueAt(int i) {
|
||||
return values_.at(i);
|
||||
}
|
||||
|
||||
std::u16string AutofillPopup::GetLabelAt(int i) {
|
||||
return labels_.at(i);
|
||||
}
|
||||
|
||||
int AutofillPopup::LineFromY(int y) const {
|
||||
int current_height = kPopupBorderThickness;
|
||||
|
||||
|
||||
@@ -57,9 +57,9 @@ class AutofillPopup : public views::ViewObserver {
|
||||
const gfx::FontList& GetLabelFontListForRow(int index) const;
|
||||
ui::ColorId GetBackgroundColorIDForRow(int index) const;
|
||||
|
||||
int GetLineCount();
|
||||
std::u16string GetValueAt(int i);
|
||||
std::u16string GetLabelAt(int i);
|
||||
int line_count() const { return values_.size(); }
|
||||
const std::u16string& value_at(int i) const { return values_.at(i); }
|
||||
const std::u16string& label_at(int i) const { return labels_.at(i); }
|
||||
int LineFromY(int y) const;
|
||||
|
||||
int selected_index_;
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
devtools_is_first_responder_ = NO;
|
||||
attached_to_window_ = NO;
|
||||
|
||||
if (inspectableWebContentsView_->inspectable_web_contents()->IsGuest()) {
|
||||
if (inspectableWebContentsView_->inspectable_web_contents()->is_guest()) {
|
||||
fake_view_ = [[NSView alloc] init];
|
||||
[fake_view_ setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||
[self addSubview:fake_view_];
|
||||
|
||||
@@ -493,8 +493,8 @@ NSArray* ConvertSharingItemToNS(const SharingItem& item) {
|
||||
if (menu_)
|
||||
return menu_;
|
||||
|
||||
if (model_ && model_->GetSharingItem()) {
|
||||
NSMenu* menu = [self createShareMenuForItem:*model_->GetSharingItem()];
|
||||
if (model_ && model_->sharing_item()) {
|
||||
NSMenu* menu = [self createShareMenuForItem:*model_->sharing_item()];
|
||||
menu_ = menu;
|
||||
} else {
|
||||
menu_ = [[NSMenu alloc] initWithTitle:@""];
|
||||
|
||||
@@ -76,7 +76,7 @@ using FullScreenTransitionState =
|
||||
- (NSRect)windowWillUseStandardFrame:(NSWindow*)window
|
||||
defaultFrame:(NSRect)frame {
|
||||
if (!shell_->zoom_to_page_width()) {
|
||||
if (shell_->GetAspectRatio() > 0.0)
|
||||
if (shell_->aspect_ratio() > 0.0)
|
||||
shell_->set_default_frame_for_zoom(frame);
|
||||
return frame;
|
||||
}
|
||||
@@ -104,7 +104,7 @@ using FullScreenTransitionState =
|
||||
// Set the width. Don't touch y or height.
|
||||
frame.size.width = zoomed_width;
|
||||
|
||||
if (shell_->GetAspectRatio() > 0.0)
|
||||
if (shell_->aspect_ratio() > 0.0)
|
||||
shell_->set_default_frame_for_zoom(frame);
|
||||
|
||||
return frame;
|
||||
@@ -139,13 +139,12 @@ using FullScreenTransitionState =
|
||||
|
||||
- (NSSize)windowWillResize:(NSWindow*)sender toSize:(NSSize)frameSize {
|
||||
NSSize newSize = frameSize;
|
||||
double aspectRatio = shell_->GetAspectRatio();
|
||||
NSWindow* window = shell_->GetNativeWindow().GetNativeNSWindow();
|
||||
|
||||
if (aspectRatio > 0.0) {
|
||||
gfx::Size windowSize = shell_->GetSize();
|
||||
gfx::Size contentSize = shell_->GetContentSize();
|
||||
gfx::Size extraSize = shell_->GetAspectRatioExtraSize();
|
||||
if (const double aspectRatio = shell_->aspect_ratio(); aspectRatio > 0.0) {
|
||||
const gfx::Size windowSize = shell_->GetSize();
|
||||
const gfx::Size contentSize = shell_->GetContentSize();
|
||||
const gfx::Size extraSize = shell_->aspect_ratio_extra_size();
|
||||
|
||||
double titleBarHeight = windowSize.height() - contentSize.height();
|
||||
double extraWidthPlusFrame =
|
||||
|
||||
@@ -99,11 +99,6 @@ bool ElectronMenuModel::GetSharingItemAt(size_t index,
|
||||
void ElectronMenuModel::SetSharingItem(SharingItem item) {
|
||||
sharing_item_.emplace(std::move(item));
|
||||
}
|
||||
|
||||
const std::optional<ElectronMenuModel::SharingItem>&
|
||||
ElectronMenuModel::GetSharingItem() const {
|
||||
return sharing_item_;
|
||||
}
|
||||
#endif
|
||||
|
||||
void ElectronMenuModel::MenuWillClose() {
|
||||
|
||||
@@ -98,7 +98,10 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
||||
bool GetSharingItemAt(size_t index, SharingItem* item) const;
|
||||
// Set/Get the SharingItem of this menu.
|
||||
void SetSharingItem(SharingItem item);
|
||||
const std::optional<SharingItem>& GetSharingItem() const;
|
||||
[[nodiscard]] const std::optional<SharingItem>& sharing_item() const {
|
||||
return sharing_item_;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// ui::SimpleMenuModel:
|
||||
|
||||
@@ -384,10 +384,6 @@ InspectableWebContentsDelegate* InspectableWebContents::GetDelegate() const {
|
||||
return delegate_;
|
||||
}
|
||||
|
||||
bool InspectableWebContents::IsGuest() const {
|
||||
return is_guest_;
|
||||
}
|
||||
|
||||
void InspectableWebContents::ReleaseWebContents() {
|
||||
web_contents_.release();
|
||||
WebContentsDestroyed();
|
||||
@@ -454,7 +450,7 @@ void InspectableWebContents::CloseDevTools() {
|
||||
managed_devtools_web_contents_.reset();
|
||||
}
|
||||
embedder_message_dispatcher_.reset();
|
||||
if (!IsGuest())
|
||||
if (!is_guest())
|
||||
web_contents_->Focus();
|
||||
}
|
||||
}
|
||||
@@ -516,10 +512,6 @@ void InspectableWebContents::CallClientFunction(
|
||||
std::move(arguments), std::move(cb));
|
||||
}
|
||||
|
||||
gfx::Rect InspectableWebContents::GetDevToolsBounds() const {
|
||||
return devtools_bounds_;
|
||||
}
|
||||
|
||||
void InspectableWebContents::SaveDevToolsBounds(const gfx::Rect& bounds) {
|
||||
pref_service_->Set(kDevToolsBoundsPref,
|
||||
base::Value{RectToDictionary(bounds)});
|
||||
|
||||
@@ -55,7 +55,7 @@ class InspectableWebContents
|
||||
|
||||
void SetDelegate(InspectableWebContentsDelegate* delegate);
|
||||
InspectableWebContentsDelegate* GetDelegate() const;
|
||||
bool IsGuest() const;
|
||||
[[nodiscard]] bool is_guest() const { return is_guest_; }
|
||||
void ReleaseWebContents();
|
||||
void SetDevToolsWebContents(content::WebContents* devtools);
|
||||
void SetDockState(const std::string& state);
|
||||
@@ -76,7 +76,9 @@ class InspectableWebContents
|
||||
void InspectElement(int x, int y);
|
||||
|
||||
// Return the last position and size of devtools window.
|
||||
gfx::Rect GetDevToolsBounds() const;
|
||||
[[nodiscard]] const gfx::Rect& dev_tools_bounds() const {
|
||||
return devtools_bounds_;
|
||||
}
|
||||
void SaveDevToolsBounds(const gfx::Rect& bounds);
|
||||
|
||||
// Return the last set zoom level of devtools window.
|
||||
|
||||
@@ -124,7 +124,7 @@ void AutofillPopupView::OnSuggestionsChanged() {
|
||||
return;
|
||||
|
||||
CreateChildViews();
|
||||
if (popup_->GetLineCount() == 0) {
|
||||
if (popup_->line_count() == 0) {
|
||||
popup_->Hide();
|
||||
return;
|
||||
}
|
||||
@@ -177,28 +177,28 @@ void AutofillPopupView::DrawAutofillEntry(gfx::Canvas* canvas,
|
||||
|
||||
int x_align_left = value_rect.x();
|
||||
const int value_width = gfx::GetStringWidth(
|
||||
popup_->GetValueAt(index), popup_->GetValueFontListForRow(index));
|
||||
popup_->value_at(index), popup_->GetValueFontListForRow(index));
|
||||
int value_x_align_left = x_align_left;
|
||||
value_x_align_left =
|
||||
is_rtl ? value_rect.right() - value_width : value_rect.x();
|
||||
|
||||
canvas->DrawStringRectWithFlags(
|
||||
popup_->GetValueAt(index), popup_->GetValueFontListForRow(index),
|
||||
popup_->value_at(index), popup_->GetValueFontListForRow(index),
|
||||
GetColorProvider()->GetColor(ui::kColorResultsTableNormalText),
|
||||
gfx::Rect(value_x_align_left, value_rect.y(), value_width,
|
||||
value_rect.height()),
|
||||
text_align);
|
||||
|
||||
// Draw the label text, if one exists.
|
||||
if (!popup_->GetLabelAt(index).empty()) {
|
||||
const int label_width = gfx::GetStringWidth(
|
||||
popup_->GetLabelAt(index), popup_->GetLabelFontListForRow(index));
|
||||
if (auto const& label = popup_->label_at(index); !label.empty()) {
|
||||
const int label_width =
|
||||
gfx::GetStringWidth(label, popup_->GetLabelFontListForRow(index));
|
||||
int label_x_align_left = x_align_left;
|
||||
label_x_align_left =
|
||||
is_rtl ? value_rect.x() : value_rect.right() - label_width;
|
||||
|
||||
canvas->DrawStringRectWithFlags(
|
||||
popup_->GetLabelAt(index), popup_->GetLabelFontListForRow(index),
|
||||
label, popup_->GetLabelFontListForRow(index),
|
||||
GetColorProvider()->GetColor(ui::kColorResultsTableDimmedText),
|
||||
gfx::Rect(label_x_align_left, entry_rect.y(), label_width,
|
||||
entry_rect.height()),
|
||||
@@ -212,8 +212,8 @@ void AutofillPopupView::CreateChildViews() {
|
||||
|
||||
RemoveAllChildViews();
|
||||
|
||||
for (int i = 0; i < popup_->GetLineCount(); ++i) {
|
||||
auto* child_view = new AutofillPopupChildView(popup_->GetValueAt(i));
|
||||
for (int i = 0; i < popup_->line_count(); ++i) {
|
||||
auto* child_view = new AutofillPopupChildView(popup_->value_at(i));
|
||||
child_view->set_drag_controller(this);
|
||||
AddChildView(child_view);
|
||||
}
|
||||
@@ -234,8 +234,7 @@ void AutofillPopupView::DoUpdateBoundsAndRedrawPopup() {
|
||||
}
|
||||
|
||||
void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
|
||||
if (!popup_ ||
|
||||
static_cast<size_t>(popup_->GetLineCount()) != children().size())
|
||||
if (!popup_ || static_cast<size_t>(popup_->line_count()) != children().size())
|
||||
return;
|
||||
gfx::Canvas* draw_canvas = canvas;
|
||||
SkBitmap bitmap;
|
||||
@@ -252,7 +251,7 @@ void AutofillPopupView::OnPaint(gfx::Canvas* canvas) {
|
||||
GetColorProvider()->GetColor(ui::kColorResultsTableNormalBackground));
|
||||
OnPaintBorder(draw_canvas);
|
||||
|
||||
for (int i = 0; i < popup_->GetLineCount(); ++i) {
|
||||
for (int i = 0; i < popup_->line_count(); ++i) {
|
||||
gfx::Rect line_rect = popup_->GetRowBounds(i);
|
||||
|
||||
DrawAutofillEntry(draw_canvas, i, line_rect);
|
||||
@@ -381,7 +380,7 @@ bool AutofillPopupView::HandleKeyPressEvent(
|
||||
SetSelectedLine(0);
|
||||
return true;
|
||||
case ui::VKEY_NEXT: // Page down.
|
||||
SetSelectedLine(popup_->GetLineCount() - 1);
|
||||
SetSelectedLine(popup_->line_count() - 1);
|
||||
return true;
|
||||
case ui::VKEY_ESCAPE:
|
||||
popup_->Hide();
|
||||
@@ -421,7 +420,7 @@ void AutofillPopupView::AcceptSuggestion(int index) {
|
||||
}
|
||||
|
||||
bool AutofillPopupView::AcceptSelectedLine() {
|
||||
if (!selected_line_ || selected_line_.value() >= popup_->GetLineCount())
|
||||
if (!selected_line_ || selected_line_.value() >= popup_->line_count())
|
||||
return false;
|
||||
|
||||
AcceptSuggestion(selected_line_.value());
|
||||
@@ -441,7 +440,7 @@ void AutofillPopupView::SetSelectedLine(std::optional<int> selected_line) {
|
||||
return;
|
||||
if (selected_line_ == selected_line)
|
||||
return;
|
||||
if (selected_line && selected_line.value() >= popup_->GetLineCount())
|
||||
if (selected_line && selected_line.value() >= popup_->line_count())
|
||||
return;
|
||||
|
||||
auto previous_selected_line(selected_line_);
|
||||
@@ -461,7 +460,7 @@ void AutofillPopupView::SelectNextLine() {
|
||||
return;
|
||||
|
||||
int new_selected_line = selected_line_ ? *selected_line_ + 1 : 0;
|
||||
if (new_selected_line >= popup_->GetLineCount())
|
||||
if (new_selected_line >= popup_->line_count())
|
||||
new_selected_line = 0;
|
||||
|
||||
SetSelectedLine(new_selected_line);
|
||||
@@ -473,7 +472,7 @@ void AutofillPopupView::SelectPreviousLine() {
|
||||
|
||||
int new_selected_line = selected_line_.value_or(0) - 1;
|
||||
if (new_selected_line < 0)
|
||||
new_selected_line = popup_->GetLineCount() - 1;
|
||||
new_selected_line = popup_->line_count() - 1;
|
||||
|
||||
SetSelectedLine(new_selected_line);
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ InspectableWebContentsViewViews::InspectableWebContentsViewViews(
|
||||
: InspectableWebContentsView(inspectable_web_contents),
|
||||
devtools_web_view_(new views::WebView(nullptr)),
|
||||
title_(u"Developer Tools") {
|
||||
if (!inspectable_web_contents_->IsGuest() &&
|
||||
if (!inspectable_web_contents_->is_guest() &&
|
||||
inspectable_web_contents_->GetWebContents()->GetNativeView()) {
|
||||
auto* contents_web_view = new views::WebView(nullptr);
|
||||
contents_web_view->SetWebContents(
|
||||
@@ -116,8 +116,7 @@ void InspectableWebContentsViewViews::ShowDevTools(bool activate) {
|
||||
if (devtools_window_) {
|
||||
devtools_window_web_view_->SetWebContents(
|
||||
inspectable_web_contents_->GetDevToolsWebContents());
|
||||
devtools_window_->SetBounds(
|
||||
inspectable_web_contents()->GetDevToolsBounds());
|
||||
devtools_window_->SetBounds(inspectable_web_contents()->dev_tools_bounds());
|
||||
if (activate) {
|
||||
devtools_window_->Show();
|
||||
} else {
|
||||
@@ -182,7 +181,7 @@ void InspectableWebContentsViewViews::SetIsDocked(bool docked, bool activate) {
|
||||
views::Widget::InitParams params;
|
||||
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
|
||||
params.delegate = devtools_window_delegate_;
|
||||
params.bounds = inspectable_web_contents()->GetDevToolsBounds();
|
||||
params.bounds = inspectable_web_contents()->dev_tools_bounds();
|
||||
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
params.wm_role_name = "devtools";
|
||||
|
||||
@@ -4178,14 +4178,15 @@ describe('BrowserWindow module', () => {
|
||||
});
|
||||
|
||||
it('returns false when the window is only partially obscured', async () => {
|
||||
const w1 = new BrowserWindow({ width: 400, height: 400 });
|
||||
const w2 = new BrowserWindow({ show: false, width: 450, height: 450 });
|
||||
const w1 = new BrowserWindow({ x: 250, y: 250, width: 400, height: 400 });
|
||||
const w2 = new BrowserWindow({ show: false, x: 200, y: 200, width: 500, height: 500 });
|
||||
|
||||
const focused = once(w2, 'focus');
|
||||
w2.show();
|
||||
await focused;
|
||||
|
||||
await setTimeout(1000);
|
||||
await setTimeout(2000);
|
||||
console.log(w1.getBounds(), w2.getBounds());
|
||||
expect(w1.isOccluded()).to.be.true('window is not occluded');
|
||||
|
||||
const pos = w2.getPosition();
|
||||
@@ -4193,7 +4194,8 @@ describe('BrowserWindow module', () => {
|
||||
w2.setPosition(pos[0] - 100, pos[1]);
|
||||
await move;
|
||||
|
||||
await setTimeout(1000);
|
||||
await setTimeout(2000);
|
||||
console.log(w1.getBounds(), w2.getBounds());
|
||||
expect(w1.isOccluded()).to.be.false('window is occluded');
|
||||
});
|
||||
|
||||
@@ -4211,14 +4213,15 @@ describe('BrowserWindow module', () => {
|
||||
});
|
||||
|
||||
it('returns true for an obscured window', async () => {
|
||||
const w1 = new BrowserWindow({ width: 200, height: 200 });
|
||||
const w2 = new BrowserWindow({ show: false });
|
||||
const w1 = new BrowserWindow({ x: 200, y: 200, width: 200, height: 200 });
|
||||
const w2 = new BrowserWindow({ show: false, x: 100, y: 100, width: 800, height: 800 });
|
||||
|
||||
const focused = once(w2, 'focus');
|
||||
w2.show();
|
||||
await focused;
|
||||
|
||||
await setTimeout(1000);
|
||||
await setTimeout(2000);
|
||||
console.log(w1.getBounds(), w2.getBounds());
|
||||
expect(w1.isOccluded()).to.be.true('visible window');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user