chore: replace absl::optional<T> with std::optional<T> (#40928)
* chore: replace absl::optional<T> with std::optional<T> * IWYU
This commit is contained in:
parent
fac964ac0d
commit
892c9d78a3
129 changed files with 419 additions and 397 deletions
|
@ -238,7 +238,7 @@ const char* const ElectronMainDelegate::kNonWildcardDomainNonPortSchemes[] = {
|
||||||
const size_t ElectronMainDelegate::kNonWildcardDomainNonPortSchemesSize =
|
const size_t ElectronMainDelegate::kNonWildcardDomainNonPortSchemesSize =
|
||||||
std::size(kNonWildcardDomainNonPortSchemes);
|
std::size(kNonWildcardDomainNonPortSchemes);
|
||||||
|
|
||||||
absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
|
std::optional<int> ElectronMainDelegate::BasicStartupComplete() {
|
||||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
|
@ -311,7 +311,7 @@ absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
|
||||||
::switches::kDisableGpuMemoryBufferCompositorResources);
|
::switches::kDisableGpuMemoryBufferCompositorResources);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ElectronMainDelegate::PreSandboxStartup() {
|
void ElectronMainDelegate::PreSandboxStartup() {
|
||||||
|
@ -398,7 +398,7 @@ void ElectronMainDelegate::SandboxInitialized(const std::string& process_type) {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<int> ElectronMainDelegate::PreBrowserMain() {
|
std::optional<int> ElectronMainDelegate::PreBrowserMain() {
|
||||||
// This is initialized early because the service manager reads some feature
|
// This is initialized early because the service manager reads some feature
|
||||||
// flags and we need to make sure the feature list is initialized before the
|
// flags and we need to make sure the feature list is initialized before the
|
||||||
// service manager reads the features.
|
// service manager reads the features.
|
||||||
|
@ -408,7 +408,7 @@ absl::optional<int> ElectronMainDelegate::PreBrowserMain() {
|
||||||
#if BUILDFLAG(IS_MAC)
|
#if BUILDFLAG(IS_MAC)
|
||||||
RegisterAtomCrApp();
|
RegisterAtomCrApp();
|
||||||
#endif
|
#endif
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
base::StringPiece ElectronMainDelegate::GetBrowserV8SnapshotFilename() {
|
base::StringPiece ElectronMainDelegate::GetBrowserV8SnapshotFilename() {
|
||||||
|
|
|
@ -34,10 +34,10 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
// content::ContentMainDelegate:
|
// content::ContentMainDelegate:
|
||||||
absl::optional<int> BasicStartupComplete() override;
|
std::optional<int> BasicStartupComplete() override;
|
||||||
void PreSandboxStartup() override;
|
void PreSandboxStartup() override;
|
||||||
void SandboxInitialized(const std::string& process_type) override;
|
void SandboxInitialized(const std::string& process_type) override;
|
||||||
absl::optional<int> PreBrowserMain() override;
|
std::optional<int> PreBrowserMain() override;
|
||||||
content::ContentClient* CreateContentClient() override;
|
content::ContentClient* CreateContentClient() override;
|
||||||
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
||||||
content::ContentGpuClient* CreateContentGpuClient() override;
|
content::ContentGpuClient* CreateContentGpuClient() override;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "shell/browser/api/electron_api_app.h"
|
#include "shell/browser/api/electron_api_app.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -75,7 +76,6 @@
|
||||||
#include "shell/common/platform_util.h"
|
#include "shell/common/platform_util.h"
|
||||||
#include "shell/common/thread_restrictions.h"
|
#include "shell/common/thread_restrictions.h"
|
||||||
#include "shell/common/v8_value_serializer.h"
|
#include "shell/common/v8_value_serializer.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/gfx/image/image.h"
|
#include "ui/gfx/image/image.h"
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
|
@ -927,7 +927,7 @@ void App::SetAppPath(const base::FilePath& app_path) {
|
||||||
|
|
||||||
#if !BUILDFLAG(IS_MAC)
|
#if !BUILDFLAG(IS_MAC)
|
||||||
void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
||||||
absl::optional<base::FilePath> custom_path) {
|
std::optional<base::FilePath> custom_path) {
|
||||||
if (custom_path.has_value()) {
|
if (custom_path.has_value()) {
|
||||||
if (!custom_path->IsAbsolute()) {
|
if (!custom_path->IsAbsolute()) {
|
||||||
thrower.ThrowError("Path must be absolute");
|
thrower.ThrowError("Path must be absolute");
|
||||||
|
@ -1604,7 +1604,7 @@ void ConfigureHostResolver(v8::Isolate* isolate,
|
||||||
// doh_config.
|
// doh_config.
|
||||||
std::vector<net::DnsOverHttpsServerConfig> servers;
|
std::vector<net::DnsOverHttpsServerConfig> servers;
|
||||||
for (const std::string& server_template : secure_dns_server_strings) {
|
for (const std::string& server_template : secure_dns_server_strings) {
|
||||||
absl::optional<net::DnsOverHttpsServerConfig> server_config =
|
std::optional<net::DnsOverHttpsServerConfig> server_config =
|
||||||
net::DnsOverHttpsServerConfig::FromString(server_template);
|
net::DnsOverHttpsServerConfig::FromString(server_template);
|
||||||
if (!server_config.has_value()) {
|
if (!server_config.has_value()) {
|
||||||
thrower.ThrowTypeError(std::string("not a valid DoH template: ") +
|
thrower.ThrowTypeError(std::string("not a valid DoH template: ") +
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_APP_H_
|
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_APP_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -180,7 +181,7 @@ class App : public ElectronBrowserClient::Delegate,
|
||||||
void ChildProcessDisconnected(int pid);
|
void ChildProcessDisconnected(int pid);
|
||||||
|
|
||||||
void SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
void SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
||||||
absl::optional<base::FilePath> custom_path);
|
std::optional<base::FilePath> custom_path);
|
||||||
|
|
||||||
// Get/Set the pre-defined path in PathService.
|
// Get/Set the pre-defined path in PathService.
|
||||||
base::FilePath GetPath(gin_helper::ErrorThrower thrower,
|
base::FilePath GetPath(gin_helper::ErrorThrower thrower,
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
namespace electron::api {
|
namespace electron::api {
|
||||||
|
|
||||||
void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
void App::SetAppLogsPath(gin_helper::ErrorThrower thrower,
|
||||||
absl::optional<base::FilePath> custom_path) {
|
std::optional<base::FilePath> custom_path) {
|
||||||
if (custom_path.has_value()) {
|
if (custom_path.has_value()) {
|
||||||
if (!custom_path->IsAbsolute()) {
|
if (!custom_path->IsAbsolute()) {
|
||||||
thrower.ThrowError("Path must be absolute");
|
thrower.ThrowError("Path must be absolute");
|
||||||
|
|
|
@ -826,11 +826,11 @@ bool BaseWindow::GetWindowButtonVisibility() const {
|
||||||
return window_->GetWindowButtonVisibility();
|
return window_->GetWindowButtonVisibility();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BaseWindow::SetWindowButtonPosition(absl::optional<gfx::Point> position) {
|
void BaseWindow::SetWindowButtonPosition(std::optional<gfx::Point> position) {
|
||||||
window_->SetWindowButtonPosition(std::move(position));
|
window_->SetWindowButtonPosition(std::move(position));
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<gfx::Point> BaseWindow::GetWindowButtonPosition() const {
|
std::optional<gfx::Point> BaseWindow::GetWindowButtonPosition() const {
|
||||||
return window_->GetWindowButtonPosition();
|
return window_->GetWindowButtonPosition();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -187,8 +188,8 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
|
||||||
std::string GetAlwaysOnTopLevel() const;
|
std::string GetAlwaysOnTopLevel() const;
|
||||||
void SetWindowButtonVisibility(bool visible);
|
void SetWindowButtonVisibility(bool visible);
|
||||||
bool GetWindowButtonVisibility() const;
|
bool GetWindowButtonVisibility() const;
|
||||||
void SetWindowButtonPosition(absl::optional<gfx::Point> position);
|
void SetWindowButtonPosition(std::optional<gfx::Point> position);
|
||||||
absl::optional<gfx::Point> GetWindowButtonPosition() const;
|
std::optional<gfx::Point> GetWindowButtonPosition() const;
|
||||||
|
|
||||||
bool IsHiddenInMissionControl();
|
bool IsHiddenInMissionControl();
|
||||||
void SetHiddenInMissionControl(bool hidden);
|
void SetHiddenInMissionControl(bool hidden);
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Use of this source code is governed by the MIT license that can be
|
// Use of this source code is governed by the MIT license that can be
|
||||||
// found in the LICENSE file.
|
// found in the LICENSE file.
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -17,7 +18,6 @@
|
||||||
#include "shell/common/gin_helper/dictionary.h"
|
#include "shell/common/gin_helper/dictionary.h"
|
||||||
#include "shell/common/gin_helper/promise.h"
|
#include "shell/common/gin_helper/promise.h"
|
||||||
#include "shell/common/node_includes.h"
|
#include "shell/common/node_includes.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
using content::TracingController;
|
using content::TracingController;
|
||||||
|
|
||||||
|
@ -58,18 +58,18 @@ namespace {
|
||||||
|
|
||||||
using CompletionCallback = base::OnceCallback<void(const base::FilePath&)>;
|
using CompletionCallback = base::OnceCallback<void(const base::FilePath&)>;
|
||||||
|
|
||||||
absl::optional<base::FilePath> CreateTemporaryFileOnIO() {
|
std::optional<base::FilePath> CreateTemporaryFileOnIO() {
|
||||||
base::FilePath temp_file_path;
|
base::FilePath temp_file_path;
|
||||||
if (!base::CreateTemporaryFile(&temp_file_path))
|
if (!base::CreateTemporaryFile(&temp_file_path))
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
return absl::make_optional(std::move(temp_file_path));
|
return std::make_optional(std::move(temp_file_path));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StopTracing(gin_helper::Promise<base::FilePath> promise,
|
void StopTracing(gin_helper::Promise<base::FilePath> promise,
|
||||||
absl::optional<base::FilePath> file_path) {
|
std::optional<base::FilePath> file_path) {
|
||||||
auto resolve_or_reject = base::BindOnce(
|
auto resolve_or_reject = base::BindOnce(
|
||||||
[](gin_helper::Promise<base::FilePath> promise,
|
[](gin_helper::Promise<base::FilePath> promise,
|
||||||
const base::FilePath& path, absl::optional<std::string> error) {
|
const base::FilePath& path, std::optional<std::string> error) {
|
||||||
if (error) {
|
if (error) {
|
||||||
promise.RejectWithErrorMessage(error.value());
|
promise.RejectWithErrorMessage(error.value());
|
||||||
} else {
|
} else {
|
||||||
|
@ -81,20 +81,20 @@ void StopTracing(gin_helper::Promise<base::FilePath> promise,
|
||||||
auto* instance = TracingController::GetInstance();
|
auto* instance = TracingController::GetInstance();
|
||||||
if (!instance->IsTracing()) {
|
if (!instance->IsTracing()) {
|
||||||
std::move(resolve_or_reject)
|
std::move(resolve_or_reject)
|
||||||
.Run(absl::make_optional(
|
.Run(std::make_optional(
|
||||||
"Failed to stop tracing - no trace in progress"));
|
"Failed to stop tracing - no trace in progress"));
|
||||||
} else if (file_path) {
|
} else if (file_path) {
|
||||||
auto split_callback = base::SplitOnceCallback(std::move(resolve_or_reject));
|
auto split_callback = base::SplitOnceCallback(std::move(resolve_or_reject));
|
||||||
auto endpoint = TracingController::CreateFileEndpoint(
|
auto endpoint = TracingController::CreateFileEndpoint(
|
||||||
*file_path,
|
*file_path,
|
||||||
base::BindOnce(std::move(split_callback.first), absl::nullopt));
|
base::BindOnce(std::move(split_callback.first), std::nullopt));
|
||||||
if (!instance->StopTracing(endpoint)) {
|
if (!instance->StopTracing(endpoint)) {
|
||||||
std::move(split_callback.second)
|
std::move(split_callback.second)
|
||||||
.Run(absl::make_optional("Failed to stop tracing"));
|
.Run(std::make_optional("Failed to stop tracing"));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
std::move(resolve_or_reject)
|
std::move(resolve_or_reject)
|
||||||
.Run(absl::make_optional(
|
.Run(std::make_optional(
|
||||||
"Failed to create temporary file for trace data"));
|
"Failed to create temporary file for trace data"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,7 +105,7 @@ v8::Local<v8::Promise> StopRecording(gin_helper::Arguments* args) {
|
||||||
|
|
||||||
base::FilePath path;
|
base::FilePath path;
|
||||||
if (args->GetNext(&path) && !path.empty()) {
|
if (args->GetNext(&path) && !path.empty()) {
|
||||||
StopTracing(std::move(promise), absl::make_optional(path));
|
StopTracing(std::move(promise), std::make_optional(path));
|
||||||
} else {
|
} else {
|
||||||
// use a temporary file.
|
// use a temporary file.
|
||||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||||
|
|
|
@ -127,13 +127,13 @@ bool MatchesCookie(const base::Value::Dict& filter,
|
||||||
if ((str = filter.FindString("domain")) &&
|
if ((str = filter.FindString("domain")) &&
|
||||||
!MatchesDomain(*str, cookie.Domain()))
|
!MatchesDomain(*str, cookie.Domain()))
|
||||||
return false;
|
return false;
|
||||||
absl::optional<bool> secure_filter = filter.FindBool("secure");
|
std::optional<bool> secure_filter = filter.FindBool("secure");
|
||||||
if (secure_filter && *secure_filter != cookie.IsSecure())
|
if (secure_filter && *secure_filter != cookie.IsSecure())
|
||||||
return false;
|
return false;
|
||||||
absl::optional<bool> session_filter = filter.FindBool("session");
|
std::optional<bool> session_filter = filter.FindBool("session");
|
||||||
if (session_filter && *session_filter == cookie.IsPersistent())
|
if (session_filter && *session_filter == cookie.IsPersistent())
|
||||||
return false;
|
return false;
|
||||||
absl::optional<bool> httpOnly_filter = filter.FindBool("httpOnly");
|
std::optional<bool> httpOnly_filter = filter.FindBool("httpOnly");
|
||||||
if (httpOnly_filter && *httpOnly_filter != cookie.IsHttpOnly())
|
if (httpOnly_filter && *httpOnly_filter != cookie.IsHttpOnly())
|
||||||
return false;
|
return false;
|
||||||
return true;
|
return true;
|
||||||
|
@ -161,7 +161,7 @@ void FilterCookieWithStatuses(
|
||||||
}
|
}
|
||||||
|
|
||||||
// Parse dictionary property to CanonicalCookie time correctly.
|
// Parse dictionary property to CanonicalCookie time correctly.
|
||||||
base::Time ParseTimeProperty(const absl::optional<double>& value) {
|
base::Time ParseTimeProperty(const std::optional<double>& value) {
|
||||||
if (!value) // empty time means ignoring the parameter
|
if (!value) // empty time means ignoring the parameter
|
||||||
return base::Time();
|
return base::Time();
|
||||||
if (*value == 0) // FromSecondsSinceUnixEpoch would convert 0 to empty Time
|
if (*value == 0) // FromSecondsSinceUnixEpoch would convert 0 to empty Time
|
||||||
|
@ -321,7 +321,7 @@ v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
|
||||||
path ? *path : "", ParseTimeProperty(details.FindDouble("creationDate")),
|
path ? *path : "", ParseTimeProperty(details.FindDouble("creationDate")),
|
||||||
ParseTimeProperty(details.FindDouble("expirationDate")),
|
ParseTimeProperty(details.FindDouble("expirationDate")),
|
||||||
ParseTimeProperty(details.FindDouble("lastAccessDate")), secure,
|
ParseTimeProperty(details.FindDouble("lastAccessDate")), secure,
|
||||||
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, absl::nullopt,
|
http_only, same_site, net::COOKIE_PRIORITY_DEFAULT, std::nullopt,
|
||||||
&status);
|
&status);
|
||||||
|
|
||||||
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
|
||||||
|
|
|
@ -44,12 +44,12 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
|
||||||
|
|
||||||
base::StringPiece message_str(reinterpret_cast<const char*>(message.data()),
|
base::StringPiece message_str(reinterpret_cast<const char*>(message.data()),
|
||||||
message.size());
|
message.size());
|
||||||
absl::optional<base::Value> parsed_message = base::JSONReader::Read(
|
std::optional<base::Value> parsed_message = base::JSONReader::Read(
|
||||||
message_str, base::JSON_REPLACE_INVALID_CHARACTERS);
|
message_str, base::JSON_REPLACE_INVALID_CHARACTERS);
|
||||||
if (!parsed_message || !parsed_message->is_dict())
|
if (!parsed_message || !parsed_message->is_dict())
|
||||||
return;
|
return;
|
||||||
base::Value::Dict& dict = parsed_message->GetDict();
|
base::Value::Dict& dict = parsed_message->GetDict();
|
||||||
absl::optional<int> id = dict.FindInt("id");
|
std::optional<int> id = dict.FindInt("id");
|
||||||
if (!id) {
|
if (!id) {
|
||||||
std::string* method = dict.FindString("method");
|
std::string* method = dict.FindString("method");
|
||||||
if (!method)
|
if (!method)
|
||||||
|
|
|
@ -25,7 +25,7 @@ static NSMenu* __strong applicationMenu_;
|
||||||
ui::Accelerator GetAcceleratorFromKeyEquivalentAndModifierMask(
|
ui::Accelerator GetAcceleratorFromKeyEquivalentAndModifierMask(
|
||||||
NSString* key_equivalent,
|
NSString* key_equivalent,
|
||||||
NSUInteger modifier_mask) {
|
NSUInteger modifier_mask) {
|
||||||
absl::optional<char16_t> shifted_char;
|
std::optional<char16_t> shifted_char;
|
||||||
ui::KeyboardCode code = electron::KeyboardCodeFromStr(
|
ui::KeyboardCode code = electron::KeyboardCodeFromStr(
|
||||||
base::SysNSStringToUTF8(key_equivalent), &shifted_char);
|
base::SysNSStringToUTF8(key_equivalent), &shifted_char);
|
||||||
int modifiers = 0;
|
int modifiers = 0;
|
||||||
|
|
|
@ -125,7 +125,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
|
||||||
}
|
}
|
||||||
|
|
||||||
pending_start_promise_ =
|
pending_start_promise_ =
|
||||||
absl::make_optional<gin_helper::Promise<void>>(args->isolate());
|
std::make_optional<gin_helper::Promise<void>>(args->isolate());
|
||||||
v8::Local<v8::Promise> handle = pending_start_promise_->GetHandle();
|
v8::Local<v8::Promise> handle = pending_start_promise_->GetHandle();
|
||||||
|
|
||||||
auto command_line_string =
|
auto command_line_string =
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_NET_LOG_H_
|
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_NET_LOG_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_NET_LOG_H_
|
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_NET_LOG_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "base/files/file_path.h"
|
#include "base/files/file_path.h"
|
||||||
#include "base/functional/callback.h"
|
#include "base/functional/callback.h"
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
|
@ -16,7 +18,6 @@
|
||||||
#include "net/log/net_log_capture_mode.h"
|
#include "net/log/net_log_capture_mode.h"
|
||||||
#include "services/network/public/mojom/net_log.mojom.h"
|
#include "services/network/public/mojom/net_log.mojom.h"
|
||||||
#include "shell/common/gin_helper/promise.h"
|
#include "shell/common/gin_helper/promise.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace gin {
|
namespace gin {
|
||||||
class Arguments;
|
class Arguments;
|
||||||
|
@ -67,7 +68,7 @@ class NetLog : public gin::Wrappable<NetLog> {
|
||||||
|
|
||||||
mojo::Remote<network::mojom::NetLogExporter> net_log_exporter_;
|
mojo::Remote<network::mojom::NetLogExporter> net_log_exporter_;
|
||||||
|
|
||||||
absl::optional<gin_helper::Promise<void>> pending_start_promise_;
|
std::optional<gin_helper::Promise<void>> pending_start_promise_;
|
||||||
|
|
||||||
scoped_refptr<base::TaskRunner> file_task_runner_;
|
scoped_refptr<base::TaskRunner> file_task_runner_;
|
||||||
|
|
||||||
|
|
|
@ -281,7 +281,7 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
|
||||||
url_chain, GURL(),
|
url_chain, GURL(),
|
||||||
content::StoragePartitionConfig::CreateDefault(
|
content::StoragePartitionConfig::CreateDefault(
|
||||||
download_manager->GetBrowserContext()),
|
download_manager->GetBrowserContext()),
|
||||||
GURL(), GURL(), absl::nullopt, mime_type, mime_type, start_time,
|
GURL(), GURL(), std::nullopt, mime_type, mime_type, start_time,
|
||||||
base::Time(), etag, last_modified, offset, length, std::string(),
|
base::Time(), etag, last_modified, offset, length, std::string(),
|
||||||
download::DownloadItem::INTERRUPTED,
|
download::DownloadItem::INTERRUPTED,
|
||||||
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
|
||||||
|
@ -432,7 +432,7 @@ v8::Local<v8::Promise> Session::ResolveProxy(gin::Arguments* args) {
|
||||||
|
|
||||||
v8::Local<v8::Promise> Session::ResolveHost(
|
v8::Local<v8::Promise> Session::ResolveHost(
|
||||||
std::string host,
|
std::string host,
|
||||||
absl::optional<network::mojom::ResolveHostParametersPtr> params) {
|
std::optional<network::mojom::ResolveHostParametersPtr> params) {
|
||||||
gin_helper::Promise<gin_helper::Dictionary> promise(isolate_);
|
gin_helper::Promise<gin_helper::Dictionary> promise(isolate_);
|
||||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||||
|
|
||||||
|
@ -441,7 +441,7 @@ v8::Local<v8::Promise> Session::ResolveHost(
|
||||||
params ? std::move(params.value()) : nullptr,
|
params ? std::move(params.value()) : nullptr,
|
||||||
base::BindOnce(
|
base::BindOnce(
|
||||||
[](gin_helper::Promise<gin_helper::Dictionary> promise,
|
[](gin_helper::Promise<gin_helper::Dictionary> promise,
|
||||||
int64_t net_error, const absl::optional<net::AddressList>& addrs) {
|
int64_t net_error, const std::optional<net::AddressList>& addrs) {
|
||||||
if (net_error < 0) {
|
if (net_error < 0) {
|
||||||
promise.RejectWithErrorMessage(net::ErrorToString(net_error));
|
promise.RejectWithErrorMessage(net::ErrorToString(net_error));
|
||||||
} else {
|
} else {
|
||||||
|
@ -1271,7 +1271,7 @@ gin::Handle<Session> Session::FromPartition(v8::Isolate* isolate,
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
absl::optional<gin::Handle<Session>> Session::FromPath(
|
std::optional<gin::Handle<Session>> Session::FromPath(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
const base::FilePath& path,
|
const base::FilePath& path,
|
||||||
base::Value::Dict options) {
|
base::Value::Dict options) {
|
||||||
|
@ -1280,12 +1280,12 @@ absl::optional<gin::Handle<Session>> Session::FromPath(
|
||||||
if (path.empty()) {
|
if (path.empty()) {
|
||||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||||
promise.RejectWithErrorMessage("An empty path was specified");
|
promise.RejectWithErrorMessage("An empty path was specified");
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
if (!path.IsAbsolute()) {
|
if (!path.IsAbsolute()) {
|
||||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||||
promise.RejectWithErrorMessage("An absolute path was not provided");
|
promise.RejectWithErrorMessage("An absolute path was not provided");
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
browser_context =
|
browser_context =
|
||||||
|
@ -1410,7 +1410,7 @@ v8::Local<v8::Value> FromPath(const base::FilePath& path,
|
||||||
}
|
}
|
||||||
base::Value::Dict options;
|
base::Value::Dict options;
|
||||||
args->GetNext(&options);
|
args->GetNext(&options);
|
||||||
absl::optional<gin::Handle<Session>> session_handle =
|
std::optional<gin::Handle<Session>> session_handle =
|
||||||
Session::FromPath(args->isolate(), path, std::move(options));
|
Session::FromPath(args->isolate(), path, std::move(options));
|
||||||
|
|
||||||
if (session_handle)
|
if (session_handle)
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_SESSION_H_
|
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_SESSION_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_SESSION_H_
|
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_SESSION_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -85,7 +86,7 @@ class Session : public gin::Wrappable<Session>,
|
||||||
base::Value::Dict options = {});
|
base::Value::Dict options = {});
|
||||||
|
|
||||||
// Gets the Session based on |path|.
|
// Gets the Session based on |path|.
|
||||||
static absl::optional<gin::Handle<Session>> FromPath(
|
static std::optional<gin::Handle<Session>> FromPath(
|
||||||
v8::Isolate* isolate,
|
v8::Isolate* isolate,
|
||||||
const base::FilePath& path,
|
const base::FilePath& path,
|
||||||
base::Value::Dict options = {});
|
base::Value::Dict options = {});
|
||||||
|
@ -101,7 +102,7 @@ class Session : public gin::Wrappable<Session>,
|
||||||
// Methods.
|
// Methods.
|
||||||
v8::Local<v8::Promise> ResolveHost(
|
v8::Local<v8::Promise> ResolveHost(
|
||||||
std::string host,
|
std::string host,
|
||||||
absl::optional<network::mojom::ResolveHostParametersPtr> params);
|
std::optional<network::mojom::ResolveHostParametersPtr> params);
|
||||||
v8::Local<v8::Promise> ResolveProxy(gin::Arguments* args);
|
v8::Local<v8::Promise> ResolveProxy(gin::Arguments* args);
|
||||||
v8::Local<v8::Promise> GetCacheSize();
|
v8::Local<v8::Promise> GetCacheSize();
|
||||||
v8::Local<v8::Promise> ClearCache();
|
v8::Local<v8::Promise> ClearCache();
|
||||||
|
|
|
@ -51,7 +51,7 @@ gin::WrapperInfo Tray::kWrapperInfo = {gin::kEmbedderNativeGin};
|
||||||
|
|
||||||
Tray::Tray(v8::Isolate* isolate,
|
Tray::Tray(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> image,
|
v8::Local<v8::Value> image,
|
||||||
absl::optional<UUID> guid)
|
std::optional<UUID> guid)
|
||||||
: tray_icon_(TrayIcon::Create(guid)) {
|
: tray_icon_(TrayIcon::Create(guid)) {
|
||||||
SetImage(isolate, image);
|
SetImage(isolate, image);
|
||||||
tray_icon_->AddObserver(this);
|
tray_icon_->AddObserver(this);
|
||||||
|
@ -62,7 +62,7 @@ Tray::~Tray() = default;
|
||||||
// static
|
// static
|
||||||
gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
|
gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
|
||||||
v8::Local<v8::Value> image,
|
v8::Local<v8::Value> image,
|
||||||
absl::optional<UUID> guid,
|
std::optional<UUID> guid,
|
||||||
gin::Arguments* args) {
|
gin::Arguments* args) {
|
||||||
if (!Browser::Get()->is_ready()) {
|
if (!Browser::Get()->is_ready()) {
|
||||||
thrower.ThrowError("Cannot create Tray before app is ready");
|
thrower.ThrowError("Cannot create Tray before app is ready");
|
||||||
|
@ -232,7 +232,7 @@ void Tray::SetToolTip(const std::string& tool_tip) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tray::SetTitle(const std::string& title,
|
void Tray::SetTitle(const std::string& title,
|
||||||
const absl::optional<gin_helper::Dictionary>& options,
|
const std::optional<gin_helper::Dictionary>& options,
|
||||||
gin::Arguments* args) {
|
gin::Arguments* args) {
|
||||||
if (!CheckAlive())
|
if (!CheckAlive())
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_TRAY_H_
|
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_TRAY_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -43,7 +44,7 @@ class Tray : public gin::Wrappable<Tray>,
|
||||||
// gin_helper::Constructible
|
// gin_helper::Constructible
|
||||||
static gin::Handle<Tray> New(gin_helper::ErrorThrower thrower,
|
static gin::Handle<Tray> New(gin_helper::ErrorThrower thrower,
|
||||||
v8::Local<v8::Value> image,
|
v8::Local<v8::Value> image,
|
||||||
absl::optional<UUID> guid,
|
std::optional<UUID> guid,
|
||||||
gin::Arguments* args);
|
gin::Arguments* args);
|
||||||
|
|
||||||
static void FillObjectTemplate(v8::Isolate*, v8::Local<v8::ObjectTemplate>);
|
static void FillObjectTemplate(v8::Isolate*, v8::Local<v8::ObjectTemplate>);
|
||||||
|
@ -60,7 +61,7 @@ class Tray : public gin::Wrappable<Tray>,
|
||||||
private:
|
private:
|
||||||
Tray(v8::Isolate* isolate,
|
Tray(v8::Isolate* isolate,
|
||||||
v8::Local<v8::Value> image,
|
v8::Local<v8::Value> image,
|
||||||
absl::optional<UUID> guid);
|
std::optional<UUID> guid);
|
||||||
~Tray() override;
|
~Tray() override;
|
||||||
|
|
||||||
// TrayIconObserver:
|
// TrayIconObserver:
|
||||||
|
@ -92,7 +93,7 @@ class Tray : public gin::Wrappable<Tray>,
|
||||||
void SetPressedImage(v8::Isolate* isolate, v8::Local<v8::Value> image);
|
void SetPressedImage(v8::Isolate* isolate, v8::Local<v8::Value> image);
|
||||||
void SetToolTip(const std::string& tool_tip);
|
void SetToolTip(const std::string& tool_tip);
|
||||||
void SetTitle(const std::string& title,
|
void SetTitle(const std::string& title,
|
||||||
const absl::optional<gin_helper::Dictionary>& options,
|
const std::optional<gin_helper::Dictionary>& options,
|
||||||
gin::Arguments* args);
|
gin::Arguments* args);
|
||||||
std::string GetTitle();
|
std::string GetTitle();
|
||||||
void SetIgnoreDoubleClickEvents(bool ignore);
|
void SetIgnoreDoubleClickEvents(bool ignore);
|
||||||
|
|
|
@ -182,7 +182,7 @@ View::~View() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::AddChildViewAt(gin::Handle<View> child,
|
void View::AddChildViewAt(gin::Handle<View> child,
|
||||||
absl::optional<size_t> maybe_index) {
|
std::optional<size_t> maybe_index) {
|
||||||
// TODO(nornagon): !view_ is only for supporting the weird case of
|
// TODO(nornagon): !view_ is only for supporting the weird case of
|
||||||
// WebContentsView's view being deleted when the underlying WebContents is
|
// WebContentsView's view being deleted when the underlying WebContents is
|
||||||
// destroyed (on non-Mac). We should fix that so that WebContentsView always
|
// destroyed (on non-Mac). We should fix that so that WebContentsView always
|
||||||
|
@ -292,7 +292,7 @@ std::vector<v8::Local<v8::Value>> View::GetChildren() {
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void View::SetBackgroundColor(absl::optional<WrappedSkColor> color) {
|
void View::SetBackgroundColor(std::optional<WrappedSkColor> color) {
|
||||||
if (!view_)
|
if (!view_)
|
||||||
return;
|
return;
|
||||||
view_->SetBackground(color ? views::CreateSolidBackground(*color) : nullptr);
|
view_->SetBackground(color ? views::CreateSolidBackground(*color) : nullptr);
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_
|
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_
|
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_VIEW_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "gin/handle.h"
|
#include "gin/handle.h"
|
||||||
#include "shell/common/color_util.h"
|
#include "shell/common/color_util.h"
|
||||||
|
@ -26,14 +28,14 @@ class View : public gin_helper::EventEmitter<View>, public views::ViewObserver {
|
||||||
static void BuildPrototype(v8::Isolate* isolate,
|
static void BuildPrototype(v8::Isolate* isolate,
|
||||||
v8::Local<v8::FunctionTemplate> prototype);
|
v8::Local<v8::FunctionTemplate> prototype);
|
||||||
|
|
||||||
void AddChildViewAt(gin::Handle<View> child, absl::optional<size_t> index);
|
void AddChildViewAt(gin::Handle<View> child, std::optional<size_t> index);
|
||||||
void RemoveChildView(gin::Handle<View> child);
|
void RemoveChildView(gin::Handle<View> child);
|
||||||
|
|
||||||
void SetBounds(const gfx::Rect& bounds);
|
void SetBounds(const gfx::Rect& bounds);
|
||||||
gfx::Rect GetBounds();
|
gfx::Rect GetBounds();
|
||||||
void SetLayout(v8::Isolate* isolate, v8::Local<v8::Object> value);
|
void SetLayout(v8::Isolate* isolate, v8::Local<v8::Object> value);
|
||||||
std::vector<v8::Local<v8::Value>> GetChildren();
|
std::vector<v8::Local<v8::Value>> GetChildren();
|
||||||
void SetBackgroundColor(absl::optional<WrappedSkColor> color);
|
void SetBackgroundColor(std::optional<WrappedSkColor> color);
|
||||||
void SetVisible(bool visible);
|
void SetVisible(bool visible);
|
||||||
|
|
||||||
// views::ViewObserver
|
// views::ViewObserver
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
@ -128,7 +129,6 @@
|
||||||
#include "shell/common/thread_restrictions.h"
|
#include "shell/common/thread_restrictions.h"
|
||||||
#include "shell/common/v8_value_serializer.h"
|
#include "shell/common/v8_value_serializer.h"
|
||||||
#include "storage/browser/file_system/isolated_context.h"
|
#include "storage/browser/file_system/isolated_context.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
|
||||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||||
#include "third_party/blink/public/common/messaging/transferable_message_mojom_traits.h"
|
#include "third_party/blink/public/common/messaging/transferable_message_mojom_traits.h"
|
||||||
|
@ -496,9 +496,9 @@ void OnCapturePageDone(gin_helper::Promise<gfx::Image> promise,
|
||||||
capture_handle.RunAndReset();
|
capture_handle.RunAndReset();
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
|
std::optional<base::TimeDelta> GetCursorBlinkInterval() {
|
||||||
#if BUILDFLAG(IS_MAC)
|
#if BUILDFLAG(IS_MAC)
|
||||||
absl::optional<base::TimeDelta> system_value(
|
std::optional<base::TimeDelta> system_value(
|
||||||
ui::TextInsertionCaretBlinkPeriodFromDefaults());
|
ui::TextInsertionCaretBlinkPeriodFromDefaults());
|
||||||
if (system_value)
|
if (system_value)
|
||||||
return *system_value;
|
return *system_value;
|
||||||
|
@ -512,7 +512,7 @@ absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
|
||||||
: base::Milliseconds(system_msec);
|
: base::Milliseconds(system_msec);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if BUILDFLAG(ENABLE_PRINTING)
|
#if BUILDFLAG(ENABLE_PRINTING)
|
||||||
|
@ -1104,7 +1104,7 @@ void WebContents::Destroy() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::Close(absl::optional<gin_helper::Dictionary> options) {
|
void WebContents::Close(std::optional<gin_helper::Dictionary> options) {
|
||||||
bool dispatch_beforeunload = false;
|
bool dispatch_beforeunload = false;
|
||||||
if (options)
|
if (options)
|
||||||
options->Get("waitForBeforeUnload", &dispatch_beforeunload);
|
options->Get("waitForBeforeUnload", &dispatch_beforeunload);
|
||||||
|
@ -1675,7 +1675,7 @@ void WebContents::HandleNewRenderFrame(
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::OnBackgroundColorChanged() {
|
void WebContents::OnBackgroundColorChanged() {
|
||||||
absl::optional<SkColor> color = web_contents()->GetBackgroundColor();
|
std::optional<SkColor> color = web_contents()->GetBackgroundColor();
|
||||||
if (color.has_value()) {
|
if (color.has_value()) {
|
||||||
auto* const view = web_contents()->GetRenderWidgetHostView();
|
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||||
static_cast<content::RenderWidgetHostViewBase*>(view)
|
static_cast<content::RenderWidgetHostViewBase*>(view)
|
||||||
|
@ -2266,7 +2266,7 @@ void WebContents::SetOwnerWindow(NativeWindow* owner_window) {
|
||||||
SetOwnerWindow(GetWebContents(), owner_window);
|
SetOwnerWindow(GetWebContents(), owner_window);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::SetOwnerBaseWindow(absl::optional<BaseWindow*> owner_window) {
|
void WebContents::SetOwnerBaseWindow(std::optional<BaseWindow*> owner_window) {
|
||||||
SetOwnerWindow(GetWebContents(),
|
SetOwnerWindow(GetWebContents(),
|
||||||
owner_window ? (*owner_window)->window() : nullptr);
|
owner_window ? (*owner_window)->window() : nullptr);
|
||||||
}
|
}
|
||||||
|
@ -3169,8 +3169,8 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
|
||||||
web_contents()->GetPrimaryMainFrame()->GetLastCommittedURL(),
|
web_contents()->GetPrimaryMainFrame()->GetLastCommittedURL(),
|
||||||
landscape, display_header_footer, print_background, scale,
|
landscape, display_header_footer, print_background, scale,
|
||||||
paper_width, paper_height, margin_top, margin_bottom, margin_left,
|
paper_width, paper_height, margin_top, margin_bottom, margin_left,
|
||||||
margin_right, absl::make_optional(header_template),
|
margin_right, std::make_optional(header_template),
|
||||||
absl::make_optional(footer_template), prefer_css_page_size,
|
std::make_optional(footer_template), prefer_css_page_size,
|
||||||
generate_tagged_pdf, generate_document_outline);
|
generate_tagged_pdf, generate_document_outline);
|
||||||
|
|
||||||
if (absl::holds_alternative<std::string>(print_pages_params)) {
|
if (absl::holds_alternative<std::string>(print_pages_params)) {
|
||||||
|
@ -3780,7 +3780,7 @@ void WebContents::SetImageAnimationPolicy(const std::string& new_policy) {
|
||||||
web_contents()->OnWebPreferencesChanged();
|
web_contents()->OnWebPreferencesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContents::SetBackgroundColor(absl::optional<SkColor> maybe_color) {
|
void WebContents::SetBackgroundColor(std::optional<SkColor> maybe_color) {
|
||||||
SkColor color = maybe_color.value_or((IsGuest() && guest_transparent_) ||
|
SkColor color = maybe_color.value_or((IsGuest() && guest_transparent_) ||
|
||||||
type_ == Type::kBrowserView
|
type_ == Type::kBrowserView
|
||||||
? SK_ColorTRANSPARENT
|
? SK_ColorTRANSPARENT
|
||||||
|
@ -4124,7 +4124,7 @@ void WebContents::DevToolsIndexPath(
|
||||||
if (devtools_indexing_jobs_.count(request_id) != 0)
|
if (devtools_indexing_jobs_.count(request_id) != 0)
|
||||||
return;
|
return;
|
||||||
std::vector<std::string> excluded_folders;
|
std::vector<std::string> excluded_folders;
|
||||||
absl::optional<base::Value> parsed_excluded_folders =
|
std::optional<base::Value> parsed_excluded_folders =
|
||||||
base::JSONReader::Read(excluded_folders_message);
|
base::JSONReader::Read(excluded_folders_message);
|
||||||
if (parsed_excluded_folders && parsed_excluded_folders->is_list()) {
|
if (parsed_excluded_folders && parsed_excluded_folders->is_list()) {
|
||||||
for (const base::Value& folder_path : parsed_excluded_folders->GetList()) {
|
for (const base::Value& folder_path : parsed_excluded_folders->GetList()) {
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -164,7 +165,7 @@ class WebContents : public ExclusiveAccessContext,
|
||||||
const char* GetTypeName() override;
|
const char* GetTypeName() override;
|
||||||
|
|
||||||
void Destroy();
|
void Destroy();
|
||||||
void Close(absl::optional<gin_helper::Dictionary> options);
|
void Close(std::optional<gin_helper::Dictionary> options);
|
||||||
base::WeakPtr<WebContents> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
|
base::WeakPtr<WebContents> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
|
||||||
|
|
||||||
bool GetBackgroundThrottling() const override;
|
bool GetBackgroundThrottling() const override;
|
||||||
|
@ -403,7 +404,7 @@ class WebContents : public ExclusiveAccessContext,
|
||||||
void SetOwnerWindow(NativeWindow* owner_window);
|
void SetOwnerWindow(NativeWindow* owner_window);
|
||||||
void SetOwnerWindow(content::WebContents* web_contents,
|
void SetOwnerWindow(content::WebContents* web_contents,
|
||||||
NativeWindow* owner_window);
|
NativeWindow* owner_window);
|
||||||
void SetOwnerBaseWindow(absl::optional<BaseWindow*> owner_window);
|
void SetOwnerBaseWindow(std::optional<BaseWindow*> owner_window);
|
||||||
|
|
||||||
// Returns the WebContents managed by this delegate.
|
// Returns the WebContents managed by this delegate.
|
||||||
content::WebContents* GetWebContents() const;
|
content::WebContents* GetWebContents() const;
|
||||||
|
@ -474,7 +475,7 @@ class WebContents : public ExclusiveAccessContext,
|
||||||
void CancelDialogs(content::WebContents* web_contents,
|
void CancelDialogs(content::WebContents* web_contents,
|
||||||
bool reset_state) override;
|
bool reset_state) override;
|
||||||
|
|
||||||
void SetBackgroundColor(absl::optional<SkColor> color);
|
void SetBackgroundColor(std::optional<SkColor> color);
|
||||||
|
|
||||||
SkRegion* draggable_region() {
|
SkRegion* draggable_region() {
|
||||||
return force_non_draggable_ ? nullptr : draggable_region_.get();
|
return force_non_draggable_ ? nullptr : draggable_region_.get();
|
||||||
|
|
|
@ -66,7 +66,7 @@ gin::Handle<WebContents> WebContentsView::GetWebContents(v8::Isolate* isolate) {
|
||||||
return gin::Handle<WebContents>();
|
return gin::Handle<WebContents>();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WebContentsView::SetBackgroundColor(absl::optional<WrappedSkColor> color) {
|
void WebContentsView::SetBackgroundColor(std::optional<WrappedSkColor> color) {
|
||||||
View::SetBackgroundColor(color);
|
View::SetBackgroundColor(color);
|
||||||
if (api_web_contents_) {
|
if (api_web_contents_) {
|
||||||
api_web_contents_->SetBackgroundColor(color);
|
api_web_contents_->SetBackgroundColor(color);
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_CONTENTS_VIEW_H_
|
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_CONTENTS_VIEW_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_CONTENTS_VIEW_H_
|
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_CONTENTS_VIEW_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "content/public/browser/web_contents_observer.h"
|
#include "content/public/browser/web_contents_observer.h"
|
||||||
#include "shell/browser/api/electron_api_view.h"
|
#include "shell/browser/api/electron_api_view.h"
|
||||||
|
@ -36,7 +38,7 @@ class WebContentsView : public View,
|
||||||
|
|
||||||
// Public APIs.
|
// Public APIs.
|
||||||
gin::Handle<WebContents> GetWebContents(v8::Isolate* isolate);
|
gin::Handle<WebContents> GetWebContents(v8::Isolate* isolate);
|
||||||
void SetBackgroundColor(absl::optional<WrappedSkColor> color);
|
void SetBackgroundColor(std::optional<WrappedSkColor> color);
|
||||||
|
|
||||||
int NonClientHitTest(const gfx::Point& point) override;
|
int NonClientHitTest(const gfx::Point& point) override;
|
||||||
|
|
||||||
|
|
|
@ -229,7 +229,7 @@ void WebFrameMain::OnRendererConnectionError() {
|
||||||
void WebFrameMain::PostMessage(v8::Isolate* isolate,
|
void WebFrameMain::PostMessage(v8::Isolate* isolate,
|
||||||
const std::string& channel,
|
const std::string& channel,
|
||||||
v8::Local<v8::Value> message_value,
|
v8::Local<v8::Value> message_value,
|
||||||
absl::optional<v8::Local<v8::Value>> transfer) {
|
std::optional<v8::Local<v8::Value>> transfer) {
|
||||||
blink::TransferableMessage transferable_message;
|
blink::TransferableMessage transferable_message;
|
||||||
if (!electron::SerializeV8Value(isolate, message_value,
|
if (!electron::SerializeV8Value(isolate, message_value,
|
||||||
&transferable_message)) {
|
&transferable_message)) {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_FRAME_MAIN_H_
|
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_FRAME_MAIN_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_FRAME_MAIN_H_
|
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_WEB_FRAME_MAIN_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -103,7 +104,7 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
|
||||||
void PostMessage(v8::Isolate* isolate,
|
void PostMessage(v8::Isolate* isolate,
|
||||||
const std::string& channel,
|
const std::string& channel,
|
||||||
v8::Local<v8::Value> message_value,
|
v8::Local<v8::Value> message_value,
|
||||||
absl::optional<v8::Local<v8::Value>> transfer);
|
std::optional<v8::Local<v8::Value>> transfer);
|
||||||
|
|
||||||
int FrameTreeNodeID() const;
|
int FrameTreeNodeID() const;
|
||||||
std::string Name() const;
|
std::string Name() const;
|
||||||
|
|
|
@ -5,10 +5,9 @@
|
||||||
#include "shell/browser/api/process_metric.h"
|
#include "shell/browser/api/process_metric.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
|
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
@ -34,14 +33,14 @@ mach_port_t TaskForPid(pid_t pid) {
|
||||||
return task;
|
return task;
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<mach_task_basic_info_data_t> GetTaskInfo(mach_port_t task) {
|
std::optional<mach_task_basic_info_data_t> GetTaskInfo(mach_port_t task) {
|
||||||
if (task == MACH_PORT_NULL)
|
if (task == MACH_PORT_NULL)
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
mach_task_basic_info_data_t info = {};
|
mach_task_basic_info_data_t info = {};
|
||||||
mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT;
|
mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT;
|
||||||
kern_return_t kr = task_info(task, MACH_TASK_BASIC_INFO,
|
kern_return_t kr = task_info(task, MACH_TASK_BASIC_INFO,
|
||||||
reinterpret_cast<task_info_t>(&info), &count);
|
reinterpret_cast<task_info_t>(&info), &count);
|
||||||
return (kr == KERN_SUCCESS) ? absl::make_optional(info) : absl::nullopt;
|
return (kr == KERN_SUCCESS) ? std::make_optional(info) : std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
|
@ -67,7 +67,7 @@ void BadgeManager::BindServiceWorkerReceiver(
|
||||||
std::move(context));
|
std::move(context));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BadgeManager::GetBadgeString(absl::optional<int> badge_content) {
|
std::string BadgeManager::GetBadgeString(std::optional<int> badge_content) {
|
||||||
if (!badge_content)
|
if (!badge_content)
|
||||||
return "•";
|
return "•";
|
||||||
|
|
||||||
|
@ -87,9 +87,9 @@ void BadgeManager::SetBadge(blink::mojom::BadgeValuePtr mojo_value) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<int> value =
|
std::optional<int> value = mojo_value->is_flag()
|
||||||
mojo_value->is_flag() ? absl::nullopt
|
? std::nullopt
|
||||||
: absl::make_optional(mojo_value->get_number());
|
: std::make_optional(mojo_value->get_number());
|
||||||
|
|
||||||
electron::Browser::Get()->SetBadgeCount(value);
|
electron::Browser::Get()->SetBadgeCount(value);
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_BADGING_BADGE_MANAGER_H_
|
#define ELECTRON_SHELL_BROWSER_BADGING_BADGE_MANAGER_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "components/keyed_service/core/keyed_service.h"
|
#include "components/keyed_service/core/keyed_service.h"
|
||||||
#include "mojo/public/cpp/bindings/receiver_set.h"
|
#include "mojo/public/cpp/bindings/receiver_set.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
|
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
|
@ -44,7 +44,7 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService {
|
||||||
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
|
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
|
||||||
|
|
||||||
// Determines the text to put on the badge based on some badge_content.
|
// Determines the text to put on the badge based on some badge_content.
|
||||||
static std::string GetBadgeString(absl::optional<int> badge_content);
|
static std::string GetBadgeString(std::optional<int> badge_content);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The BindingContext of a mojo request. Allows mojo calls to be tied back
|
// The BindingContext of a mojo request. Allows mojo calls to be tied back
|
||||||
|
|
|
@ -161,7 +161,7 @@ void ElectronBluetoothDelegate::ShowDevicePairPrompt(
|
||||||
const std::u16string& device_identifier,
|
const std::u16string& device_identifier,
|
||||||
PairPromptCallback callback,
|
PairPromptCallback callback,
|
||||||
PairingKind pairing_kind,
|
PairingKind pairing_kind,
|
||||||
const absl::optional<std::u16string>& pin) {
|
const std::optional<std::u16string>& pin) {
|
||||||
auto* web_contents = content::WebContents::FromRenderFrameHost(frame);
|
auto* web_contents = content::WebContents::FromRenderFrameHost(frame);
|
||||||
if (web_contents) {
|
if (web_contents) {
|
||||||
auto* permission_manager = static_cast<ElectronPermissionManager*>(
|
auto* permission_manager = static_cast<ElectronPermissionManager*>(
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_BLUETOOTH_ELECTRON_BLUETOOTH_DELEGATE_H_
|
#define ELECTRON_SHELL_BROWSER_BLUETOOTH_ELECTRON_BLUETOOTH_DELEGATE_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -57,7 +58,7 @@ class ElectronBluetoothDelegate : public content::BluetoothDelegate {
|
||||||
const std::u16string& device_identifier,
|
const std::u16string& device_identifier,
|
||||||
PairPromptCallback callback,
|
PairPromptCallback callback,
|
||||||
PairingKind pairing_kind,
|
PairingKind pairing_kind,
|
||||||
const absl::optional<std::u16string>& pin) override;
|
const std::optional<std::u16string>& pin) override;
|
||||||
blink::WebBluetoothDeviceId GetWebBluetoothDeviceId(
|
blink::WebBluetoothDeviceId GetWebBluetoothDeviceId(
|
||||||
content::RenderFrameHost* frame,
|
content::RenderFrameHost* frame,
|
||||||
const std::string& device_address) override;
|
const std::string& device_address) override;
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_BROWSER_H_
|
#define ELECTRON_SHELL_BROWSER_BROWSER_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -108,7 +109,7 @@ class Browser : public WindowListObserver {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Set/Get the badge count.
|
// Set/Get the badge count.
|
||||||
bool SetBadgeCount(absl::optional<int> count);
|
bool SetBadgeCount(std::optional<int> count);
|
||||||
int GetBadgeCount();
|
int GetBadgeCount();
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
|
@ -374,7 +375,7 @@ class Browser : public WindowListObserver {
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
void UpdateBadgeContents(HWND hwnd,
|
void UpdateBadgeContents(HWND hwnd,
|
||||||
const absl::optional<std::string>& badge_content,
|
const std::optional<std::string>& badge_content,
|
||||||
const std::string& badge_alt_string);
|
const std::string& badge_alt_string);
|
||||||
|
|
||||||
// In charge of running taskbar related APIs.
|
// In charge of running taskbar related APIs.
|
||||||
|
|
|
@ -49,7 +49,7 @@ bool LaunchXdgUtility(const std::vector<std::string>& argv, int* exit_code) {
|
||||||
return process.WaitForExit(exit_code);
|
return process.WaitForExit(exit_code);
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<std::string> GetXdgAppOutput(
|
std::optional<std::string> GetXdgAppOutput(
|
||||||
const std::vector<std::string>& argv) {
|
const std::vector<std::string>& argv) {
|
||||||
std::string reply;
|
std::string reply;
|
||||||
int success_code;
|
int success_code;
|
||||||
|
@ -58,9 +58,9 @@ absl::optional<std::string> GetXdgAppOutput(
|
||||||
&success_code);
|
&success_code);
|
||||||
|
|
||||||
if (!ran_ok || success_code != EXIT_SUCCESS)
|
if (!ran_ok || success_code != EXIT_SUCCESS)
|
||||||
return absl::optional<std::string>();
|
return std::optional<std::string>();
|
||||||
|
|
||||||
return absl::make_optional(reply);
|
return std::make_optional(reply);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SetDefaultWebClient(const std::string& protocol) {
|
bool SetDefaultWebClient(const std::string& protocol) {
|
||||||
|
@ -126,7 +126,7 @@ std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) {
|
||||||
return base::ASCIIToUTF16(GetXdgAppOutput(argv).value_or(std::string()));
|
return base::ASCIIToUTF16(GetXdgAppOutput(argv).value_or(std::string()));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Browser::SetBadgeCount(absl::optional<int> count) {
|
bool Browser::SetBadgeCount(std::optional<int> count) {
|
||||||
if (IsUnityRunning() && count.has_value()) {
|
if (IsUnityRunning() && count.has_value()) {
|
||||||
unity::SetDownloadCount(count.value());
|
unity::SetDownloadCount(count.value());
|
||||||
badge_count_ = count.value();
|
badge_count_ = count.value();
|
||||||
|
|
|
@ -266,7 +266,7 @@ std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) {
|
||||||
return app_display_name;
|
return app_display_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Browser::SetBadgeCount(absl::optional<int> count) {
|
bool Browser::SetBadgeCount(std::optional<int> count) {
|
||||||
DockSetBadgeText(!count.has_value() || count.value() != 0
|
DockSetBadgeText(!count.has_value() || count.value() != 0
|
||||||
? badging::BadgeManager::GetBadgeString(count)
|
? badging::BadgeManager::GetBadgeString(count)
|
||||||
: "");
|
: "");
|
||||||
|
|
|
@ -516,10 +516,10 @@ v8::Local<v8::Promise> Browser::GetApplicationInfoForProtocol(
|
||||||
return handle;
|
return handle;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Browser::SetBadgeCount(absl::optional<int> count) {
|
bool Browser::SetBadgeCount(std::optional<int> count) {
|
||||||
absl::optional<std::string> badge_content;
|
std::optional<std::string> badge_content;
|
||||||
if (count.has_value() && count.value() == 0) {
|
if (count.has_value() && count.value() == 0) {
|
||||||
badge_content = absl::nullopt;
|
badge_content = std::nullopt;
|
||||||
} else {
|
} else {
|
||||||
badge_content = badging::BadgeManager::GetBadgeString(count);
|
badge_content = badging::BadgeManager::GetBadgeString(count);
|
||||||
}
|
}
|
||||||
|
@ -560,7 +560,7 @@ bool Browser::SetBadgeCount(absl::optional<int> count) {
|
||||||
|
|
||||||
void Browser::UpdateBadgeContents(
|
void Browser::UpdateBadgeContents(
|
||||||
HWND hwnd,
|
HWND hwnd,
|
||||||
const absl::optional<std::string>& badge_content,
|
const std::optional<std::string>& badge_content,
|
||||||
const std::string& badge_alt_string) {
|
const std::string& badge_alt_string) {
|
||||||
SkBitmap badge;
|
SkBitmap badge;
|
||||||
if (badge_content) {
|
if (badge_content) {
|
||||||
|
|
|
@ -924,7 +924,7 @@ bool ElectronBrowserClient::HandleExternalProtocol(
|
||||||
network::mojom::WebSandboxFlags sandbox_flags,
|
network::mojom::WebSandboxFlags sandbox_flags,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
bool has_user_gesture,
|
bool has_user_gesture,
|
||||||
const absl::optional<url::Origin>& initiating_origin,
|
const std::optional<url::Origin>& initiating_origin,
|
||||||
content::RenderFrameHost* initiator_document,
|
content::RenderFrameHost* initiator_document,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||||
content::GetUIThreadTaskRunner({})->PostTask(
|
content::GetUIThreadTaskRunner({})->PostTask(
|
||||||
|
@ -1129,7 +1129,7 @@ class FileURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
|
||||||
void ElectronBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
void ElectronBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_frame_id,
|
int render_frame_id,
|
||||||
const absl::optional<url::Origin>& request_initiator_origin,
|
const std::optional<url::Origin>& request_initiator_origin,
|
||||||
NonNetworkURLLoaderFactoryMap* factories) {
|
NonNetworkURLLoaderFactoryMap* factories) {
|
||||||
auto* render_process_host =
|
auto* render_process_host =
|
||||||
content::RenderProcessHost::FromID(render_process_id);
|
content::RenderProcessHost::FromID(render_process_id);
|
||||||
|
@ -1265,7 +1265,7 @@ void ElectronBrowserClient::CreateWebSocket(
|
||||||
WebSocketFactory factory,
|
WebSocketFactory factory,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
const net::SiteForCookies& site_for_cookies,
|
const net::SiteForCookies& site_for_cookies,
|
||||||
const absl::optional<std::string>& user_agent,
|
const std::optional<std::string>& user_agent,
|
||||||
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
||||||
handshake_client) {
|
handshake_client) {
|
||||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||||
|
@ -1302,7 +1302,7 @@ bool ElectronBrowserClient::WillCreateURLLoaderFactory(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
URLLoaderFactoryType type,
|
URLLoaderFactoryType type,
|
||||||
const url::Origin& request_initiator,
|
const url::Origin& request_initiator,
|
||||||
absl::optional<int64_t> navigation_id,
|
std::optional<int64_t> navigation_id,
|
||||||
ukm::SourceIdObj ukm_source_id,
|
ukm::SourceIdObj ukm_source_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||||
|
|
|
@ -201,7 +201,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||||
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
int render_frame_id,
|
int render_frame_id,
|
||||||
const absl::optional<url::Origin>& request_initiator_origin,
|
const std::optional<url::Origin>& request_initiator_origin,
|
||||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||||
void RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
|
void RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
|
@ -211,7 +211,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||||
WebSocketFactory factory,
|
WebSocketFactory factory,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
const net::SiteForCookies& site_for_cookies,
|
const net::SiteForCookies& site_for_cookies,
|
||||||
const absl::optional<std::string>& user_agent,
|
const std::optional<std::string>& user_agent,
|
||||||
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
||||||
handshake_client) override;
|
handshake_client) override;
|
||||||
bool WillInterceptWebSocket(content::RenderFrameHost*) override;
|
bool WillInterceptWebSocket(content::RenderFrameHost*) override;
|
||||||
|
@ -221,7 +221,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||||
int render_process_id,
|
int render_process_id,
|
||||||
URLLoaderFactoryType type,
|
URLLoaderFactoryType type,
|
||||||
const url::Origin& request_initiator,
|
const url::Origin& request_initiator,
|
||||||
absl::optional<int64_t> navigation_id,
|
std::optional<int64_t> navigation_id,
|
||||||
ukm::SourceIdObj ukm_source_id,
|
ukm::SourceIdObj ukm_source_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||||
|
@ -263,7 +263,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
||||||
network::mojom::WebSandboxFlags sandbox_flags,
|
network::mojom::WebSandboxFlags sandbox_flags,
|
||||||
ui::PageTransition page_transition,
|
ui::PageTransition page_transition,
|
||||||
bool has_user_gesture,
|
bool has_user_gesture,
|
||||||
const absl::optional<url::Origin>& initiating_origin,
|
const std::optional<url::Origin>& initiating_origin,
|
||||||
content::RenderFrameHost* initiator_document,
|
content::RenderFrameHost* initiator_document,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||||
override;
|
override;
|
||||||
|
|
|
@ -447,7 +447,7 @@ ElectronBrowserContext::GetURLLoaderFactory() {
|
||||||
->WillCreateURLLoaderFactory(
|
->WillCreateURLLoaderFactory(
|
||||||
this, nullptr, -1,
|
this, nullptr, -1,
|
||||||
content::ContentBrowserClient::URLLoaderFactoryType::kNavigation,
|
content::ContentBrowserClient::URLLoaderFactoryType::kNavigation,
|
||||||
url::Origin(), absl::nullopt, ukm::kInvalidSourceIdObj,
|
url::Origin(), std::nullopt, ukm::kInvalidSourceIdObj,
|
||||||
&factory_receiver, &header_client, nullptr, nullptr, nullptr,
|
&factory_receiver, &header_client, nullptr, nullptr, nullptr,
|
||||||
nullptr);
|
nullptr);
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,11 @@
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <variant>
|
#include <variant>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "chrome/browser/predictors/preconnect_manager.h"
|
#include "chrome/browser/predictors/preconnect_manager.h"
|
||||||
|
@ -253,7 +255,7 @@ class ElectronBrowserContext : public content::BrowserContext {
|
||||||
std::unique_ptr<predictors::PreconnectManager> preconnect_manager_;
|
std::unique_ptr<predictors::PreconnectManager> preconnect_manager_;
|
||||||
std::unique_ptr<ProtocolRegistry> protocol_registry_;
|
std::unique_ptr<ProtocolRegistry> protocol_registry_;
|
||||||
|
|
||||||
absl::optional<std::string> user_agent_;
|
std::optional<std::string> user_agent_;
|
||||||
base::FilePath path_;
|
base::FilePath path_;
|
||||||
bool in_memory_ = false;
|
bool in_memory_ = false;
|
||||||
bool use_cache_ = true;
|
bool use_cache_ = true;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "shell/browser/electron_browser_main_parts.h"
|
#include "shell/browser/electron_browser_main_parts.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -64,7 +65,6 @@
|
||||||
#include "shell/common/logging.h"
|
#include "shell/common/logging.h"
|
||||||
#include "shell/common/node_bindings.h"
|
#include "shell/common/node_bindings.h"
|
||||||
#include "shell/common/node_includes.h"
|
#include "shell/common/node_includes.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/base/idle/idle.h"
|
#include "ui/base/idle/idle.h"
|
||||||
#include "ui/base/l10n/l10n_util.h"
|
#include "ui/base/l10n/l10n_util.h"
|
||||||
#include "ui/base/ui_base_switches.h"
|
#include "ui/base/ui_base_switches.h"
|
||||||
|
@ -308,7 +308,7 @@ int ElectronBrowserMainParts::PreCreateThreads() {
|
||||||
// We must set this env first to make ui::ResourceBundle accept the custom
|
// We must set this env first to make ui::ResourceBundle accept the custom
|
||||||
// locale.
|
// locale.
|
||||||
auto env = base::Environment::Create();
|
auto env = base::Environment::Create();
|
||||||
absl::optional<std::string> lc_all;
|
std::optional<std::string> lc_all;
|
||||||
if (!locale.empty()) {
|
if (!locale.empty()) {
|
||||||
std::string str;
|
std::string str;
|
||||||
if (env->GetVar("LC_ALL", &str))
|
if (env->GetVar("LC_ALL", &str))
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|
#define ELECTRON_SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/functional/callback.h"
|
#include "base/functional/callback.h"
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
#include "electron/buildflags/buildflags.h"
|
#include "electron/buildflags/buildflags.h"
|
||||||
#include "mojo/public/cpp/bindings/remote.h"
|
#include "mojo/public/cpp/bindings/remote.h"
|
||||||
#include "services/device/public/mojom/geolocation_control.mojom.h"
|
#include "services/device/public/mojom/geolocation_control.mojom.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/display/screen.h"
|
#include "ui/display/screen.h"
|
||||||
#include "ui/views/layout/layout_provider.h"
|
#include "ui/views/layout/layout_provider.h"
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ class ElectronBrowserMainParts : public content::BrowserMainParts {
|
||||||
|
|
||||||
// A place to remember the exit code once the message loop is ready.
|
// A place to remember the exit code once the message loop is ready.
|
||||||
// Before then, we just exit() without any intermediate steps.
|
// Before then, we just exit() without any intermediate steps.
|
||||||
absl::optional<int> exit_code_;
|
std::optional<int> exit_code_;
|
||||||
|
|
||||||
std::unique_ptr<NodeBindings> node_bindings_;
|
std::unique_ptr<NodeBindings> node_bindings_;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ PdfViewerPrivateIsAllowedLocalFileAccessFunction::
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction
|
ExtensionFunction::ResponseAction
|
||||||
PdfViewerPrivateIsAllowedLocalFileAccessFunction::Run() {
|
PdfViewerPrivateIsAllowedLocalFileAccessFunction::Run() {
|
||||||
absl::optional<IsAllowedLocalFileAccess::Params> params =
|
std::optional<IsAllowedLocalFileAccess::Params> params =
|
||||||
IsAllowedLocalFileAccess::Params::Create(args());
|
IsAllowedLocalFileAccess::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ PdfViewerPrivateSetPdfOcrPrefFunction::
|
||||||
|
|
||||||
// TODO(codebytere): enable when https://crbug.com/1393069 works properly.
|
// TODO(codebytere): enable when https://crbug.com/1393069 works properly.
|
||||||
ExtensionFunction::ResponseAction PdfViewerPrivateSetPdfOcrPrefFunction::Run() {
|
ExtensionFunction::ResponseAction PdfViewerPrivateSetPdfOcrPrefFunction::Run() {
|
||||||
absl::optional<SetPdfOcrPref::Params> params =
|
std::optional<SetPdfOcrPref::Params> params =
|
||||||
SetPdfOcrPref::Params::Create(args());
|
SetPdfOcrPref::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
return RespondNow(WithArguments(false));
|
return RespondNow(WithArguments(false));
|
||||||
|
|
|
@ -40,7 +40,7 @@ ResourcesPrivateGetStringsFunction::~ResourcesPrivateGetStringsFunction() =
|
||||||
default;
|
default;
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction ResourcesPrivateGetStringsFunction::Run() {
|
ExtensionFunction::ResponseAction ResourcesPrivateGetStringsFunction::Run() {
|
||||||
absl::optional<get_strings::Params> params(
|
std::optional<get_strings::Params> params(
|
||||||
get_strings::Params::Create(args()));
|
get_strings::Params::Create(args()));
|
||||||
base::Value::Dict dict;
|
base::Value::Dict dict;
|
||||||
|
|
||||||
|
|
|
@ -198,14 +198,14 @@ bool GetFileResources(const std::vector<std::string>& files,
|
||||||
|
|
||||||
using ResourcesLoadedCallback =
|
using ResourcesLoadedCallback =
|
||||||
base::OnceCallback<void(std::vector<InjectedFileSource>,
|
base::OnceCallback<void(std::vector<InjectedFileSource>,
|
||||||
absl::optional<std::string>)>;
|
std::optional<std::string>)>;
|
||||||
|
|
||||||
// Checks the loaded content of extension resources. Invokes `callback` with
|
// Checks the loaded content of extension resources. Invokes `callback` with
|
||||||
// the constructed file sources on success or with an error on failure.
|
// the constructed file sources on success or with an error on failure.
|
||||||
void CheckLoadedResources(std::vector<std::string> file_names,
|
void CheckLoadedResources(std::vector<std::string> file_names,
|
||||||
ResourcesLoadedCallback callback,
|
ResourcesLoadedCallback callback,
|
||||||
std::vector<std::unique_ptr<std::string>> file_data,
|
std::vector<std::unique_ptr<std::string>> file_data,
|
||||||
absl::optional<std::string> load_error) {
|
std::optional<std::string> load_error) {
|
||||||
if (load_error) {
|
if (load_error) {
|
||||||
std::move(callback).Run({}, std::move(load_error));
|
std::move(callback).Run({}, std::move(load_error));
|
||||||
return;
|
return;
|
||||||
|
@ -228,7 +228,7 @@ void CheckLoadedResources(std::vector<std::string> file_names,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::move(callback).Run(std::move(file_sources), absl::nullopt);
|
std::move(callback).Run(std::move(file_sources), std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Checks the specified `files` for validity, and attempts to load and localize
|
// Checks the specified `files` for validity, and attempts to load and localize
|
||||||
|
@ -582,7 +582,7 @@ ScriptingExecuteScriptFunction::ScriptingExecuteScriptFunction() = default;
|
||||||
ScriptingExecuteScriptFunction::~ScriptingExecuteScriptFunction() = default;
|
ScriptingExecuteScriptFunction::~ScriptingExecuteScriptFunction() = default;
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction ScriptingExecuteScriptFunction::Run() {
|
ExtensionFunction::ResponseAction ScriptingExecuteScriptFunction::Run() {
|
||||||
absl::optional<api::scripting::ExecuteScript::Params> params =
|
std::optional<api::scripting::ExecuteScript::Params> params =
|
||||||
api::scripting::ExecuteScript::Params::Create(args());
|
api::scripting::ExecuteScript::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
injection_ = std::move(params->injection);
|
injection_ = std::move(params->injection);
|
||||||
|
@ -654,7 +654,7 @@ ExtensionFunction::ResponseAction ScriptingExecuteScriptFunction::Run() {
|
||||||
|
|
||||||
void ScriptingExecuteScriptFunction::DidLoadResources(
|
void ScriptingExecuteScriptFunction::DidLoadResources(
|
||||||
std::vector<InjectedFileSource> file_sources,
|
std::vector<InjectedFileSource> file_sources,
|
||||||
absl::optional<std::string> load_error) {
|
std::optional<std::string> load_error) {
|
||||||
if (load_error) {
|
if (load_error) {
|
||||||
Respond(Error(std::move(*load_error)));
|
Respond(Error(std::move(*load_error)));
|
||||||
return;
|
return;
|
||||||
|
@ -749,7 +749,7 @@ ScriptingInsertCSSFunction::ScriptingInsertCSSFunction() = default;
|
||||||
ScriptingInsertCSSFunction::~ScriptingInsertCSSFunction() = default;
|
ScriptingInsertCSSFunction::~ScriptingInsertCSSFunction() = default;
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction ScriptingInsertCSSFunction::Run() {
|
ExtensionFunction::ResponseAction ScriptingInsertCSSFunction::Run() {
|
||||||
absl::optional<api::scripting::InsertCSS::Params> params =
|
std::optional<api::scripting::InsertCSS::Params> params =
|
||||||
api::scripting::InsertCSS::Params::Create(args());
|
api::scripting::InsertCSS::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -793,7 +793,7 @@ ExtensionFunction::ResponseAction ScriptingInsertCSSFunction::Run() {
|
||||||
|
|
||||||
void ScriptingInsertCSSFunction::DidLoadResources(
|
void ScriptingInsertCSSFunction::DidLoadResources(
|
||||||
std::vector<InjectedFileSource> file_sources,
|
std::vector<InjectedFileSource> file_sources,
|
||||||
absl::optional<std::string> load_error) {
|
std::optional<std::string> load_error) {
|
||||||
if (load_error) {
|
if (load_error) {
|
||||||
Respond(Error(std::move(*load_error)));
|
Respond(Error(std::move(*load_error)));
|
||||||
return;
|
return;
|
||||||
|
@ -850,7 +850,7 @@ ScriptingRemoveCSSFunction::ScriptingRemoveCSSFunction() = default;
|
||||||
ScriptingRemoveCSSFunction::~ScriptingRemoveCSSFunction() = default;
|
ScriptingRemoveCSSFunction::~ScriptingRemoveCSSFunction() = default;
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction ScriptingRemoveCSSFunction::Run() {
|
ExtensionFunction::ResponseAction ScriptingRemoveCSSFunction::Run() {
|
||||||
absl::optional<api::scripting::RemoveCSS::Params> params =
|
std::optional<api::scripting::RemoveCSS::Params> params =
|
||||||
api::scripting::RemoveCSS::Params::Create(args());
|
api::scripting::RemoveCSS::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -929,7 +929,7 @@ ScriptingRegisterContentScriptsFunction::
|
||||||
~ScriptingRegisterContentScriptsFunction() = default;
|
~ScriptingRegisterContentScriptsFunction() = default;
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction ScriptingUpdateContentScriptsFunction::Run() {
|
ExtensionFunction::ResponseAction ScriptingUpdateContentScriptsFunction::Run() {
|
||||||
absl::optional<api::scripting::UpdateContentScripts::Params> params =
|
std::optional<api::scripting::UpdateContentScripts::Params> params =
|
||||||
api::scripting::UpdateContentScripts::Params::Create(args());
|
api::scripting::UpdateContentScripts::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ void ScriptingRegisterContentScriptsFunction::OnContentScriptFilesValidated(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptingRegisterContentScriptsFunction::OnContentScriptsRegistered(
|
void ScriptingRegisterContentScriptsFunction::OnContentScriptsRegistered(
|
||||||
const absl::optional<std::string>& error) {
|
const std::optional<std::string>& error) {
|
||||||
if (error.has_value())
|
if (error.has_value())
|
||||||
Respond(Error(std::move(*error)));
|
Respond(Error(std::move(*error)));
|
||||||
else
|
else
|
||||||
|
@ -1102,11 +1102,11 @@ ScriptingGetRegisteredContentScriptsFunction::
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction
|
ExtensionFunction::ResponseAction
|
||||||
ScriptingGetRegisteredContentScriptsFunction::Run() {
|
ScriptingGetRegisteredContentScriptsFunction::Run() {
|
||||||
absl::optional<api::scripting::GetRegisteredContentScripts::Params> params =
|
std::optional<api::scripting::GetRegisteredContentScripts::Params> params =
|
||||||
api::scripting::GetRegisteredContentScripts::Params::Create(args());
|
api::scripting::GetRegisteredContentScripts::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
const absl::optional<api::scripting::ContentScriptFilter>& filter =
|
const std::optional<api::scripting::ContentScriptFilter>& filter =
|
||||||
params->filter;
|
params->filter;
|
||||||
std::set<std::string> id_filter;
|
std::set<std::string> id_filter;
|
||||||
if (filter && filter->ids) {
|
if (filter && filter->ids) {
|
||||||
|
@ -1157,7 +1157,7 @@ ScriptingUnregisterContentScriptsFunction::Run() {
|
||||||
api::scripting::UnregisterContentScripts::Params::Create(args());
|
api::scripting::UnregisterContentScripts::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
absl::optional<api::scripting::ContentScriptFilter>& filter = params->filter;
|
std::optional<api::scripting::ContentScriptFilter>& filter = params->filter;
|
||||||
ExtensionUserScriptLoader* loader =
|
ExtensionUserScriptLoader* loader =
|
||||||
ExtensionSystem::Get(browser_context())
|
ExtensionSystem::Get(browser_context())
|
||||||
->user_script_manager()
|
->user_script_manager()
|
||||||
|
@ -1206,7 +1206,7 @@ ScriptingUnregisterContentScriptsFunction::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptingUnregisterContentScriptsFunction::OnContentScriptsUnregistered(
|
void ScriptingUnregisterContentScriptsFunction::OnContentScriptsUnregistered(
|
||||||
const absl::optional<std::string>& error) {
|
const std::optional<std::string>& error) {
|
||||||
if (error.has_value())
|
if (error.has_value())
|
||||||
Respond(Error(std::move(*error)));
|
Respond(Error(std::move(*error)));
|
||||||
else
|
else
|
||||||
|
@ -1220,7 +1220,7 @@ ScriptingUpdateContentScriptsFunction::
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction
|
ExtensionFunction::ResponseAction
|
||||||
ScriptingRegisterContentScriptsFunction::Run() {
|
ScriptingRegisterContentScriptsFunction::Run() {
|
||||||
absl::optional<api::scripting::RegisterContentScripts::Params> params =
|
std::optional<api::scripting::RegisterContentScripts::Params> params =
|
||||||
api::scripting::RegisterContentScripts::Params::Create(args());
|
api::scripting::RegisterContentScripts::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -1341,7 +1341,7 @@ void ScriptingUpdateContentScriptsFunction::OnContentScriptFilesValidated(
|
||||||
}
|
}
|
||||||
|
|
||||||
void ScriptingUpdateContentScriptsFunction::OnContentScriptsUpdated(
|
void ScriptingUpdateContentScriptsFunction::OnContentScriptsUpdated(
|
||||||
const absl::optional<std::string>& error) {
|
const std::optional<std::string>& error) {
|
||||||
if (error.has_value())
|
if (error.has_value())
|
||||||
Respond(Error(std::move(*error)));
|
Respond(Error(std::move(*error)));
|
||||||
else
|
else
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_EXTENSIONS_API_SCRIPTING_SCRIPTING_API_H_
|
#define ELECTRON_SHELL_BROWSER_EXTENSIONS_API_SCRIPTING_SCRIPTING_API_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
#include "extensions/browser/script_executor.h"
|
#include "extensions/browser/script_executor.h"
|
||||||
#include "extensions/common/mojom/code_injection.mojom.h"
|
#include "extensions/common/mojom/code_injection.mojom.h"
|
||||||
#include "extensions/common/user_script.h"
|
#include "extensions/common/user_script.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace extensions {
|
namespace extensions {
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ class ScriptingExecuteScriptFunction : public ExtensionFunction {
|
||||||
|
|
||||||
// Called when the resource files to be injected has been loaded.
|
// Called when the resource files to be injected has been loaded.
|
||||||
void DidLoadResources(std::vector<InjectedFileSource> file_sources,
|
void DidLoadResources(std::vector<InjectedFileSource> file_sources,
|
||||||
absl::optional<std::string> load_error);
|
std::optional<std::string> load_error);
|
||||||
|
|
||||||
// Triggers the execution of `sources` in the appropriate context.
|
// Triggers the execution of `sources` in the appropriate context.
|
||||||
// Returns true on success; on failure, populates `error`.
|
// Returns true on success; on failure, populates `error`.
|
||||||
|
@ -78,7 +78,7 @@ class ScriptingInsertCSSFunction : public ExtensionFunction {
|
||||||
|
|
||||||
// Called when the resource files to be injected has been loaded.
|
// Called when the resource files to be injected has been loaded.
|
||||||
void DidLoadResources(std::vector<InjectedFileSource> file_sources,
|
void DidLoadResources(std::vector<InjectedFileSource> file_sources,
|
||||||
absl::optional<std::string> load_error);
|
std::optional<std::string> load_error);
|
||||||
|
|
||||||
// Triggers the execution of `sources` in the appropriate context.
|
// Triggers the execution of `sources` in the appropriate context.
|
||||||
// Returns true on success; on failure, populates `error`.
|
// Returns true on success; on failure, populates `error`.
|
||||||
|
@ -132,7 +132,7 @@ class ScriptingRegisterContentScriptsFunction : public ExtensionFunction {
|
||||||
scripting::ValidateScriptsResult result);
|
scripting::ValidateScriptsResult result);
|
||||||
|
|
||||||
// Called when content scripts have been registered.
|
// Called when content scripts have been registered.
|
||||||
void OnContentScriptsRegistered(const absl::optional<std::string>& error);
|
void OnContentScriptsRegistered(const std::optional<std::string>& error);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptingGetRegisteredContentScriptsFunction : public ExtensionFunction {
|
class ScriptingGetRegisteredContentScriptsFunction : public ExtensionFunction {
|
||||||
|
@ -171,7 +171,7 @@ class ScriptingUnregisterContentScriptsFunction : public ExtensionFunction {
|
||||||
~ScriptingUnregisterContentScriptsFunction() override;
|
~ScriptingUnregisterContentScriptsFunction() override;
|
||||||
|
|
||||||
// Called when content scripts have been unregistered.
|
// Called when content scripts have been unregistered.
|
||||||
void OnContentScriptsUnregistered(const absl::optional<std::string>& error);
|
void OnContentScriptsUnregistered(const std::optional<std::string>& error);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ScriptingUpdateContentScriptsFunction : public ExtensionFunction {
|
class ScriptingUpdateContentScriptsFunction : public ExtensionFunction {
|
||||||
|
@ -197,7 +197,7 @@ class ScriptingUpdateContentScriptsFunction : public ExtensionFunction {
|
||||||
scripting::ValidateScriptsResult result);
|
scripting::ValidateScriptsResult result);
|
||||||
|
|
||||||
// Called when content scripts have been updated.
|
// Called when content scripts have been updated.
|
||||||
void OnContentScriptsUpdated(const absl::optional<std::string>& error);
|
void OnContentScriptsUpdated(const std::optional<std::string>& error);
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace extensions
|
} // namespace extensions
|
||||||
|
|
|
@ -71,7 +71,7 @@ void ZoomModeToZoomSettings(WebContentsZoomController::ZoomMode zoom_mode,
|
||||||
// Returns true if either |boolean| is disengaged, or if |boolean| and
|
// Returns true if either |boolean| is disengaged, or if |boolean| and
|
||||||
// |value| are equal. This function is used to check if a tab's parameters match
|
// |value| are equal. This function is used to check if a tab's parameters match
|
||||||
// those of the browser.
|
// those of the browser.
|
||||||
bool MatchesBool(const absl::optional<bool>& boolean, bool value) {
|
bool MatchesBool(const std::optional<bool>& boolean, bool value) {
|
||||||
return !boolean || *boolean == value;
|
return !boolean || *boolean == value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ bool TabsExecuteScriptFunction::ShouldRemoveCSS() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsReloadFunction::Run() {
|
ExtensionFunction::ResponseAction TabsReloadFunction::Run() {
|
||||||
absl::optional<tabs::Reload::Params> params =
|
std::optional<tabs::Reload::Params> params =
|
||||||
tabs::Reload::Params::Create(args());
|
tabs::Reload::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ ExtensionFunction::ResponseAction TabsReloadFunction::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsQueryFunction::Run() {
|
ExtensionFunction::ResponseAction TabsQueryFunction::Run() {
|
||||||
absl::optional<tabs::Query::Params> params =
|
std::optional<tabs::Query::Params> params =
|
||||||
tabs::Query::Params::Create(args());
|
tabs::Query::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -255,8 +255,8 @@ ExtensionFunction::ResponseAction TabsQueryFunction::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string title = params->query_info.title.value_or(std::string());
|
std::string title = params->query_info.title.value_or(std::string());
|
||||||
absl::optional<bool> audible = params->query_info.audible;
|
std::optional<bool> audible = params->query_info.audible;
|
||||||
absl::optional<bool> muted = params->query_info.muted;
|
std::optional<bool> muted = params->query_info.muted;
|
||||||
|
|
||||||
base::Value::List result;
|
base::Value::List result;
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@ ExtensionFunction::ResponseAction TabsQueryFunction::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsGetFunction::Run() {
|
ExtensionFunction::ResponseAction TabsGetFunction::Run() {
|
||||||
absl::optional<tabs::Get::Params> params = tabs::Get::Params::Create(args());
|
std::optional<tabs::Get::Params> params = tabs::Get::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
int tab_id = params->tab_id;
|
int tab_id = params->tab_id;
|
||||||
|
|
||||||
|
@ -349,7 +349,7 @@ ExtensionFunction::ResponseAction TabsGetFunction::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||||
absl::optional<tabs::SetZoom::Params> params =
|
std::optional<tabs::SetZoom::Params> params =
|
||||||
tabs::SetZoom::Params::Create(args());
|
tabs::SetZoom::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||||
absl::optional<tabs::GetZoomSettings::Params> params =
|
std::optional<tabs::GetZoomSettings::Params> params =
|
||||||
tabs::GetZoomSettings::Params::Create(args());
|
tabs::GetZoomSettings::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -393,7 +393,7 @@ ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||||
}
|
}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||||
absl::optional<tabs::GetZoomSettings::Params> params =
|
std::optional<tabs::GetZoomSettings::Params> params =
|
||||||
tabs::GetZoomSettings::Params::Create(args());
|
tabs::GetZoomSettings::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -417,7 +417,7 @@ ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||||
ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||||
using tabs::ZoomSettings;
|
using tabs::ZoomSettings;
|
||||||
|
|
||||||
absl::optional<tabs::SetZoomSettings::Params> params =
|
std::optional<tabs::SetZoomSettings::Params> params =
|
||||||
tabs::SetZoomSettings::Params::Create(args());
|
tabs::SetZoomSettings::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
@ -588,7 +588,7 @@ base::expected<GURL, std::string> PrepareURLForNavigation(
|
||||||
TabsUpdateFunction::TabsUpdateFunction() : web_contents_(nullptr) {}
|
TabsUpdateFunction::TabsUpdateFunction() : web_contents_(nullptr) {}
|
||||||
|
|
||||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
||||||
absl::optional<tabs::Update::Params> params =
|
std::optional<tabs::Update::Params> params =
|
||||||
tabs::Update::Params::Create(args());
|
tabs::Update::Params::Create(args());
|
||||||
EXTENSION_FUNCTION_VALIDATE(params);
|
EXTENSION_FUNCTION_VALIDATE(params);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ ElectronMessagingDelegate::IsNativeMessagingHostAllowed(
|
||||||
return PolicyPermission::DISALLOW;
|
return PolicyPermission::DISALLOW;
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<base::Value::Dict> ElectronMessagingDelegate::MaybeGetTabInfo(
|
std::optional<base::Value::Dict> ElectronMessagingDelegate::MaybeGetTabInfo(
|
||||||
content::WebContents* web_contents) {
|
content::WebContents* web_contents) {
|
||||||
if (web_contents) {
|
if (web_contents) {
|
||||||
auto* api_contents = electron::api::WebContents::From(web_contents);
|
auto* api_contents = electron::api::WebContents::From(web_contents);
|
||||||
|
@ -54,7 +54,7 @@ absl::optional<base::Value::Dict> ElectronMessagingDelegate::MaybeGetTabInfo(
|
||||||
return tab.ToValue();
|
return tab.ToValue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
content::WebContents* ElectronMessagingDelegate::GetWebContentsByTabId(
|
content::WebContents* ElectronMessagingDelegate::GetWebContentsByTabId(
|
||||||
|
|
|
@ -27,7 +27,7 @@ class ElectronMessagingDelegate : public MessagingDelegate {
|
||||||
PolicyPermission IsNativeMessagingHostAllowed(
|
PolicyPermission IsNativeMessagingHostAllowed(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
const std::string& native_host_name) override;
|
const std::string& native_host_name) override;
|
||||||
absl::optional<base::Value::Dict> MaybeGetTabInfo(
|
std::optional<base::Value::Dict> MaybeGetTabInfo(
|
||||||
content::WebContents* web_contents) override;
|
content::WebContents* web_contents) override;
|
||||||
content::WebContents* GetWebContentsByTabId(
|
content::WebContents* GetWebContentsByTabId(
|
||||||
content::BrowserContext* browser_context,
|
content::BrowserContext* browser_context,
|
||||||
|
|
|
@ -52,7 +52,7 @@ void LoginHandler::EmitEvent(
|
||||||
|
|
||||||
api::WebContents* api_web_contents = api::WebContents::From(web_contents());
|
api::WebContents* api_web_contents = api::WebContents::From(web_contents());
|
||||||
if (!api_web_contents) {
|
if (!api_web_contents) {
|
||||||
std::move(auth_required_callback_).Run(absl::nullopt);
|
std::move(auth_required_callback_).Run(std::nullopt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -75,7 +75,7 @@ void LoginHandler::EmitEvent(
|
||||||
// deleted. Check the weak ptr before accessing any member variables to
|
// deleted. Check the weak ptr before accessing any member variables to
|
||||||
// prevent UAF.
|
// prevent UAF.
|
||||||
if (weak_this && !default_prevented && auth_required_callback_) {
|
if (weak_this && !default_prevented && auth_required_callback_) {
|
||||||
std::move(auth_required_callback_).Run(absl::nullopt);
|
std::move(auth_required_callback_).Run(std::nullopt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ void LoginHandler::CallbackFromJS(gin::Arguments* args) {
|
||||||
if (auth_required_callback_) {
|
if (auth_required_callback_) {
|
||||||
std::u16string username, password;
|
std::u16string username, password;
|
||||||
if (!args->GetNext(&username) || !args->GetNext(&password)) {
|
if (!args->GetNext(&username) || !args->GetNext(&password)) {
|
||||||
std::move(auth_required_callback_).Run(absl::nullopt);
|
std::move(auth_required_callback_).Run(std::nullopt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
std::move(auth_required_callback_)
|
std::move(auth_required_callback_)
|
||||||
|
|
|
@ -5,13 +5,13 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_OBSERVER_H_
|
#ifndef ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_OBSERVER_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_OBSERVER_H_
|
#define ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_OBSERVER_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/functional/callback.h"
|
#include "base/functional/callback.h"
|
||||||
#include "base/memory/raw_ptr_exclusion.h"
|
#include "base/memory/raw_ptr_exclusion.h"
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
#if defined(__OBJC__)
|
#if defined(__OBJC__)
|
||||||
@class InAppTransactionObserver;
|
@class InAppTransactionObserver;
|
||||||
|
@ -39,7 +39,7 @@ struct Payment {
|
||||||
std::string productIdentifier = "";
|
std::string productIdentifier = "";
|
||||||
int quantity = 1;
|
int quantity = 1;
|
||||||
std::string applicationUsername;
|
std::string applicationUsername;
|
||||||
absl::optional<PaymentDiscount> paymentDiscount;
|
std::optional<PaymentDiscount> paymentDiscount;
|
||||||
|
|
||||||
Payment();
|
Payment();
|
||||||
Payment(const Payment&);
|
Payment(const Payment&);
|
||||||
|
|
|
@ -5,11 +5,11 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_PRODUCT_H_
|
#ifndef ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_PRODUCT_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_PRODUCT_H_
|
#define ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_PRODUCT_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/functional/callback.h"
|
#include "base/functional/callback.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace in_app_purchase {
|
namespace in_app_purchase {
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ struct ProductDiscount {
|
||||||
std::string priceLocale;
|
std::string priceLocale;
|
||||||
std::string paymentMode;
|
std::string paymentMode;
|
||||||
int numberOfPeriods;
|
int numberOfPeriods;
|
||||||
absl::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
std::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
||||||
|
|
||||||
ProductDiscount(const ProductDiscount&);
|
ProductDiscount(const ProductDiscount&);
|
||||||
ProductDiscount();
|
ProductDiscount();
|
||||||
|
@ -50,10 +50,10 @@ struct Product {
|
||||||
double price = 0.0;
|
double price = 0.0;
|
||||||
std::string formattedPrice;
|
std::string formattedPrice;
|
||||||
std::string currencyCode;
|
std::string currencyCode;
|
||||||
absl::optional<ProductDiscount> introductoryPrice;
|
std::optional<ProductDiscount> introductoryPrice;
|
||||||
std::vector<ProductDiscount> discounts;
|
std::vector<ProductDiscount> discounts;
|
||||||
std::string subscriptionGroupIdentifier;
|
std::string subscriptionGroupIdentifier;
|
||||||
absl::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
std::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
||||||
|
|
||||||
// Downloadable Content Information
|
// Downloadable Content Information
|
||||||
bool isDownloadable = false;
|
bool isDownloadable = false;
|
||||||
|
|
|
@ -488,7 +488,7 @@ bool NativeWindow::AddTabbedWindow(NativeWindow* window) {
|
||||||
return true; // for non-Mac platforms
|
return true; // for non-Mac platforms
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<std::string> NativeWindow::GetTabbingIdentifier() const {
|
std::optional<std::string> NativeWindow::GetTabbingIdentifier() const {
|
||||||
return ""; // for non-Mac platforms
|
return ""; // for non-Mac platforms
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -539,7 +539,7 @@ void NativeWindow::PreviewFile(const std::string& path,
|
||||||
|
|
||||||
void NativeWindow::CloseFilePreview() {}
|
void NativeWindow::CloseFilePreview() {}
|
||||||
|
|
||||||
absl::optional<gfx::Rect> NativeWindow::GetWindowControlsOverlayRect() {
|
std::optional<gfx::Rect> NativeWindow::GetWindowControlsOverlayRect() {
|
||||||
return overlay_rect_;
|
return overlay_rect_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -22,7 +23,6 @@
|
||||||
#include "shell/browser/draggable_region_provider.h"
|
#include "shell/browser/draggable_region_provider.h"
|
||||||
#include "shell/browser/native_window_observer.h"
|
#include "shell/browser/native_window_observer.h"
|
||||||
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
#include "shell/browser/ui/inspectable_web_contents_view.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/views/widget/widget_delegate.h"
|
#include "ui/views/widget/widget_delegate.h"
|
||||||
|
|
||||||
class SkRegion;
|
class SkRegion;
|
||||||
|
@ -229,8 +229,8 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
#if BUILDFLAG(IS_MAC)
|
#if BUILDFLAG(IS_MAC)
|
||||||
virtual void SetWindowButtonVisibility(bool visible) = 0;
|
virtual void SetWindowButtonVisibility(bool visible) = 0;
|
||||||
virtual bool GetWindowButtonVisibility() const = 0;
|
virtual bool GetWindowButtonVisibility() const = 0;
|
||||||
virtual void SetWindowButtonPosition(absl::optional<gfx::Point> position) = 0;
|
virtual void SetWindowButtonPosition(std::optional<gfx::Point> position) = 0;
|
||||||
virtual absl::optional<gfx::Point> GetWindowButtonPosition() const = 0;
|
virtual std::optional<gfx::Point> GetWindowButtonPosition() const = 0;
|
||||||
virtual void RedrawTrafficLights() = 0;
|
virtual void RedrawTrafficLights() = 0;
|
||||||
virtual void UpdateFrame() = 0;
|
virtual void UpdateFrame() = 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -254,7 +254,7 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
virtual void MoveTabToNewWindow();
|
virtual void MoveTabToNewWindow();
|
||||||
virtual void ToggleTabBar();
|
virtual void ToggleTabBar();
|
||||||
virtual bool AddTabbedWindow(NativeWindow* window);
|
virtual bool AddTabbedWindow(NativeWindow* window);
|
||||||
virtual absl::optional<std::string> GetTabbingIdentifier() const;
|
virtual std::optional<std::string> GetTabbingIdentifier() const;
|
||||||
|
|
||||||
// Toggle the menu bar.
|
// Toggle the menu bar.
|
||||||
virtual void SetAutoHideMenuBar(bool auto_hide);
|
virtual void SetAutoHideMenuBar(bool auto_hide);
|
||||||
|
@ -284,7 +284,7 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
return weak_factory_.GetWeakPtr();
|
return weak_factory_.GetWeakPtr();
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual absl::optional<gfx::Rect> GetWindowControlsOverlayRect();
|
virtual std::optional<gfx::Rect> GetWindowControlsOverlayRect();
|
||||||
virtual void SetWindowControlsOverlayRect(const gfx::Rect& overlay_rect);
|
virtual void SetWindowControlsOverlayRect(const gfx::Rect& overlay_rect);
|
||||||
|
|
||||||
// Methods called by the WebContents.
|
// Methods called by the WebContents.
|
||||||
|
@ -433,11 +433,11 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
TitleBarStyle title_bar_style_ = TitleBarStyle::kNormal;
|
TitleBarStyle title_bar_style_ = TitleBarStyle::kNormal;
|
||||||
|
|
||||||
// Minimum and maximum size.
|
// Minimum and maximum size.
|
||||||
absl::optional<extensions::SizeConstraints> size_constraints_;
|
std::optional<extensions::SizeConstraints> size_constraints_;
|
||||||
// Same as above but stored as content size, we are storing 2 types of size
|
// Same as above but stored as content size, we are storing 2 types of size
|
||||||
// constraints beacause converting between them will cause rounding errors
|
// constraints beacause converting between them will cause rounding errors
|
||||||
// on HiDPI displays on some environments.
|
// on HiDPI displays on some environments.
|
||||||
absl::optional<extensions::SizeConstraints> content_size_constraints_;
|
std::optional<extensions::SizeConstraints> content_size_constraints_;
|
||||||
|
|
||||||
std::queue<bool> pending_transitions_;
|
std::queue<bool> pending_transitions_;
|
||||||
FullScreenTransitionState fullscreen_transition_state_ =
|
FullScreenTransitionState fullscreen_transition_state_ =
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -127,8 +128,8 @@ class NativeWindowMac : public NativeWindow,
|
||||||
void SetVibrancy(const std::string& type) override;
|
void SetVibrancy(const std::string& type) override;
|
||||||
void SetWindowButtonVisibility(bool visible) override;
|
void SetWindowButtonVisibility(bool visible) override;
|
||||||
bool GetWindowButtonVisibility() const override;
|
bool GetWindowButtonVisibility() const override;
|
||||||
void SetWindowButtonPosition(absl::optional<gfx::Point> position) override;
|
void SetWindowButtonPosition(std::optional<gfx::Point> position) override;
|
||||||
absl::optional<gfx::Point> GetWindowButtonPosition() const override;
|
std::optional<gfx::Point> GetWindowButtonPosition() const override;
|
||||||
void RedrawTrafficLights() override;
|
void RedrawTrafficLights() override;
|
||||||
void UpdateFrame() override;
|
void UpdateFrame() override;
|
||||||
void SetTouchBar(
|
void SetTouchBar(
|
||||||
|
@ -142,7 +143,7 @@ class NativeWindowMac : public NativeWindow,
|
||||||
void MoveTabToNewWindow() override;
|
void MoveTabToNewWindow() override;
|
||||||
void ToggleTabBar() override;
|
void ToggleTabBar() override;
|
||||||
bool AddTabbedWindow(NativeWindow* window) override;
|
bool AddTabbedWindow(NativeWindow* window) override;
|
||||||
absl::optional<std::string> GetTabbingIdentifier() const override;
|
std::optional<std::string> GetTabbingIdentifier() const override;
|
||||||
void SetAspectRatio(double aspect_ratio,
|
void SetAspectRatio(double aspect_ratio,
|
||||||
const gfx::Size& extra_size) override;
|
const gfx::Size& extra_size) override;
|
||||||
void PreviewFile(const std::string& path,
|
void PreviewFile(const std::string& path,
|
||||||
|
@ -150,7 +151,7 @@ class NativeWindowMac : public NativeWindow,
|
||||||
void CloseFilePreview() override;
|
void CloseFilePreview() override;
|
||||||
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override;
|
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const override;
|
||||||
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override;
|
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const override;
|
||||||
absl::optional<gfx::Rect> GetWindowControlsOverlayRect() override;
|
std::optional<gfx::Rect> GetWindowControlsOverlayRect() override;
|
||||||
void NotifyWindowEnterFullScreen() override;
|
void NotifyWindowEnterFullScreen() override;
|
||||||
void NotifyWindowLeaveFullScreen() override;
|
void NotifyWindowLeaveFullScreen() override;
|
||||||
void SetActive(bool is_key) override;
|
void SetActive(bool is_key) override;
|
||||||
|
@ -249,7 +250,7 @@ class NativeWindowMac : public NativeWindow,
|
||||||
bool fullscreen_before_kiosk_ = false;
|
bool fullscreen_before_kiosk_ = false;
|
||||||
bool is_kiosk_ = false;
|
bool is_kiosk_ = false;
|
||||||
bool zoom_to_page_width_ = false;
|
bool zoom_to_page_width_ = false;
|
||||||
absl::optional<gfx::Point> traffic_light_position_;
|
std::optional<gfx::Point> traffic_light_position_;
|
||||||
|
|
||||||
// Trying to close an NSWindow during a fullscreen transition will cause the
|
// Trying to close an NSWindow during a fullscreen transition will cause the
|
||||||
// window to lock up. Use this to track if CloseWindow was called during a
|
// window to lock up. Use this to track if CloseWindow was called during a
|
||||||
|
@ -271,7 +272,7 @@ class NativeWindowMac : public NativeWindow,
|
||||||
|
|
||||||
// The visibility mode of window button controls when explicitly set through
|
// The visibility mode of window button controls when explicitly set through
|
||||||
// setWindowButtonVisibility().
|
// setWindowButtonVisibility().
|
||||||
absl::optional<bool> window_button_visibility_;
|
std::optional<bool> window_button_visibility_;
|
||||||
|
|
||||||
// Controls the position and visibility of window buttons.
|
// Controls the position and visibility of window buttons.
|
||||||
WindowButtonsProxy* __strong buttons_proxy_;
|
WindowButtonsProxy* __strong buttons_proxy_;
|
||||||
|
|
|
@ -1545,7 +1545,7 @@ bool NativeWindowMac::GetWindowButtonVisibility() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindowMac::SetWindowButtonPosition(
|
void NativeWindowMac::SetWindowButtonPosition(
|
||||||
absl::optional<gfx::Point> position) {
|
std::optional<gfx::Point> position) {
|
||||||
traffic_light_position_ = std::move(position);
|
traffic_light_position_ = std::move(position);
|
||||||
if (buttons_proxy_) {
|
if (buttons_proxy_) {
|
||||||
[buttons_proxy_ setMargin:traffic_light_position_];
|
[buttons_proxy_ setMargin:traffic_light_position_];
|
||||||
|
@ -1553,7 +1553,7 @@ void NativeWindowMac::SetWindowButtonPosition(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<gfx::Point> NativeWindowMac::GetWindowButtonPosition() const {
|
std::optional<gfx::Point> NativeWindowMac::GetWindowButtonPosition() const {
|
||||||
return traffic_light_position_;
|
return traffic_light_position_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1623,9 +1623,9 @@ bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<std::string> NativeWindowMac::GetTabbingIdentifier() const {
|
std::optional<std::string> NativeWindowMac::GetTabbingIdentifier() const {
|
||||||
if ([window_ tabbingMode] == NSWindowTabbingModeDisallowed)
|
if ([window_ tabbingMode] == NSWindowTabbingModeDisallowed)
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
return base::SysNSStringToUTF8([window_ tabbingIdentifier]);
|
return base::SysNSStringToUTF8([window_ tabbingIdentifier]);
|
||||||
}
|
}
|
||||||
|
@ -1870,9 +1870,9 @@ void NativeWindowMac::SetForwardMouseMessages(bool forward) {
|
||||||
[window_ setAcceptsMouseMovedEvents:forward];
|
[window_ setAcceptsMouseMovedEvents:forward];
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
std::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
||||||
if (!titlebar_overlay_)
|
if (!titlebar_overlay_)
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
|
|
||||||
// On macOS, when in fullscreen mode, window controls (the menu bar, title
|
// On macOS, when in fullscreen mode, window controls (the menu bar, title
|
||||||
// bar, and toolbar) are attached to a separate NSView that slides down from
|
// bar, and toolbar) are attached to a separate NSView that slides down from
|
||||||
|
@ -1896,7 +1896,7 @@ absl::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
||||||
return overlay;
|
return overlay;
|
||||||
}
|
}
|
||||||
|
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
#include "shell/browser/native_window.h"
|
#include "shell/browser/native_window.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
@ -304,7 +305,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
// Whether the window is currently being moved.
|
// Whether the window is currently being moved.
|
||||||
bool is_moving_ = false;
|
bool is_moving_ = false;
|
||||||
|
|
||||||
absl::optional<gfx::Rect> pending_bounds_change_;
|
std::optional<gfx::Rect> pending_bounds_change_;
|
||||||
|
|
||||||
// The color to use as the theme and symbol colors respectively for Window
|
// The color to use as the theme and symbol colors respectively for Window
|
||||||
// Controls Overlay if enabled on Windows.
|
// Controls Overlay if enabled on Windows.
|
||||||
|
|
|
@ -7,12 +7,12 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "crypto/secure_hash.h"
|
#include "crypto/secure_hash.h"
|
||||||
#include "mojo/public/cpp/system/file_data_source.h"
|
#include "mojo/public/cpp/system/file_data_source.h"
|
||||||
#include "mojo/public/cpp/system/filtered_data_source.h"
|
#include "mojo/public/cpp/system/filtered_data_source.h"
|
||||||
#include "shell/common/asar/archive.h"
|
#include "shell/common/asar/archive.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace asar {
|
namespace asar {
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const absl::optional<GURL>& new_url) override {}
|
const std::optional<GURL>& new_url) override {}
|
||||||
void SetPriority(net::RequestPriority priority,
|
void SetPriority(net::RequestPriority priority,
|
||||||
int32_t intra_priority_value) override {}
|
int32_t intra_priority_value) override {}
|
||||||
void PauseReadingBodyFromNet() override {}
|
void PauseReadingBodyFromNet() override {}
|
||||||
|
@ -270,7 +270,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
|
||||||
head->mime_type.c_str());
|
head->mime_type.c_str());
|
||||||
}
|
}
|
||||||
client_->OnReceiveResponse(std::move(head), std::move(consumer_handle),
|
client_->OnReceiveResponse(std::move(head), std::move(consumer_handle),
|
||||||
absl::nullopt);
|
std::nullopt);
|
||||||
|
|
||||||
if (total_bytes_to_send == 0) {
|
if (total_bytes_to_send == 0) {
|
||||||
// There's definitely no more data, so we're already done.
|
// There's definitely no more data, so we're already done.
|
||||||
|
|
|
@ -26,7 +26,7 @@ void CertVerifierClient::Verify(
|
||||||
const scoped_refptr<net::X509Certificate>& certificate,
|
const scoped_refptr<net::X509Certificate>& certificate,
|
||||||
const std::string& hostname,
|
const std::string& hostname,
|
||||||
int flags,
|
int flags,
|
||||||
const absl::optional<std::string>& ocsp_response,
|
const std::optional<std::string>& ocsp_response,
|
||||||
VerifyCallback callback) {
|
VerifyCallback callback) {
|
||||||
VerifyRequestParams params;
|
VerifyRequestParams params;
|
||||||
params.hostname = hostname;
|
params.hostname = hostname;
|
||||||
|
|
|
@ -40,7 +40,7 @@ class CertVerifierClient : public network::mojom::CertVerifierClient {
|
||||||
const scoped_refptr<net::X509Certificate>& certificate,
|
const scoped_refptr<net::X509Certificate>& certificate,
|
||||||
const std::string& hostname,
|
const std::string& hostname,
|
||||||
int flags,
|
int flags,
|
||||||
const absl::optional<std::string>& ocsp_response,
|
const std::optional<std::string>& ocsp_response,
|
||||||
VerifyCallback callback) override;
|
VerifyCallback callback) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -211,7 +211,7 @@ void ElectronURLLoaderFactory::RedirectedRequest::FollowRedirect(
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const absl::optional<GURL>& new_url) {
|
const std::optional<GURL>& new_url) {
|
||||||
// Update |request_| with info from the redirect, so that it's accurate
|
// Update |request_| with info from the redirect, so that it's accurate
|
||||||
// The following references code in WorkerScriptLoader::FollowRedirect
|
// The following references code in WorkerScriptLoader::FollowRedirect
|
||||||
bool should_clear_upload = false;
|
bool should_clear_upload = false;
|
||||||
|
@ -592,7 +592,7 @@ void ElectronURLLoaderFactory::StartLoadingStream(
|
||||||
// Note that We must submit a empty body otherwise NetworkService would
|
// Note that We must submit a empty body otherwise NetworkService would
|
||||||
// crash.
|
// crash.
|
||||||
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
|
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
|
||||||
absl::nullopt);
|
std::nullopt);
|
||||||
producer.reset(); // The data pipe is empty.
|
producer.reset(); // The data pipe is empty.
|
||||||
client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK));
|
client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK));
|
||||||
return;
|
return;
|
||||||
|
@ -640,7 +640,7 @@ void ElectronURLLoaderFactory::SendContents(
|
||||||
}
|
}
|
||||||
|
|
||||||
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
|
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
|
||||||
absl::nullopt);
|
std::nullopt);
|
||||||
|
|
||||||
auto write_data = std::make_unique<WriteData>();
|
auto write_data = std::make_unique<WriteData>();
|
||||||
write_data->client = std::move(client_remote);
|
write_data->client = std::move(client_remote);
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_NET_ELECTRON_URL_LOADER_FACTORY_H_
|
#define ELECTRON_SHELL_BROWSER_NET_ELECTRON_URL_LOADER_FACTORY_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -21,7 +22,6 @@
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||||
#include "shell/common/gin_helper/dictionary.h"
|
#include "shell/common/gin_helper/dictionary.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
|
@ -73,7 +73,7 @@ class ElectronURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const absl::optional<GURL>& new_url) override;
|
const std::optional<GURL>& new_url) override;
|
||||||
void SetPriority(net::RequestPriority priority,
|
void SetPriority(net::RequestPriority priority,
|
||||||
int32_t intra_priority_value) override {}
|
int32_t intra_priority_value) override {}
|
||||||
void PauseReadingBodyFromNet() override {}
|
void PauseReadingBodyFromNet() override {}
|
||||||
|
|
|
@ -59,7 +59,7 @@ void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) {
|
||||||
|
|
||||||
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
|
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
|
||||||
client_->OnReceiveResponse(std::move(head), std::move(consumer),
|
client_->OnReceiveResponse(std::move(head), std::move(consumer),
|
||||||
absl::nullopt);
|
std::nullopt);
|
||||||
|
|
||||||
auto weak = weak_factory_.GetWeakPtr();
|
auto weak = weak_factory_.GetWeakPtr();
|
||||||
On("end",
|
On("end",
|
||||||
|
|
|
@ -60,7 +60,7 @@ class NodeStreamLoader : public network::mojom::URLLoader {
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const absl::optional<GURL>& new_url) override {}
|
const std::optional<GURL>& new_url) override {}
|
||||||
void SetPriority(net::RequestPriority priority,
|
void SetPriority(net::RequestPriority priority,
|
||||||
int32_t intra_priority_value) override {}
|
int32_t intra_priority_value) override {}
|
||||||
void PauseReadingBodyFromNet() override {}
|
void PauseReadingBodyFromNet() override {}
|
||||||
|
|
|
@ -93,11 +93,11 @@ ProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() {
|
||||||
}
|
}
|
||||||
if (on_before_send_headers_callback_) {
|
if (on_before_send_headers_callback_) {
|
||||||
std::move(on_before_send_headers_callback_)
|
std::move(on_before_send_headers_callback_)
|
||||||
.Run(net::ERR_ABORTED, absl::nullopt);
|
.Run(net::ERR_ABORTED, std::nullopt);
|
||||||
}
|
}
|
||||||
if (on_headers_received_callback_) {
|
if (on_headers_received_callback_) {
|
||||||
std::move(on_headers_received_callback_)
|
std::move(on_headers_received_callback_)
|
||||||
.Run(net::ERR_ABORTED, absl::nullopt, absl::nullopt);
|
.Run(net::ERR_ABORTED, std::nullopt, std::nullopt);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,7 +182,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::FollowRedirect(
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const absl::optional<GURL>& new_url) {
|
const std::optional<GURL>& new_url) {
|
||||||
if (new_url)
|
if (new_url)
|
||||||
request_.url = new_url.value();
|
request_.url = new_url.value();
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveEarlyHints(
|
||||||
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
|
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
|
||||||
network::mojom::URLResponseHeadPtr head,
|
network::mojom::URLResponseHeadPtr head,
|
||||||
mojo::ScopedDataPipeConsumerHandle body,
|
mojo::ScopedDataPipeConsumerHandle body,
|
||||||
absl::optional<mojo_base::BigBuffer> cached_metadata) {
|
std::optional<mojo_base::BigBuffer> cached_metadata) {
|
||||||
current_body_ = std::move(body);
|
current_body_ = std::move(body);
|
||||||
current_cached_metadata_ = std::move(cached_metadata);
|
current_cached_metadata_ = std::move(cached_metadata);
|
||||||
if (current_request_uses_header_client_) {
|
if (current_request_uses_header_client_) {
|
||||||
|
@ -342,7 +342,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnBeforeSendHeaders(
|
||||||
const net::HttpRequestHeaders& headers,
|
const net::HttpRequestHeaders& headers,
|
||||||
OnBeforeSendHeadersCallback callback) {
|
OnBeforeSendHeadersCallback callback) {
|
||||||
if (!current_request_uses_header_client_) {
|
if (!current_request_uses_header_client_) {
|
||||||
std::move(callback).Run(net::OK, absl::nullopt);
|
std::move(callback).Run(net::OK, std::nullopt);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,7 +356,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnHeadersReceived(
|
||||||
const net::IPEndPoint& remote_endpoint,
|
const net::IPEndPoint& remote_endpoint,
|
||||||
OnHeadersReceivedCallback callback) {
|
OnHeadersReceivedCallback callback) {
|
||||||
if (!current_request_uses_header_client_) {
|
if (!current_request_uses_header_client_) {
|
||||||
std::move(callback).Run(net::OK, absl::nullopt, GURL());
|
std::move(callback).Run(net::OK, std::nullopt, GURL());
|
||||||
|
|
||||||
if (for_cors_preflight_) {
|
if (for_cors_preflight_) {
|
||||||
// CORS preflight is supported only when "extraHeaders" is specified.
|
// CORS preflight is supported only when "extraHeaders" is specified.
|
||||||
|
@ -581,7 +581,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::
|
||||||
}
|
}
|
||||||
|
|
||||||
DCHECK(on_headers_received_callback_);
|
DCHECK(on_headers_received_callback_);
|
||||||
absl::optional<std::string> headers;
|
std::optional<std::string> headers;
|
||||||
if (override_headers_) {
|
if (override_headers_) {
|
||||||
headers = override_headers_->raw_headers();
|
headers = override_headers_->raw_headers();
|
||||||
if (current_request_uses_header_client_) {
|
if (current_request_uses_header_client_) {
|
||||||
|
@ -749,7 +749,7 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
||||||
int frame_routing_id,
|
int frame_routing_id,
|
||||||
uint64_t* request_id_generator,
|
uint64_t* request_id_generator,
|
||||||
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
||||||
absl::optional<int64_t> navigation_id,
|
std::optional<int64_t> navigation_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_request,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_request,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_remote,
|
mojo::PendingRemote<network::mojom::URLLoaderFactory> target_factory_remote,
|
||||||
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -33,7 +34,6 @@
|
||||||
#include "services/network/url_loader_factory.h"
|
#include "services/network/url_loader_factory.h"
|
||||||
#include "shell/browser/net/electron_url_loader_factory.h"
|
#include "shell/browser/net/electron_url_loader_factory.h"
|
||||||
#include "shell/browser/net/web_request_api_interface.h"
|
#include "shell/browser/net/web_request_api_interface.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
@ -83,7 +83,7 @@ class ProxyingURLLoaderFactory
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const absl::optional<GURL>& new_url) override;
|
const std::optional<GURL>& new_url) override;
|
||||||
void SetPriority(net::RequestPriority priority,
|
void SetPriority(net::RequestPriority priority,
|
||||||
int32_t intra_priority_value) override;
|
int32_t intra_priority_value) override;
|
||||||
void PauseReadingBodyFromNet() override;
|
void PauseReadingBodyFromNet() override;
|
||||||
|
@ -95,7 +95,7 @@ class ProxyingURLLoaderFactory
|
||||||
void OnReceiveResponse(
|
void OnReceiveResponse(
|
||||||
network::mojom::URLResponseHeadPtr head,
|
network::mojom::URLResponseHeadPtr head,
|
||||||
mojo::ScopedDataPipeConsumerHandle body,
|
mojo::ScopedDataPipeConsumerHandle body,
|
||||||
absl::optional<mojo_base::BigBuffer> cached_metadata) override;
|
std::optional<mojo_base::BigBuffer> cached_metadata) override;
|
||||||
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
|
void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
|
||||||
network::mojom::URLResponseHeadPtr head) override;
|
network::mojom::URLResponseHeadPtr head) override;
|
||||||
void OnUploadProgress(int64_t current_position,
|
void OnUploadProgress(int64_t current_position,
|
||||||
|
@ -135,7 +135,7 @@ class ProxyingURLLoaderFactory
|
||||||
|
|
||||||
raw_ptr<ProxyingURLLoaderFactory> const factory_;
|
raw_ptr<ProxyingURLLoaderFactory> const factory_;
|
||||||
network::ResourceRequest request_;
|
network::ResourceRequest request_;
|
||||||
const absl::optional<url::Origin> original_initiator_;
|
const std::optional<url::Origin> original_initiator_;
|
||||||
const uint64_t request_id_ = 0;
|
const uint64_t request_id_ = 0;
|
||||||
const int32_t network_service_request_id_ = 0;
|
const int32_t network_service_request_id_ = 0;
|
||||||
const int32_t frame_routing_id_ = MSG_ROUTING_NONE;
|
const int32_t frame_routing_id_ = MSG_ROUTING_NONE;
|
||||||
|
@ -144,7 +144,7 @@ class ProxyingURLLoaderFactory
|
||||||
mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_;
|
mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_;
|
||||||
mojo::Remote<network::mojom::URLLoaderClient> target_client_;
|
mojo::Remote<network::mojom::URLLoaderClient> target_client_;
|
||||||
|
|
||||||
absl::optional<extensions::WebRequestInfo> info_;
|
std::optional<extensions::WebRequestInfo> info_;
|
||||||
|
|
||||||
mojo::Receiver<network::mojom::URLLoaderClient> proxied_client_receiver_{
|
mojo::Receiver<network::mojom::URLLoaderClient> proxied_client_receiver_{
|
||||||
this};
|
this};
|
||||||
|
@ -180,7 +180,7 @@ class ProxyingURLLoaderFactory
|
||||||
std::vector<std::string> removed_headers;
|
std::vector<std::string> removed_headers;
|
||||||
net::HttpRequestHeaders modified_headers;
|
net::HttpRequestHeaders modified_headers;
|
||||||
net::HttpRequestHeaders modified_cors_exempt_headers;
|
net::HttpRequestHeaders modified_cors_exempt_headers;
|
||||||
absl::optional<GURL> new_url;
|
std::optional<GURL> new_url;
|
||||||
|
|
||||||
// disable copy
|
// disable copy
|
||||||
FollowRedirectParams(const FollowRedirectParams&) = delete;
|
FollowRedirectParams(const FollowRedirectParams&) = delete;
|
||||||
|
@ -188,7 +188,7 @@ class ProxyingURLLoaderFactory
|
||||||
};
|
};
|
||||||
std::unique_ptr<FollowRedirectParams> pending_follow_redirect_params_;
|
std::unique_ptr<FollowRedirectParams> pending_follow_redirect_params_;
|
||||||
|
|
||||||
absl::optional<mojo_base::BigBuffer> current_cached_metadata_;
|
std::optional<mojo_base::BigBuffer> current_cached_metadata_;
|
||||||
|
|
||||||
base::WeakPtrFactory<InProgressRequest> weak_factory_{this};
|
base::WeakPtrFactory<InProgressRequest> weak_factory_{this};
|
||||||
};
|
};
|
||||||
|
@ -200,7 +200,7 @@ class ProxyingURLLoaderFactory
|
||||||
int frame_routing_id,
|
int frame_routing_id,
|
||||||
uint64_t* request_id_generator,
|
uint64_t* request_id_generator,
|
||||||
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data,
|
||||||
absl::optional<int64_t> navigation_id,
|
std::optional<int64_t> navigation_id,
|
||||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_request,
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_request,
|
||||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>
|
||||||
target_factory_remote,
|
target_factory_remote,
|
||||||
|
@ -264,7 +264,7 @@ class ProxyingURLLoaderFactory
|
||||||
const int frame_routing_id_;
|
const int frame_routing_id_;
|
||||||
raw_ptr<uint64_t> request_id_generator_; // managed by ElectronBrowserClient
|
raw_ptr<uint64_t> request_id_generator_; // managed by ElectronBrowserClient
|
||||||
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data_;
|
std::unique_ptr<extensions::ExtensionNavigationUIData> navigation_ui_data_;
|
||||||
absl::optional<int64_t> navigation_id_;
|
std::optional<int64_t> navigation_id_;
|
||||||
mojo::ReceiverSet<network::mojom::URLLoaderFactory> proxy_receivers_;
|
mojo::ReceiverSet<network::mojom::URLLoaderFactory> proxy_receivers_;
|
||||||
mojo::Remote<network::mojom::URLLoaderFactory> target_factory_;
|
mojo::Remote<network::mojom::URLLoaderFactory> target_factory_;
|
||||||
mojo::Receiver<network::mojom::TrustedURLLoaderHeaderClient>
|
mojo::Receiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||||
|
|
|
@ -44,16 +44,16 @@ ProxyingWebSocket::ProxyingWebSocket(
|
||||||
/*is_download=*/false,
|
/*is_download=*/false,
|
||||||
/*is_async=*/true,
|
/*is_async=*/true,
|
||||||
/*is_service_worker_script=*/false,
|
/*is_service_worker_script=*/false,
|
||||||
/*navigation_id=*/absl::nullopt)) {}
|
/*navigation_id=*/std::nullopt)) {}
|
||||||
|
|
||||||
ProxyingWebSocket::~ProxyingWebSocket() {
|
ProxyingWebSocket::~ProxyingWebSocket() {
|
||||||
if (on_before_send_headers_callback_) {
|
if (on_before_send_headers_callback_) {
|
||||||
std::move(on_before_send_headers_callback_)
|
std::move(on_before_send_headers_callback_)
|
||||||
.Run(net::ERR_ABORTED, absl::nullopt);
|
.Run(net::ERR_ABORTED, std::nullopt);
|
||||||
}
|
}
|
||||||
if (on_headers_received_callback_) {
|
if (on_headers_received_callback_) {
|
||||||
std::move(on_headers_received_callback_)
|
std::move(on_headers_received_callback_)
|
||||||
.Run(net::ERR_ABORTED, absl::nullopt, GURL());
|
.Run(net::ERR_ABORTED, std::nullopt, GURL());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ void ProxyingWebSocket::StartProxying(
|
||||||
WebSocketFactory factory,
|
WebSocketFactory factory,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
const net::SiteForCookies& site_for_cookies,
|
const net::SiteForCookies& site_for_cookies,
|
||||||
const absl::optional<std::string>& user_agent,
|
const std::optional<std::string>& user_agent,
|
||||||
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
||||||
handshake_client,
|
handshake_client,
|
||||||
bool has_extra_headers,
|
bool has_extra_headers,
|
||||||
|
@ -358,11 +358,11 @@ void ProxyingWebSocket::OnHeadersReceivedComplete(int error_code) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (on_headers_received_callback_) {
|
if (on_headers_received_callback_) {
|
||||||
absl::optional<std::string> headers;
|
std::optional<std::string> headers;
|
||||||
if (override_headers_)
|
if (override_headers_)
|
||||||
headers = override_headers_->raw_headers();
|
headers = override_headers_->raw_headers();
|
||||||
std::move(on_headers_received_callback_)
|
std::move(on_headers_received_callback_)
|
||||||
.Run(net::OK, headers, absl::nullopt);
|
.Run(net::OK, headers, std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (override_headers_) {
|
if (override_headers_) {
|
||||||
|
@ -384,7 +384,7 @@ void ProxyingWebSocket::OnAuthRequiredComplete(AuthRequiredResponse rv) {
|
||||||
switch (rv) {
|
switch (rv) {
|
||||||
case AuthRequiredResponse::kNoAction:
|
case AuthRequiredResponse::kNoAction:
|
||||||
case AuthRequiredResponse::kCancelAuth:
|
case AuthRequiredResponse::kCancelAuth:
|
||||||
std::move(auth_required_callback_).Run(absl::nullopt);
|
std::move(auth_required_callback_).Run(std::nullopt);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AuthRequiredResponse::kSetAuth:
|
case AuthRequiredResponse::kSetAuth:
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_NET_PROXYING_WEBSOCKET_H_
|
#ifndef ELECTRON_SHELL_BROWSER_NET_PROXYING_WEBSOCKET_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_NET_PROXYING_WEBSOCKET_H_
|
#define ELECTRON_SHELL_BROWSER_NET_PROXYING_WEBSOCKET_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -19,7 +20,6 @@
|
||||||
#include "services/network/public/mojom/network_context.mojom.h"
|
#include "services/network/public/mojom/network_context.mojom.h"
|
||||||
#include "services/network/public/mojom/websocket.mojom.h"
|
#include "services/network/public/mojom/websocket.mojom.h"
|
||||||
#include "shell/browser/net/web_request_api_interface.h"
|
#include "shell/browser/net/web_request_api_interface.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
#include "url/origin.h"
|
#include "url/origin.h"
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient,
|
||||||
WebSocketFactory factory,
|
WebSocketFactory factory,
|
||||||
const GURL& url,
|
const GURL& url,
|
||||||
const net::SiteForCookies& site_for_cookies,
|
const net::SiteForCookies& site_for_cookies,
|
||||||
const absl::optional<std::string>& user_agent,
|
const std::optional<std::string>& user_agent,
|
||||||
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
mojo::PendingRemote<network::mojom::WebSocketHandshakeClient>
|
||||||
handshake_client,
|
handshake_client,
|
||||||
bool has_extra_headers,
|
bool has_extra_headers,
|
||||||
|
|
|
@ -53,8 +53,8 @@ void ResolveHostFunction::Run() {
|
||||||
receiver_.set_disconnect_handler(base::BindOnce(
|
receiver_.set_disconnect_handler(base::BindOnce(
|
||||||
&ResolveHostFunction::OnComplete, this, net::ERR_NAME_NOT_RESOLVED,
|
&ResolveHostFunction::OnComplete, this, net::ERR_NAME_NOT_RESOLVED,
|
||||||
net::ResolveErrorInfo(net::ERR_FAILED),
|
net::ResolveErrorInfo(net::ERR_FAILED),
|
||||||
/*resolved_addresses=*/absl::nullopt,
|
/*resolved_addresses=*/std::nullopt,
|
||||||
/*endpoint_results_with_metadata=*/absl::nullopt));
|
/*endpoint_results_with_metadata=*/std::nullopt));
|
||||||
if (electron::IsUtilityProcess()) {
|
if (electron::IsUtilityProcess()) {
|
||||||
URLLoaderBundle::GetInstance()->GetHostResolver()->ResolveHost(
|
URLLoaderBundle::GetInstance()->GetHostResolver()->ResolveHost(
|
||||||
network::mojom::HostResolverHost::NewHostPortPair(
|
network::mojom::HostResolverHost::NewHostPortPair(
|
||||||
|
@ -75,8 +75,8 @@ void ResolveHostFunction::Run() {
|
||||||
void ResolveHostFunction::OnComplete(
|
void ResolveHostFunction::OnComplete(
|
||||||
int result,
|
int result,
|
||||||
const net::ResolveErrorInfo& resolve_error_info,
|
const net::ResolveErrorInfo& resolve_error_info,
|
||||||
const absl::optional<net::AddressList>& resolved_addresses,
|
const std::optional<net::AddressList>& resolved_addresses,
|
||||||
const absl::optional<net::HostResolverEndpointResults>&
|
const std::optional<net::HostResolverEndpointResults>&
|
||||||
endpoint_results_with_metadata) {
|
endpoint_results_with_metadata) {
|
||||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_NET_RESOLVE_HOST_FUNCTION_H_
|
#ifndef ELECTRON_SHELL_BROWSER_NET_RESOLVE_HOST_FUNCTION_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_NET_RESOLVE_HOST_FUNCTION_H_
|
#define ELECTRON_SHELL_BROWSER_NET_RESOLVE_HOST_FUNCTION_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
#include "services/network/public/cpp/resolve_host_client_base.h"
|
#include "services/network/public/cpp/resolve_host_client_base.h"
|
||||||
#include "services/network/public/mojom/host_resolver.mojom.h"
|
#include "services/network/public/mojom/host_resolver.mojom.h"
|
||||||
#include "services/network/public/mojom/network_context.mojom.h"
|
#include "services/network/public/mojom/network_context.mojom.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
|
@ -26,9 +26,8 @@ class ResolveHostFunction
|
||||||
: public base::RefCountedThreadSafe<ResolveHostFunction>,
|
: public base::RefCountedThreadSafe<ResolveHostFunction>,
|
||||||
network::ResolveHostClientBase {
|
network::ResolveHostClientBase {
|
||||||
public:
|
public:
|
||||||
using ResolveHostCallback = base::OnceCallback<void(
|
using ResolveHostCallback = base::OnceCallback<
|
||||||
int64_t,
|
void(int64_t, const std::optional<net::AddressList>& resolved_addresses)>;
|
||||||
const absl::optional<net::AddressList>& resolved_addresses)>;
|
|
||||||
|
|
||||||
explicit ResolveHostFunction(ElectronBrowserContext* browser_context,
|
explicit ResolveHostFunction(ElectronBrowserContext* browser_context,
|
||||||
std::string host,
|
std::string host,
|
||||||
|
@ -50,8 +49,8 @@ class ResolveHostFunction
|
||||||
// network::mojom::ResolveHostClient implementation
|
// network::mojom::ResolveHostClient implementation
|
||||||
void OnComplete(int result,
|
void OnComplete(int result,
|
||||||
const net::ResolveErrorInfo& resolve_error_info,
|
const net::ResolveErrorInfo& resolve_error_info,
|
||||||
const absl::optional<net::AddressList>& resolved_addresses,
|
const std::optional<net::AddressList>& resolved_addresses,
|
||||||
const absl::optional<net::HostResolverEndpointResults>&
|
const std::optional<net::HostResolverEndpointResults>&
|
||||||
endpoint_results_with_metadata) override;
|
endpoint_results_with_metadata) override;
|
||||||
|
|
||||||
SEQUENCE_CHECKER(sequence_checker_);
|
SEQUENCE_CHECKER(sequence_checker_);
|
||||||
|
|
|
@ -53,7 +53,7 @@ void ResolveProxyHelper::StartPendingRequest() {
|
||||||
receiver_.BindNewPipeAndPassRemote();
|
receiver_.BindNewPipeAndPassRemote();
|
||||||
receiver_.set_disconnect_handler(
|
receiver_.set_disconnect_handler(
|
||||||
base::BindOnce(&ResolveProxyHelper::OnProxyLookupComplete,
|
base::BindOnce(&ResolveProxyHelper::OnProxyLookupComplete,
|
||||||
base::Unretained(this), net::ERR_ABORTED, absl::nullopt));
|
base::Unretained(this), net::ERR_ABORTED, std::nullopt));
|
||||||
browser_context_->GetDefaultStoragePartition()
|
browser_context_->GetDefaultStoragePartition()
|
||||||
->GetNetworkContext()
|
->GetNetworkContext()
|
||||||
->LookUpProxyForURL(pending_requests_.front().url,
|
->LookUpProxyForURL(pending_requests_.front().url,
|
||||||
|
@ -63,7 +63,7 @@ void ResolveProxyHelper::StartPendingRequest() {
|
||||||
|
|
||||||
void ResolveProxyHelper::OnProxyLookupComplete(
|
void ResolveProxyHelper::OnProxyLookupComplete(
|
||||||
int32_t net_error,
|
int32_t net_error,
|
||||||
const absl::optional<net::ProxyInfo>& proxy_info) {
|
const std::optional<net::ProxyInfo>& proxy_info) {
|
||||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||||
DCHECK(!pending_requests_.empty());
|
DCHECK(!pending_requests_.empty());
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_NET_RESOLVE_PROXY_HELPER_H_
|
#define ELECTRON_SHELL_BROWSER_NET_RESOLVE_PROXY_HELPER_H_
|
||||||
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "mojo/public/cpp/bindings/receiver.h"
|
#include "mojo/public/cpp/bindings/receiver.h"
|
||||||
#include "services/network/public/mojom/proxy_lookup_client.mojom.h"
|
#include "services/network/public/mojom/proxy_lookup_client.mojom.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
@ -61,7 +61,7 @@ class ResolveProxyHelper
|
||||||
// network::mojom::ProxyLookupClient implementation.
|
// network::mojom::ProxyLookupClient implementation.
|
||||||
void OnProxyLookupComplete(
|
void OnProxyLookupComplete(
|
||||||
int32_t net_error,
|
int32_t net_error,
|
||||||
const absl::optional<net::ProxyInfo>& proxy_info) override;
|
const std::optional<net::ProxyInfo>& proxy_info) override;
|
||||||
|
|
||||||
// Self-reference. Owned as long as there's an outstanding proxy lookup.
|
// Self-reference. Owned as long as there's an outstanding proxy lookup.
|
||||||
scoped_refptr<ResolveProxyHelper> owned_self_;
|
scoped_refptr<ResolveProxyHelper> owned_self_;
|
||||||
|
|
|
@ -5,6 +5,8 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_
|
#ifndef ELECTRON_SHELL_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_
|
#define ELECTRON_SHELL_BROWSER_NET_SYSTEM_NETWORK_CONTEXT_MANAGER_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "base/memory/ref_counted.h"
|
#include "base/memory/ref_counted.h"
|
||||||
#include "chrome/browser/net/proxy_config_monitor.h"
|
#include "chrome/browser/net/proxy_config_monitor.h"
|
||||||
#include "mojo/public/cpp/bindings/remote.h"
|
#include "mojo/public/cpp/bindings/remote.h"
|
||||||
|
@ -14,7 +16,6 @@
|
||||||
#include "services/network/public/mojom/network_service.mojom.h"
|
#include "services/network/public/mojom/network_service.mojom.h"
|
||||||
#include "services/network/public/mojom/url_loader.mojom.h"
|
#include "services/network/public/mojom/url_loader.mojom.h"
|
||||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams();
|
network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams();
|
||||||
|
|
|
@ -72,7 +72,7 @@ void URLPipeLoader::OnResponseStarted(
|
||||||
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
|
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
|
||||||
|
|
||||||
client_->OnReceiveResponse(response_head.Clone(), std::move(consumer),
|
client_->OnReceiveResponse(response_head.Clone(), std::move(consumer),
|
||||||
absl::nullopt);
|
std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void URLPipeLoader::OnWrite(base::OnceClosure resume, MojoResult result) {
|
void URLPipeLoader::OnWrite(base::OnceClosure resume, MojoResult result) {
|
||||||
|
|
|
@ -68,7 +68,7 @@ class URLPipeLoader : public network::mojom::URLLoader,
|
||||||
const std::vector<std::string>& removed_headers,
|
const std::vector<std::string>& removed_headers,
|
||||||
const net::HttpRequestHeaders& modified_headers,
|
const net::HttpRequestHeaders& modified_headers,
|
||||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||||
const absl::optional<GURL>& new_url) override {}
|
const std::optional<GURL>& new_url) override {}
|
||||||
void SetPriority(net::RequestPriority priority,
|
void SetPriority(net::RequestPriority priority,
|
||||||
int32_t intra_priority_value) override {}
|
int32_t intra_priority_value) override {}
|
||||||
void PauseReadingBodyFromNet() override {}
|
void PauseReadingBodyFromNet() override {}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -31,7 +32,6 @@
|
||||||
#include "content/public/browser/render_process_host.h"
|
#include "content/public/browser/render_process_host.h"
|
||||||
#include "gpu/command_buffer/client/gl_helper.h"
|
#include "gpu/command_buffer/client/gl_helper.h"
|
||||||
#include "media/base/video_frame.h"
|
#include "media/base/video_frame.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "third_party/blink/public/common/input/web_input_event.h"
|
#include "third_party/blink/public/common/input/web_input_event.h"
|
||||||
#include "third_party/skia/include/core/SkCanvas.h"
|
#include "third_party/skia/include/core/SkCanvas.h"
|
||||||
#include "ui/compositor/compositor.h"
|
#include "ui/compositor/compositor.h"
|
||||||
|
@ -355,7 +355,7 @@ void OffScreenRenderWidgetHostView::SetBackgroundColor(SkColor color) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor() {
|
std::optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor() {
|
||||||
return background_color_;
|
return background_color_;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,9 +508,9 @@ gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
|
||||||
return gfx::Rect(size_);
|
return gfx::Rect(size_);
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<content::DisplayFeature>
|
std::optional<content::DisplayFeature>
|
||||||
OffScreenRenderWidgetHostView::GetDisplayFeature() {
|
OffScreenRenderWidgetHostView::GetDisplayFeature() {
|
||||||
return absl::nullopt;
|
return std::nullopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::SetDisplayFeatureForTesting(
|
void OffScreenRenderWidgetHostView::SetDisplayFeatureForTesting(
|
||||||
|
@ -530,8 +530,8 @@ OffScreenRenderWidgetHostView::CreateSyntheticGestureTarget() {
|
||||||
|
|
||||||
void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
|
void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
|
||||||
const gfx::Range&,
|
const gfx::Range&,
|
||||||
const absl::optional<std::vector<gfx::Rect>>& character_bounds,
|
const std::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||||
const absl::optional<std::vector<gfx::Rect>>& line_bounds) {}
|
const std::optional<std::vector<gfx::Rect>>& line_bounds) {}
|
||||||
|
|
||||||
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
|
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
|
||||||
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
|
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
|
||||||
|
|
|
@ -95,7 +95,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||||
gfx::Size GetVisibleViewportSize() override;
|
gfx::Size GetVisibleViewportSize() override;
|
||||||
void SetInsets(const gfx::Insets&) override;
|
void SetInsets(const gfx::Insets&) override;
|
||||||
void SetBackgroundColor(SkColor color) override;
|
void SetBackgroundColor(SkColor color) override;
|
||||||
absl::optional<SkColor> GetBackgroundColor() override;
|
std::optional<SkColor> GetBackgroundColor() override;
|
||||||
void UpdateBackgroundColor() override;
|
void UpdateBackgroundColor() override;
|
||||||
blink::mojom::PointerLockResult LockMouse(
|
blink::mojom::PointerLockResult LockMouse(
|
||||||
bool request_unadjusted_movement) override;
|
bool request_unadjusted_movement) override;
|
||||||
|
@ -141,7 +141,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||||
display::ScreenInfo GetScreenInfo() const override;
|
display::ScreenInfo GetScreenInfo() const override;
|
||||||
void TransformPointToRootSurface(gfx::PointF* point) override;
|
void TransformPointToRootSurface(gfx::PointF* point) override;
|
||||||
gfx::Rect GetBoundsInRootWindow(void) override;
|
gfx::Rect GetBoundsInRootWindow(void) override;
|
||||||
absl::optional<content::DisplayFeature> GetDisplayFeature() override;
|
std::optional<content::DisplayFeature> GetDisplayFeature() override;
|
||||||
void SetDisplayFeatureForTesting(
|
void SetDisplayFeatureForTesting(
|
||||||
const content::DisplayFeature* display_feature) override;
|
const content::DisplayFeature* display_feature) override;
|
||||||
void NotifyHostAndDelegateOnWasShown(
|
void NotifyHostAndDelegateOnWasShown(
|
||||||
|
@ -154,8 +154,8 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
||||||
CreateSyntheticGestureTarget() override;
|
CreateSyntheticGestureTarget() override;
|
||||||
void ImeCompositionRangeChanged(
|
void ImeCompositionRangeChanged(
|
||||||
const gfx::Range&,
|
const gfx::Range&,
|
||||||
const absl::optional<std::vector<gfx::Rect>>& character_bounds,
|
const std::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||||
const absl::optional<std::vector<gfx::Rect>>& line_bounds) override;
|
const std::optional<std::vector<gfx::Rect>>& line_bounds) override;
|
||||||
gfx::Size GetCompositorViewportPixelSize() override;
|
gfx::Size GetCompositorViewportPixelSize() override;
|
||||||
ui::Compositor* GetCompositor() override;
|
ui::Compositor* GetCompositor() override;
|
||||||
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ void OffScreenVideoConsumer::OnFrameCaptured(
|
||||||
new FramePinner{std::move(mapping), callbacks_remote.Unbind()});
|
new FramePinner{std::move(mapping), callbacks_remote.Unbind()});
|
||||||
bitmap.setImmutable();
|
bitmap.setImmutable();
|
||||||
|
|
||||||
absl::optional<gfx::Rect> update_rect = info->metadata.capture_update_rect;
|
std::optional<gfx::Rect> update_rect = info->metadata.capture_update_rect;
|
||||||
if (!update_rect.has_value() || update_rect->IsEmpty()) {
|
if (!update_rect.has_value() || update_rect->IsEmpty()) {
|
||||||
update_rect = content_rect;
|
update_rect = content_rect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,7 +34,7 @@ bool StringToAccelerator(const std::string& shortcut,
|
||||||
// Now, parse it into an accelerator.
|
// Now, parse it into an accelerator.
|
||||||
int modifiers = ui::EF_NONE;
|
int modifiers = ui::EF_NONE;
|
||||||
ui::KeyboardCode key = ui::VKEY_UNKNOWN;
|
ui::KeyboardCode key = ui::VKEY_UNKNOWN;
|
||||||
absl::optional<char16_t> shifted_char;
|
std::optional<char16_t> shifted_char;
|
||||||
for (const auto& token : tokens) {
|
for (const auto& token : tokens) {
|
||||||
ui::KeyboardCode code = electron::KeyboardCodeFromStr(token, &shifted_char);
|
ui::KeyboardCode code = electron::KeyboardCodeFromStr(token, &shifted_char);
|
||||||
if (shifted_char)
|
if (shifted_char)
|
||||||
|
|
|
@ -7,9 +7,10 @@
|
||||||
|
|
||||||
#include <Quartz/Quartz.h>
|
#include <Quartz/Quartz.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "base/memory/raw_ptr.h"
|
#include "base/memory/raw_ptr.h"
|
||||||
#include "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
|
#include "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
class NativeWindowMac;
|
class NativeWindowMac;
|
||||||
|
@ -30,7 +31,7 @@ class NativeWindowMac;
|
||||||
// Only valid during a live resize.
|
// Only valid during a live resize.
|
||||||
// Used to keep track of whether a resize is happening horizontally or
|
// Used to keep track of whether a resize is happening horizontally or
|
||||||
// vertically, even if physically the user is resizing in both directions.
|
// vertically, even if physically the user is resizing in both directions.
|
||||||
absl::optional<bool> resizingHorizontally_;
|
std::optional<bool> resizingHorizontally_;
|
||||||
}
|
}
|
||||||
- (id)initWithShell:(electron::NativeWindowMac*)shell;
|
- (id)initWithShell:(electron::NativeWindowMac*)shell;
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
|
|
||||||
#import <Cocoa/Cocoa.h>
|
#import <Cocoa/Cocoa.h>
|
||||||
|
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
#include <optional>
|
||||||
|
|
||||||
#include "ui/gfx/geometry/point.h"
|
#include "ui/gfx/geometry/point.h"
|
||||||
|
|
||||||
@class WindowButtonsProxy;
|
@class WindowButtonsProxy;
|
||||||
|
@ -48,7 +49,7 @@
|
||||||
- (void)setShowOnHover:(BOOL)yes;
|
- (void)setShowOnHover:(BOOL)yes;
|
||||||
|
|
||||||
// Set left-top margin of the window buttons..
|
// Set left-top margin of the window buttons..
|
||||||
- (void)setMargin:(const absl::optional<gfx::Point>&)margin;
|
- (void)setMargin:(const std::optional<gfx::Point>&)margin;
|
||||||
|
|
||||||
// Set height of button container
|
// Set height of button container
|
||||||
- (void)setHeight:(const float)height;
|
- (void)setHeight:(const float)height;
|
||||||
|
|
|
@ -79,7 +79,7 @@
|
||||||
[self updateButtonsVisibility];
|
[self updateButtonsVisibility];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)setMargin:(const absl::optional<gfx::Point>&)margin {
|
- (void)setMargin:(const std::optional<gfx::Point>&)margin {
|
||||||
if (margin)
|
if (margin)
|
||||||
margin_ = *margin;
|
margin_ = *margin;
|
||||||
else
|
else
|
||||||
|
|
|
@ -100,7 +100,7 @@ void ElectronMenuModel::SetSharingItem(SharingItem item) {
|
||||||
sharing_item_.emplace(std::move(item));
|
sharing_item_.emplace(std::move(item));
|
||||||
}
|
}
|
||||||
|
|
||||||
const absl::optional<ElectronMenuModel::SharingItem>&
|
const std::optional<ElectronMenuModel::SharingItem>&
|
||||||
ElectronMenuModel::GetSharingItem() const {
|
ElectronMenuModel::GetSharingItem() const {
|
||||||
return sharing_item_;
|
return sharing_item_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
|
#ifndef ELECTRON_SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
|
#define ELECTRON_SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -14,7 +15,6 @@
|
||||||
#include "base/memory/weak_ptr.h"
|
#include "base/memory/weak_ptr.h"
|
||||||
#include "base/observer_list.h"
|
#include "base/observer_list.h"
|
||||||
#include "base/observer_list_types.h"
|
#include "base/observer_list_types.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/base/models/simple_menu_model.h"
|
#include "ui/base/models/simple_menu_model.h"
|
||||||
#include "url/gurl.h"
|
#include "url/gurl.h"
|
||||||
|
|
||||||
|
@ -29,9 +29,9 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
||||||
SharingItem(const SharingItem&) = delete;
|
SharingItem(const SharingItem&) = delete;
|
||||||
~SharingItem();
|
~SharingItem();
|
||||||
|
|
||||||
absl::optional<std::vector<std::string>> texts;
|
std::optional<std::vector<std::string>> texts;
|
||||||
absl::optional<std::vector<GURL>> urls;
|
std::optional<std::vector<GURL>> urls;
|
||||||
absl::optional<std::vector<base::FilePath>> file_paths;
|
std::optional<std::vector<base::FilePath>> file_paths;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
||||||
bool GetSharingItemAt(size_t index, SharingItem* item) const;
|
bool GetSharingItemAt(size_t index, SharingItem* item) const;
|
||||||
// Set/Get the SharingItem of this menu.
|
// Set/Get the SharingItem of this menu.
|
||||||
void SetSharingItem(SharingItem item);
|
void SetSharingItem(SharingItem item);
|
||||||
const absl::optional<SharingItem>& GetSharingItem() const;
|
const std::optional<SharingItem>& GetSharingItem() const;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// ui::SimpleMenuModel:
|
// ui::SimpleMenuModel:
|
||||||
|
@ -116,7 +116,7 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
||||||
raw_ptr<Delegate> delegate_; // weak ref.
|
raw_ptr<Delegate> delegate_; // weak ref.
|
||||||
|
|
||||||
#if BUILDFLAG(IS_MAC)
|
#if BUILDFLAG(IS_MAC)
|
||||||
absl::optional<SharingItem> sharing_item_;
|
std::optional<SharingItem> sharing_item_;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
base::flat_map<int, std::u16string> toolTips_; // command id -> tooltip
|
base::flat_map<int, std::u16string> toolTips_; // command id -> tooltip
|
||||||
|
|
|
@ -5,12 +5,12 @@
|
||||||
#ifndef ELECTRON_SHELL_BROWSER_UI_MESSAGE_BOX_H_
|
#ifndef ELECTRON_SHELL_BROWSER_UI_MESSAGE_BOX_H_
|
||||||
#define ELECTRON_SHELL_BROWSER_UI_MESSAGE_BOX_H_
|
#define ELECTRON_SHELL_BROWSER_UI_MESSAGE_BOX_H_
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "base/functional/callback_forward.h"
|
#include "base/functional/callback_forward.h"
|
||||||
#include "base/memory/raw_ptr_exclusion.h"
|
#include "base/memory/raw_ptr_exclusion.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/gfx/image/image_skia.h"
|
#include "ui/gfx/image/image_skia.h"
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
@ -29,7 +29,7 @@ struct MessageBoxSettings {
|
||||||
RAW_PTR_EXCLUSION electron::NativeWindow* parent_window = nullptr;
|
RAW_PTR_EXCLUSION electron::NativeWindow* parent_window = nullptr;
|
||||||
MessageBoxType type = electron::MessageBoxType::kNone;
|
MessageBoxType type = electron::MessageBoxType::kNone;
|
||||||
std::vector<std::string> buttons;
|
std::vector<std::string> buttons;
|
||||||
absl::optional<int> id;
|
std::optional<int> id;
|
||||||
int default_id;
|
int default_id;
|
||||||
int cancel_id;
|
int cancel_id;
|
||||||
bool no_link = false;
|
bool no_link = false;
|
||||||
|
|
|
@ -192,7 +192,7 @@ class GtkMessageBox : public NativeWindowObserver {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
// The id of the dialog.
|
// The id of the dialog.
|
||||||
absl::optional<int> id_;
|
std::optional<int> id_;
|
||||||
|
|
||||||
// The id to return when the dialog is closed without pressing buttons.
|
// The id to return when the dialog is closed without pressing buttons.
|
||||||
int cancel_id_ = 0;
|
int cancel_id_ = 0;
|
||||||
|
|
|
@ -162,7 +162,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
|
||||||
// Duplicate the callback object here since c is a reference and gcd would
|
// Duplicate the callback object here since c is a reference and gcd would
|
||||||
// only store the pointer, by duplication we can force gcd to store a copy.
|
// only store the pointer, by duplication we can force gcd to store a copy.
|
||||||
__block MessageBoxCallback callback_ = std::move(callback);
|
__block MessageBoxCallback callback_ = std::move(callback);
|
||||||
__block absl::optional<int> id = std::move(settings.id);
|
__block std::optional<int> id = std::move(settings.id);
|
||||||
__block int cancel_id = settings.cancel_id;
|
__block int cancel_id = settings.cancel_id;
|
||||||
|
|
||||||
auto handler = ^(NSModalResponse response) {
|
auto handler = ^(NSModalResponse response) {
|
||||||
|
|
|
@ -304,7 +304,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
|
||||||
dialog_thread::Run(base::BindOnce(&ShowTaskDialogUTF8, settings,
|
dialog_thread::Run(base::BindOnce(&ShowTaskDialogUTF8, settings,
|
||||||
parent_widget, base::Unretained(hwnd)),
|
parent_widget, base::Unretained(hwnd)),
|
||||||
base::BindOnce(
|
base::BindOnce(
|
||||||
[](MessageBoxCallback callback, absl::optional<int> id,
|
[](MessageBoxCallback callback, std::optional<int> id,
|
||||||
DialogResult result) {
|
DialogResult result) {
|
||||||
if (id)
|
if (id)
|
||||||
GetDialogsMap().erase(*id);
|
GetDialogsMap().erase(*id);
|
||||||
|
|
|
@ -18,7 +18,7 @@ namespace electron {
|
||||||
|
|
||||||
class TrayIcon {
|
class TrayIcon {
|
||||||
public:
|
public:
|
||||||
static TrayIcon* Create(absl::optional<UUID> guid);
|
static TrayIcon* Create(std::optional<UUID> guid);
|
||||||
|
|
||||||
#if BUILDFLAG(IS_WIN)
|
#if BUILDFLAG(IS_WIN)
|
||||||
using ImageType = HICON;
|
using ImageType = HICON;
|
||||||
|
|
|
@ -422,7 +422,7 @@ gfx::Rect TrayIconCocoa::GetBounds() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
TrayIcon* TrayIcon::Create(absl::optional<UUID> guid) {
|
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
|
||||||
return new TrayIconCocoa;
|
return new TrayIconCocoa;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,7 +108,7 @@ ui::StatusIconLinux* TrayIconLinux::GetStatusIcon() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
TrayIcon* TrayIcon::Create(absl::optional<UUID> guid) {
|
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
|
||||||
return new TrayIconLinux;
|
return new TrayIconLinux;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
|
||||||
// static
|
// static
|
||||||
TrayIcon* TrayIcon::Create(absl::optional<UUID> guid) {
|
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
|
||||||
static NotifyIconHost host;
|
static NotifyIconHost host;
|
||||||
return host.CreateNotifyIcon(guid);
|
return host.CreateNotifyIcon(guid);
|
||||||
}
|
}
|
||||||
|
|
|
@ -147,8 +147,8 @@ bool AutofillPopupView::CanStartDragForView(views::View*,
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutofillPopupView::OnSelectedRowChanged(
|
void AutofillPopupView::OnSelectedRowChanged(
|
||||||
absl::optional<int> previous_row_selection,
|
std::optional<int> previous_row_selection,
|
||||||
absl::optional<int> current_row_selection) {
|
std::optional<int> current_row_selection) {
|
||||||
SchedulePaint();
|
SchedulePaint();
|
||||||
|
|
||||||
if (current_row_selection) {
|
if (current_row_selection) {
|
||||||
|
@ -436,7 +436,7 @@ void AutofillPopupView::AcceptSelection(const gfx::Point& point) {
|
||||||
AcceptSelectedLine();
|
AcceptSelectedLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutofillPopupView::SetSelectedLine(absl::optional<int> selected_line) {
|
void AutofillPopupView::SetSelectedLine(std::optional<int> selected_line) {
|
||||||
if (!popup_)
|
if (!popup_)
|
||||||
return;
|
return;
|
||||||
if (selected_line_ == selected_line)
|
if (selected_line_ == selected_line)
|
||||||
|
@ -479,7 +479,7 @@ void AutofillPopupView::SelectPreviousLine() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutofillPopupView::ClearSelection() {
|
void AutofillPopupView::ClearSelection() {
|
||||||
SetSelectedLine(absl::nullopt);
|
SetSelectedLine(std::nullopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AutofillPopupView::RemoveObserver() {
|
void AutofillPopupView::RemoveObserver() {
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_AUTOFILL_POPUP_VIEW_H_
|
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_AUTOFILL_POPUP_VIEW_H_
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "shell/browser/ui/autofill_popup.h"
|
#include "shell/browser/ui/autofill_popup.h"
|
||||||
|
|
||||||
|
@ -14,7 +15,6 @@
|
||||||
#include "content/public/common/input/native_web_keyboard_event.h"
|
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||||
#include "electron/buildflags/buildflags.h"
|
#include "electron/buildflags/buildflags.h"
|
||||||
#include "shell/browser/osr/osr_view_proxy.h"
|
#include "shell/browser/osr/osr_view_proxy.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/accessibility/ax_node_data.h"
|
#include "ui/accessibility/ax_node_data.h"
|
||||||
#include "ui/base/metadata/metadata_header_macros.h"
|
#include "ui/base/metadata/metadata_header_macros.h"
|
||||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||||
|
@ -84,8 +84,8 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
||||||
private:
|
private:
|
||||||
friend class AutofillPopup;
|
friend class AutofillPopup;
|
||||||
|
|
||||||
void OnSelectedRowChanged(absl::optional<int> previous_row_selection,
|
void OnSelectedRowChanged(std::optional<int> previous_row_selection,
|
||||||
absl::optional<int> current_row_selection);
|
std::optional<int> current_row_selection);
|
||||||
|
|
||||||
// Draw the given autofill entry in |entry_rect|.
|
// Draw the given autofill entry in |entry_rect|.
|
||||||
void DrawAutofillEntry(gfx::Canvas* canvas,
|
void DrawAutofillEntry(gfx::Canvas* canvas,
|
||||||
|
@ -122,7 +122,7 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
||||||
void AcceptSuggestion(int index);
|
void AcceptSuggestion(int index);
|
||||||
bool AcceptSelectedLine();
|
bool AcceptSelectedLine();
|
||||||
void AcceptSelection(const gfx::Point& point);
|
void AcceptSelection(const gfx::Point& point);
|
||||||
void SetSelectedLine(absl::optional<int> selected_line);
|
void SetSelectedLine(std::optional<int> selected_line);
|
||||||
void SetSelection(const gfx::Point& point);
|
void SetSelection(const gfx::Point& point);
|
||||||
void SelectNextLine();
|
void SelectNextLine();
|
||||||
void SelectPreviousLine();
|
void SelectPreviousLine();
|
||||||
|
@ -141,7 +141,7 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
||||||
base::Time show_time_;
|
base::Time show_time_;
|
||||||
|
|
||||||
// The index of the currently selected line
|
// The index of the currently selected line
|
||||||
absl::optional<int> selected_line_;
|
std::optional<int> selected_line_;
|
||||||
|
|
||||||
std::unique_ptr<OffscreenViewProxy> view_proxy_;
|
std::unique_ptr<OffscreenViewProxy> view_proxy_;
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ const gfx::FontList* MenuDelegate::GetLabelFontList(int id) const {
|
||||||
return adapter_->GetLabelFontList(id);
|
return adapter_->GetLabelFontList(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
absl::optional<SkColor> MenuDelegate::GetLabelColor(int id) const {
|
std::optional<SkColor> MenuDelegate::GetLabelColor(int id) const {
|
||||||
return adapter_->GetLabelColor(id);
|
return adapter_->GetLabelColor(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class MenuDelegate : public views::MenuDelegate {
|
||||||
bool GetAccelerator(int id, ui::Accelerator* accelerator) const override;
|
bool GetAccelerator(int id, ui::Accelerator* accelerator) const override;
|
||||||
std::u16string GetLabel(int id) const override;
|
std::u16string GetLabel(int id) const override;
|
||||||
const gfx::FontList* GetLabelFontList(int id) const override;
|
const gfx::FontList* GetLabelFontList(int id) const override;
|
||||||
absl::optional<SkColor> GetLabelColor(int id) const override;
|
std::optional<SkColor> GetLabelColor(int id) const override;
|
||||||
bool IsCommandEnabled(int id) const override;
|
bool IsCommandEnabled(int id) const override;
|
||||||
bool IsCommandVisible(int id) const override;
|
bool IsCommandVisible(int id) const override;
|
||||||
bool IsItemChecked(int id) const override;
|
bool IsItemChecked(int id) const override;
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "shell/browser/ui/webui/accessibility_ui.h"
|
#include "shell/browser/ui/webui/accessibility_ui.h"
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <optional>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
@ -42,7 +43,6 @@
|
||||||
#include "content/public/browser/web_ui_data_source.h"
|
#include "content/public/browser/web_ui_data_source.h"
|
||||||
#include "shell/browser/native_window.h"
|
#include "shell/browser/native_window.h"
|
||||||
#include "shell/browser/window_list.h"
|
#include "shell/browser/window_list.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/accessibility/platform/ax_platform_node.h"
|
#include "ui/accessibility/platform/ax_platform_node.h"
|
||||||
#include "ui/accessibility/platform/ax_platform_node_delegate.h"
|
#include "ui/accessibility/platform/ax_platform_node_delegate.h"
|
||||||
#include "ui/base/webui/web_ui_util.h"
|
#include "ui/base/webui/web_ui_util.h"
|
||||||
|
|
|
@ -4,11 +4,12 @@
|
||||||
|
|
||||||
#include "shell/browser/ui/win/electron_desktop_window_tree_host_win.h"
|
#include "shell/browser/ui/win/electron_desktop_window_tree_host_win.h"
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "base/win/windows_version.h"
|
#include "base/win/windows_version.h"
|
||||||
#include "electron/buildflags/buildflags.h"
|
#include "electron/buildflags/buildflags.h"
|
||||||
#include "shell/browser/ui/views/win_frame_view.h"
|
#include "shell/browser/ui/views/win_frame_view.h"
|
||||||
#include "shell/browser/win/dark_mode.h"
|
#include "shell/browser/win/dark_mode.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/base/win/hwnd_metrics.h"
|
#include "ui/base/win/hwnd_metrics.h"
|
||||||
#include "ui/base/win/shell.h"
|
#include "ui/base/win/shell.h"
|
||||||
|
|
||||||
|
|
|
@ -7,8 +7,9 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
|
||||||
#include "shell/browser/native_window_views.h"
|
#include "shell/browser/native_window_views.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
|
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_win.h"
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
|
@ -44,7 +45,7 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin,
|
||||||
|
|
||||||
private:
|
private:
|
||||||
raw_ptr<NativeWindowViews> native_window_view_; // weak ref
|
raw_ptr<NativeWindowViews> native_window_view_; // weak ref
|
||||||
absl::optional<bool> force_should_paint_as_active_;
|
std::optional<bool> force_should_paint_as_active_;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace electron
|
} // namespace electron
|
||||||
|
|
|
@ -191,7 +191,7 @@ NotifyIconHost::~NotifyIconHost() {
|
||||||
delete ptr;
|
delete ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
NotifyIcon* NotifyIconHost::CreateNotifyIcon(absl::optional<UUID> guid) {
|
NotifyIcon* NotifyIconHost::CreateNotifyIcon(std::optional<UUID> guid) {
|
||||||
if (guid.has_value()) {
|
if (guid.has_value()) {
|
||||||
for (NotifyIcons::const_iterator i(notify_icons_.begin());
|
for (NotifyIcons::const_iterator i(notify_icons_.begin());
|
||||||
i != notify_icons_.end(); ++i) {
|
i != notify_icons_.end(); ++i) {
|
||||||
|
|
|
@ -7,10 +7,10 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "shell/common/gin_converters/guid_converter.h"
|
#include "shell/common/gin_converters/guid_converter.h"
|
||||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
|
||||||
|
|
||||||
const GUID GUID_DEFAULT = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
const GUID GUID_DEFAULT = {0, 0, 0, {0, 0, 0, 0, 0, 0, 0, 0}};
|
||||||
|
|
||||||
|
@ -27,7 +27,7 @@ class NotifyIconHost {
|
||||||
NotifyIconHost(const NotifyIconHost&) = delete;
|
NotifyIconHost(const NotifyIconHost&) = delete;
|
||||||
NotifyIconHost& operator=(const NotifyIconHost&) = delete;
|
NotifyIconHost& operator=(const NotifyIconHost&) = delete;
|
||||||
|
|
||||||
NotifyIcon* CreateNotifyIcon(absl::optional<UUID> guid);
|
NotifyIcon* CreateNotifyIcon(std::optional<UUID> guid);
|
||||||
void Remove(NotifyIcon* notify_icon);
|
void Remove(NotifyIcon* notify_icon);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue