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 =
|
||||
std::size(kNonWildcardDomainNonPortSchemes);
|
||||
|
||||
absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
|
||||
std::optional<int> ElectronMainDelegate::BasicStartupComplete() {
|
||||
auto* command_line = base::CommandLine::ForCurrentProcess();
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
@ -311,7 +311,7 @@ absl::optional<int> ElectronMainDelegate::BasicStartupComplete() {
|
|||
::switches::kDisableGpuMemoryBufferCompositorResources);
|
||||
#endif
|
||||
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void ElectronMainDelegate::PreSandboxStartup() {
|
||||
|
@ -398,7 +398,7 @@ void ElectronMainDelegate::SandboxInitialized(const std::string& process_type) {
|
|||
#endif
|
||||
}
|
||||
|
||||
absl::optional<int> ElectronMainDelegate::PreBrowserMain() {
|
||||
std::optional<int> ElectronMainDelegate::PreBrowserMain() {
|
||||
// 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
|
||||
// service manager reads the features.
|
||||
|
@ -408,7 +408,7 @@ absl::optional<int> ElectronMainDelegate::PreBrowserMain() {
|
|||
#if BUILDFLAG(IS_MAC)
|
||||
RegisterAtomCrApp();
|
||||
#endif
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
base::StringPiece ElectronMainDelegate::GetBrowserV8SnapshotFilename() {
|
||||
|
|
|
@ -34,10 +34,10 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
|
|||
|
||||
protected:
|
||||
// content::ContentMainDelegate:
|
||||
absl::optional<int> BasicStartupComplete() override;
|
||||
std::optional<int> BasicStartupComplete() override;
|
||||
void PreSandboxStartup() override;
|
||||
void SandboxInitialized(const std::string& process_type) override;
|
||||
absl::optional<int> PreBrowserMain() override;
|
||||
std::optional<int> PreBrowserMain() override;
|
||||
content::ContentClient* CreateContentClient() override;
|
||||
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
||||
content::ContentGpuClient* CreateContentGpuClient() override;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "shell/browser/api/electron_api_app.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -75,7 +76,6 @@
|
|||
#include "shell/common/platform_util.h"
|
||||
#include "shell/common/thread_restrictions.h"
|
||||
#include "shell/common/v8_value_serializer.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/gfx/image/image.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
@ -927,7 +927,7 @@ void App::SetAppPath(const base::FilePath& app_path) {
|
|||
|
||||
#if !BUILDFLAG(IS_MAC)
|
||||
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->IsAbsolute()) {
|
||||
thrower.ThrowError("Path must be absolute");
|
||||
|
@ -1604,7 +1604,7 @@ void ConfigureHostResolver(v8::Isolate* isolate,
|
|||
// doh_config.
|
||||
std::vector<net::DnsOverHttpsServerConfig> servers;
|
||||
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);
|
||||
if (!server_config.has_value()) {
|
||||
thrower.ThrowTypeError(std::string("not a valid DoH template: ") +
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_APP_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -180,7 +181,7 @@ class App : public ElectronBrowserClient::Delegate,
|
|||
void ChildProcessDisconnected(int pid);
|
||||
|
||||
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.
|
||||
base::FilePath GetPath(gin_helper::ErrorThrower thrower,
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
namespace electron::api {
|
||||
|
||||
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->IsAbsolute()) {
|
||||
thrower.ThrowError("Path must be absolute");
|
||||
|
|
|
@ -826,11 +826,11 @@ bool BaseWindow::GetWindowButtonVisibility() const {
|
|||
return window_->GetWindowButtonVisibility();
|
||||
}
|
||||
|
||||
void BaseWindow::SetWindowButtonPosition(absl::optional<gfx::Point> position) {
|
||||
void BaseWindow::SetWindowButtonPosition(std::optional<gfx::Point> position) {
|
||||
window_->SetWindowButtonPosition(std::move(position));
|
||||
}
|
||||
|
||||
absl::optional<gfx::Point> BaseWindow::GetWindowButtonPosition() const {
|
||||
std::optional<gfx::Point> BaseWindow::GetWindowButtonPosition() const {
|
||||
return window_->GetWindowButtonPosition();
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -187,8 +188,8 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
|
|||
std::string GetAlwaysOnTopLevel() const;
|
||||
void SetWindowButtonVisibility(bool visible);
|
||||
bool GetWindowButtonVisibility() const;
|
||||
void SetWindowButtonPosition(absl::optional<gfx::Point> position);
|
||||
absl::optional<gfx::Point> GetWindowButtonPosition() const;
|
||||
void SetWindowButtonPosition(std::optional<gfx::Point> position);
|
||||
std::optional<gfx::Point> GetWindowButtonPosition() const;
|
||||
|
||||
bool IsHiddenInMissionControl();
|
||||
void SetHiddenInMissionControl(bool hidden);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -17,7 +18,6 @@
|
|||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
using content::TracingController;
|
||||
|
||||
|
@ -58,18 +58,18 @@ namespace {
|
|||
|
||||
using CompletionCallback = base::OnceCallback<void(const base::FilePath&)>;
|
||||
|
||||
absl::optional<base::FilePath> CreateTemporaryFileOnIO() {
|
||||
std::optional<base::FilePath> CreateTemporaryFileOnIO() {
|
||||
base::FilePath temp_file_path;
|
||||
if (!base::CreateTemporaryFile(&temp_file_path))
|
||||
return absl::nullopt;
|
||||
return absl::make_optional(std::move(temp_file_path));
|
||||
return std::nullopt;
|
||||
return std::make_optional(std::move(temp_file_path));
|
||||
}
|
||||
|
||||
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(
|
||||
[](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) {
|
||||
promise.RejectWithErrorMessage(error.value());
|
||||
} else {
|
||||
|
@ -81,20 +81,20 @@ void StopTracing(gin_helper::Promise<base::FilePath> promise,
|
|||
auto* instance = TracingController::GetInstance();
|
||||
if (!instance->IsTracing()) {
|
||||
std::move(resolve_or_reject)
|
||||
.Run(absl::make_optional(
|
||||
.Run(std::make_optional(
|
||||
"Failed to stop tracing - no trace in progress"));
|
||||
} else if (file_path) {
|
||||
auto split_callback = base::SplitOnceCallback(std::move(resolve_or_reject));
|
||||
auto endpoint = TracingController::CreateFileEndpoint(
|
||||
*file_path,
|
||||
base::BindOnce(std::move(split_callback.first), absl::nullopt));
|
||||
base::BindOnce(std::move(split_callback.first), std::nullopt));
|
||||
if (!instance->StopTracing(endpoint)) {
|
||||
std::move(split_callback.second)
|
||||
.Run(absl::make_optional("Failed to stop tracing"));
|
||||
.Run(std::make_optional("Failed to stop tracing"));
|
||||
}
|
||||
} else {
|
||||
std::move(resolve_or_reject)
|
||||
.Run(absl::make_optional(
|
||||
.Run(std::make_optional(
|
||||
"Failed to create temporary file for trace data"));
|
||||
}
|
||||
}
|
||||
|
@ -105,7 +105,7 @@ v8::Local<v8::Promise> StopRecording(gin_helper::Arguments* args) {
|
|||
|
||||
base::FilePath path;
|
||||
if (args->GetNext(&path) && !path.empty()) {
|
||||
StopTracing(std::move(promise), absl::make_optional(path));
|
||||
StopTracing(std::move(promise), std::make_optional(path));
|
||||
} else {
|
||||
// use a temporary file.
|
||||
base::ThreadPool::PostTaskAndReplyWithResult(
|
||||
|
|
|
@ -127,13 +127,13 @@ bool MatchesCookie(const base::Value::Dict& filter,
|
|||
if ((str = filter.FindString("domain")) &&
|
||||
!MatchesDomain(*str, cookie.Domain()))
|
||||
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())
|
||||
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())
|
||||
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())
|
||||
return false;
|
||||
return true;
|
||||
|
@ -161,7 +161,7 @@ void FilterCookieWithStatuses(
|
|||
}
|
||||
|
||||
// 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
|
||||
return base::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")),
|
||||
ParseTimeProperty(details.FindDouble("expirationDate")),
|
||||
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);
|
||||
|
||||
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()),
|
||||
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);
|
||||
if (!parsed_message || !parsed_message->is_dict())
|
||||
return;
|
||||
base::Value::Dict& dict = parsed_message->GetDict();
|
||||
absl::optional<int> id = dict.FindInt("id");
|
||||
std::optional<int> id = dict.FindInt("id");
|
||||
if (!id) {
|
||||
std::string* method = dict.FindString("method");
|
||||
if (!method)
|
||||
|
|
|
@ -25,7 +25,7 @@ static NSMenu* __strong applicationMenu_;
|
|||
ui::Accelerator GetAcceleratorFromKeyEquivalentAndModifierMask(
|
||||
NSString* key_equivalent,
|
||||
NSUInteger modifier_mask) {
|
||||
absl::optional<char16_t> shifted_char;
|
||||
std::optional<char16_t> shifted_char;
|
||||
ui::KeyboardCode code = electron::KeyboardCodeFromStr(
|
||||
base::SysNSStringToUTF8(key_equivalent), &shifted_char);
|
||||
int modifiers = 0;
|
||||
|
|
|
@ -125,7 +125,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
|
|||
}
|
||||
|
||||
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();
|
||||
|
||||
auto command_line_string =
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef 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/functional/callback.h"
|
||||
#include "base/memory/raw_ptr.h"
|
||||
|
@ -16,7 +18,6 @@
|
|||
#include "net/log/net_log_capture_mode.h"
|
||||
#include "services/network/public/mojom/net_log.mojom.h"
|
||||
#include "shell/common/gin_helper/promise.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace gin {
|
||||
class Arguments;
|
||||
|
@ -67,7 +68,7 @@ class NetLog : public gin::Wrappable<NetLog> {
|
|||
|
||||
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_;
|
||||
|
||||
|
|
|
@ -281,7 +281,7 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
|
|||
url_chain, GURL(),
|
||||
content::StoragePartitionConfig::CreateDefault(
|
||||
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(),
|
||||
download::DownloadItem::INTERRUPTED,
|
||||
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(
|
||||
std::string host,
|
||||
absl::optional<network::mojom::ResolveHostParametersPtr> params) {
|
||||
std::optional<network::mojom::ResolveHostParametersPtr> params) {
|
||||
gin_helper::Promise<gin_helper::Dictionary> promise(isolate_);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
|
@ -441,7 +441,7 @@ v8::Local<v8::Promise> Session::ResolveHost(
|
|||
params ? std::move(params.value()) : nullptr,
|
||||
base::BindOnce(
|
||||
[](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) {
|
||||
promise.RejectWithErrorMessage(net::ErrorToString(net_error));
|
||||
} else {
|
||||
|
@ -1271,7 +1271,7 @@ gin::Handle<Session> Session::FromPartition(v8::Isolate* isolate,
|
|||
}
|
||||
|
||||
// static
|
||||
absl::optional<gin::Handle<Session>> Session::FromPath(
|
||||
std::optional<gin::Handle<Session>> Session::FromPath(
|
||||
v8::Isolate* isolate,
|
||||
const base::FilePath& path,
|
||||
base::Value::Dict options) {
|
||||
|
@ -1280,12 +1280,12 @@ absl::optional<gin::Handle<Session>> Session::FromPath(
|
|||
if (path.empty()) {
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||
promise.RejectWithErrorMessage("An empty path was specified");
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
if (!path.IsAbsolute()) {
|
||||
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
|
||||
promise.RejectWithErrorMessage("An absolute path was not provided");
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
browser_context =
|
||||
|
@ -1410,7 +1410,7 @@ v8::Local<v8::Value> FromPath(const base::FilePath& path,
|
|||
}
|
||||
base::Value::Dict 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));
|
||||
|
||||
if (session_handle)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_API_ELECTRON_API_SESSION_H_
|
||||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_SESSION_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -85,7 +86,7 @@ class Session : public gin::Wrappable<Session>,
|
|||
base::Value::Dict options = {});
|
||||
|
||||
// Gets the Session based on |path|.
|
||||
static absl::optional<gin::Handle<Session>> FromPath(
|
||||
static std::optional<gin::Handle<Session>> FromPath(
|
||||
v8::Isolate* isolate,
|
||||
const base::FilePath& path,
|
||||
base::Value::Dict options = {});
|
||||
|
@ -101,7 +102,7 @@ class Session : public gin::Wrappable<Session>,
|
|||
// Methods.
|
||||
v8::Local<v8::Promise> ResolveHost(
|
||||
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> GetCacheSize();
|
||||
v8::Local<v8::Promise> ClearCache();
|
||||
|
|
|
@ -51,7 +51,7 @@ gin::WrapperInfo Tray::kWrapperInfo = {gin::kEmbedderNativeGin};
|
|||
|
||||
Tray::Tray(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> image,
|
||||
absl::optional<UUID> guid)
|
||||
std::optional<UUID> guid)
|
||||
: tray_icon_(TrayIcon::Create(guid)) {
|
||||
SetImage(isolate, image);
|
||||
tray_icon_->AddObserver(this);
|
||||
|
@ -62,7 +62,7 @@ Tray::~Tray() = default;
|
|||
// static
|
||||
gin::Handle<Tray> Tray::New(gin_helper::ErrorThrower thrower,
|
||||
v8::Local<v8::Value> image,
|
||||
absl::optional<UUID> guid,
|
||||
std::optional<UUID> guid,
|
||||
gin::Arguments* args) {
|
||||
if (!Browser::Get()->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,
|
||||
const absl::optional<gin_helper::Dictionary>& options,
|
||||
const std::optional<gin_helper::Dictionary>& options,
|
||||
gin::Arguments* args) {
|
||||
if (!CheckAlive())
|
||||
return;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_API_ELECTRON_API_TRAY_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -43,7 +44,7 @@ class Tray : public gin::Wrappable<Tray>,
|
|||
// gin_helper::Constructible
|
||||
static gin::Handle<Tray> New(gin_helper::ErrorThrower thrower,
|
||||
v8::Local<v8::Value> image,
|
||||
absl::optional<UUID> guid,
|
||||
std::optional<UUID> guid,
|
||||
gin::Arguments* args);
|
||||
|
||||
static void FillObjectTemplate(v8::Isolate*, v8::Local<v8::ObjectTemplate>);
|
||||
|
@ -60,7 +61,7 @@ class Tray : public gin::Wrappable<Tray>,
|
|||
private:
|
||||
Tray(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> image,
|
||||
absl::optional<UUID> guid);
|
||||
std::optional<UUID> guid);
|
||||
~Tray() override;
|
||||
|
||||
// TrayIconObserver:
|
||||
|
@ -92,7 +93,7 @@ class Tray : public gin::Wrappable<Tray>,
|
|||
void SetPressedImage(v8::Isolate* isolate, v8::Local<v8::Value> image);
|
||||
void SetToolTip(const std::string& tool_tip);
|
||||
void SetTitle(const std::string& title,
|
||||
const absl::optional<gin_helper::Dictionary>& options,
|
||||
const std::optional<gin_helper::Dictionary>& options,
|
||||
gin::Arguments* args);
|
||||
std::string GetTitle();
|
||||
void SetIgnoreDoubleClickEvents(bool ignore);
|
||||
|
|
|
@ -182,7 +182,7 @@ View::~View() {
|
|||
}
|
||||
|
||||
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
|
||||
// WebContentsView's view being deleted when the underlying WebContents is
|
||||
// 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;
|
||||
}
|
||||
|
||||
void View::SetBackgroundColor(absl::optional<WrappedSkColor> color) {
|
||||
void View::SetBackgroundColor(std::optional<WrappedSkColor> color) {
|
||||
if (!view_)
|
||||
return;
|
||||
view_->SetBackground(color ? views::CreateSolidBackground(*color) : nullptr);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef 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 "gin/handle.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,
|
||||
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 SetBounds(const gfx::Rect& bounds);
|
||||
gfx::Rect GetBounds();
|
||||
void SetLayout(v8::Isolate* isolate, v8::Local<v8::Object> value);
|
||||
std::vector<v8::Local<v8::Value>> GetChildren();
|
||||
void SetBackgroundColor(absl::optional<WrappedSkColor> color);
|
||||
void SetBackgroundColor(std::optional<WrappedSkColor> color);
|
||||
void SetVisible(bool visible);
|
||||
|
||||
// views::ViewObserver
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -128,7 +129,6 @@
|
|||
#include "shell/common/thread_restrictions.h"
|
||||
#include "shell/common/v8_value_serializer.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/input/web_input_event.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();
|
||||
}
|
||||
|
||||
absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
|
||||
std::optional<base::TimeDelta> GetCursorBlinkInterval() {
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
absl::optional<base::TimeDelta> system_value(
|
||||
std::optional<base::TimeDelta> system_value(
|
||||
ui::TextInsertionCaretBlinkPeriodFromDefaults());
|
||||
if (system_value)
|
||||
return *system_value;
|
||||
|
@ -512,7 +512,7 @@ absl::optional<base::TimeDelta> GetCursorBlinkInterval() {
|
|||
: base::Milliseconds(system_msec);
|
||||
}
|
||||
#endif
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
#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;
|
||||
if (options)
|
||||
options->Get("waitForBeforeUnload", &dispatch_beforeunload);
|
||||
|
@ -1675,7 +1675,7 @@ void WebContents::HandleNewRenderFrame(
|
|||
}
|
||||
|
||||
void WebContents::OnBackgroundColorChanged() {
|
||||
absl::optional<SkColor> color = web_contents()->GetBackgroundColor();
|
||||
std::optional<SkColor> color = web_contents()->GetBackgroundColor();
|
||||
if (color.has_value()) {
|
||||
auto* const view = web_contents()->GetRenderWidgetHostView();
|
||||
static_cast<content::RenderWidgetHostViewBase*>(view)
|
||||
|
@ -2266,7 +2266,7 @@ void WebContents::SetOwnerWindow(NativeWindow* owner_window) {
|
|||
SetOwnerWindow(GetWebContents(), owner_window);
|
||||
}
|
||||
|
||||
void WebContents::SetOwnerBaseWindow(absl::optional<BaseWindow*> owner_window) {
|
||||
void WebContents::SetOwnerBaseWindow(std::optional<BaseWindow*> owner_window) {
|
||||
SetOwnerWindow(GetWebContents(),
|
||||
owner_window ? (*owner_window)->window() : nullptr);
|
||||
}
|
||||
|
@ -3169,8 +3169,8 @@ v8::Local<v8::Promise> WebContents::PrintToPDF(const base::Value& settings) {
|
|||
web_contents()->GetPrimaryMainFrame()->GetLastCommittedURL(),
|
||||
landscape, display_header_footer, print_background, scale,
|
||||
paper_width, paper_height, margin_top, margin_bottom, margin_left,
|
||||
margin_right, absl::make_optional(header_template),
|
||||
absl::make_optional(footer_template), prefer_css_page_size,
|
||||
margin_right, std::make_optional(header_template),
|
||||
std::make_optional(footer_template), prefer_css_page_size,
|
||||
generate_tagged_pdf, generate_document_outline);
|
||||
|
||||
if (absl::holds_alternative<std::string>(print_pages_params)) {
|
||||
|
@ -3780,7 +3780,7 @@ void WebContents::SetImageAnimationPolicy(const std::string& new_policy) {
|
|||
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_) ||
|
||||
type_ == Type::kBrowserView
|
||||
? SK_ColorTRANSPARENT
|
||||
|
@ -4124,7 +4124,7 @@ void WebContents::DevToolsIndexPath(
|
|||
if (devtools_indexing_jobs_.count(request_id) != 0)
|
||||
return;
|
||||
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);
|
||||
if (parsed_excluded_folders && parsed_excluded_folders->is_list()) {
|
||||
for (const base::Value& folder_path : parsed_excluded_folders->GetList()) {
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -164,7 +165,7 @@ class WebContents : public ExclusiveAccessContext,
|
|||
const char* GetTypeName() override;
|
||||
|
||||
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(); }
|
||||
|
||||
bool GetBackgroundThrottling() const override;
|
||||
|
@ -403,7 +404,7 @@ class WebContents : public ExclusiveAccessContext,
|
|||
void SetOwnerWindow(NativeWindow* owner_window);
|
||||
void SetOwnerWindow(content::WebContents* web_contents,
|
||||
NativeWindow* owner_window);
|
||||
void SetOwnerBaseWindow(absl::optional<BaseWindow*> owner_window);
|
||||
void SetOwnerBaseWindow(std::optional<BaseWindow*> owner_window);
|
||||
|
||||
// Returns the WebContents managed by this delegate.
|
||||
content::WebContents* GetWebContents() const;
|
||||
|
@ -474,7 +475,7 @@ class WebContents : public ExclusiveAccessContext,
|
|||
void CancelDialogs(content::WebContents* web_contents,
|
||||
bool reset_state) override;
|
||||
|
||||
void SetBackgroundColor(absl::optional<SkColor> color);
|
||||
void SetBackgroundColor(std::optional<SkColor> color);
|
||||
|
||||
SkRegion* draggable_region() {
|
||||
return force_non_draggable_ ? nullptr : draggable_region_.get();
|
||||
|
|
|
@ -66,7 +66,7 @@ gin::Handle<WebContents> WebContentsView::GetWebContents(v8::Isolate* isolate) {
|
|||
return gin::Handle<WebContents>();
|
||||
}
|
||||
|
||||
void WebContentsView::SetBackgroundColor(absl::optional<WrappedSkColor> color) {
|
||||
void WebContentsView::SetBackgroundColor(std::optional<WrappedSkColor> color) {
|
||||
View::SetBackgroundColor(color);
|
||||
if (api_web_contents_) {
|
||||
api_web_contents_->SetBackgroundColor(color);
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef 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 "content/public/browser/web_contents_observer.h"
|
||||
#include "shell/browser/api/electron_api_view.h"
|
||||
|
@ -36,7 +38,7 @@ class WebContentsView : public View,
|
|||
|
||||
// Public APIs.
|
||||
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;
|
||||
|
||||
|
|
|
@ -229,7 +229,7 @@ void WebFrameMain::OnRendererConnectionError() {
|
|||
void WebFrameMain::PostMessage(v8::Isolate* isolate,
|
||||
const std::string& channel,
|
||||
v8::Local<v8::Value> message_value,
|
||||
absl::optional<v8::Local<v8::Value>> transfer) {
|
||||
std::optional<v8::Local<v8::Value>> transfer) {
|
||||
blink::TransferableMessage transferable_message;
|
||||
if (!electron::SerializeV8Value(isolate, message_value,
|
||||
&transferable_message)) {
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef 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 <vector>
|
||||
|
||||
|
@ -103,7 +104,7 @@ class WebFrameMain : public gin::Wrappable<WebFrameMain>,
|
|||
void PostMessage(v8::Isolate* isolate,
|
||||
const std::string& channel,
|
||||
v8::Local<v8::Value> message_value,
|
||||
absl::optional<v8::Local<v8::Value>> transfer);
|
||||
std::optional<v8::Local<v8::Value>> transfer);
|
||||
|
||||
int FrameTreeNodeID() const;
|
||||
std::string Name() const;
|
||||
|
|
|
@ -5,10 +5,9 @@
|
|||
#include "shell/browser/api/process_metric.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include <windows.h>
|
||||
|
||||
|
@ -34,14 +33,14 @@ mach_port_t TaskForPid(pid_t pid) {
|
|||
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)
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
mach_task_basic_info_data_t info = {};
|
||||
mach_msg_type_number_t count = MACH_TASK_BASIC_INFO_COUNT;
|
||||
kern_return_t kr = task_info(task, MACH_TASK_BASIC_INFO,
|
||||
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
|
||||
|
|
|
@ -67,7 +67,7 @@ void BadgeManager::BindServiceWorkerReceiver(
|
|||
std::move(context));
|
||||
}
|
||||
|
||||
std::string BadgeManager::GetBadgeString(absl::optional<int> badge_content) {
|
||||
std::string BadgeManager::GetBadgeString(std::optional<int> badge_content) {
|
||||
if (!badge_content)
|
||||
return "•";
|
||||
|
||||
|
@ -87,9 +87,9 @@ void BadgeManager::SetBadge(blink::mojom::BadgeValuePtr mojo_value) {
|
|||
return;
|
||||
}
|
||||
|
||||
absl::optional<int> value =
|
||||
mojo_value->is_flag() ? absl::nullopt
|
||||
: absl::make_optional(mojo_value->get_number());
|
||||
std::optional<int> value = mojo_value->is_flag()
|
||||
? std::nullopt
|
||||
: std::make_optional(mojo_value->get_number());
|
||||
|
||||
electron::Browser::Get()->SetBadgeCount(value);
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
#define ELECTRON_SHELL_BROWSER_BADGING_BADGE_MANAGER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "components/keyed_service/core/keyed_service.h"
|
||||
#include "mojo/public/cpp/bindings/receiver_set.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "third_party/blink/public/mojom/badging/badging.mojom.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
|
@ -44,7 +44,7 @@ class BadgeManager : public KeyedService, public blink::mojom::BadgeService {
|
|||
mojo::PendingReceiver<blink::mojom::BadgeService> receiver);
|
||||
|
||||
// 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:
|
||||
// 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,
|
||||
PairPromptCallback callback,
|
||||
PairingKind pairing_kind,
|
||||
const absl::optional<std::u16string>& pin) {
|
||||
const std::optional<std::u16string>& pin) {
|
||||
auto* web_contents = content::WebContents::FromRenderFrameHost(frame);
|
||||
if (web_contents) {
|
||||
auto* permission_manager = static_cast<ElectronPermissionManager*>(
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_BLUETOOTH_ELECTRON_BLUETOOTH_DELEGATE_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -57,7 +58,7 @@ class ElectronBluetoothDelegate : public content::BluetoothDelegate {
|
|||
const std::u16string& device_identifier,
|
||||
PairPromptCallback callback,
|
||||
PairingKind pairing_kind,
|
||||
const absl::optional<std::u16string>& pin) override;
|
||||
const std::optional<std::u16string>& pin) override;
|
||||
blink::WebBluetoothDeviceId GetWebBluetoothDeviceId(
|
||||
content::RenderFrameHost* frame,
|
||||
const std::string& device_address) override;
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_BROWSER_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -108,7 +109,7 @@ class Browser : public WindowListObserver {
|
|||
#endif
|
||||
|
||||
// Set/Get the badge count.
|
||||
bool SetBadgeCount(absl::optional<int> count);
|
||||
bool SetBadgeCount(std::optional<int> count);
|
||||
int GetBadgeCount();
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
@ -374,7 +375,7 @@ class Browser : public WindowListObserver {
|
|||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
void UpdateBadgeContents(HWND hwnd,
|
||||
const absl::optional<std::string>& badge_content,
|
||||
const std::optional<std::string>& badge_content,
|
||||
const std::string& badge_alt_string);
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
absl::optional<std::string> GetXdgAppOutput(
|
||||
std::optional<std::string> GetXdgAppOutput(
|
||||
const std::vector<std::string>& argv) {
|
||||
std::string reply;
|
||||
int success_code;
|
||||
|
@ -58,9 +58,9 @@ absl::optional<std::string> GetXdgAppOutput(
|
|||
&success_code);
|
||||
|
||||
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) {
|
||||
|
@ -126,7 +126,7 @@ std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) {
|
|||
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()) {
|
||||
unity::SetDownloadCount(count.value());
|
||||
badge_count_ = count.value();
|
||||
|
|
|
@ -266,7 +266,7 @@ std::u16string Browser::GetApplicationNameForProtocol(const GURL& url) {
|
|||
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
|
||||
? badging::BadgeManager::GetBadgeString(count)
|
||||
: "");
|
||||
|
|
|
@ -516,10 +516,10 @@ v8::Local<v8::Promise> Browser::GetApplicationInfoForProtocol(
|
|||
return handle;
|
||||
}
|
||||
|
||||
bool Browser::SetBadgeCount(absl::optional<int> count) {
|
||||
absl::optional<std::string> badge_content;
|
||||
bool Browser::SetBadgeCount(std::optional<int> count) {
|
||||
std::optional<std::string> badge_content;
|
||||
if (count.has_value() && count.value() == 0) {
|
||||
badge_content = absl::nullopt;
|
||||
badge_content = std::nullopt;
|
||||
} else {
|
||||
badge_content = badging::BadgeManager::GetBadgeString(count);
|
||||
}
|
||||
|
@ -560,7 +560,7 @@ bool Browser::SetBadgeCount(absl::optional<int> count) {
|
|||
|
||||
void Browser::UpdateBadgeContents(
|
||||
HWND hwnd,
|
||||
const absl::optional<std::string>& badge_content,
|
||||
const std::optional<std::string>& badge_content,
|
||||
const std::string& badge_alt_string) {
|
||||
SkBitmap badge;
|
||||
if (badge_content) {
|
||||
|
|
|
@ -924,7 +924,7 @@ bool ElectronBrowserClient::HandleExternalProtocol(
|
|||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
const std::optional<url::Origin>& initiating_origin,
|
||||
content::RenderFrameHost* initiator_document,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory) {
|
||||
content::GetUIThreadTaskRunner({})->PostTask(
|
||||
|
@ -1129,7 +1129,7 @@ class FileURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
|
|||
void ElectronBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const absl::optional<url::Origin>& request_initiator_origin,
|
||||
const std::optional<url::Origin>& request_initiator_origin,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
auto* render_process_host =
|
||||
content::RenderProcessHost::FromID(render_process_id);
|
||||
|
@ -1265,7 +1265,7 @@ void ElectronBrowserClient::CreateWebSocket(
|
|||
WebSocketFactory factory,
|
||||
const GURL& url,
|
||||
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>
|
||||
handshake_client) {
|
||||
v8::Isolate* isolate = JavascriptEnvironment::GetIsolate();
|
||||
|
@ -1302,7 +1302,7 @@ bool ElectronBrowserClient::WillCreateURLLoaderFactory(
|
|||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
|
|
|
@ -201,7 +201,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_process_id,
|
||||
int render_frame_id,
|
||||
const absl::optional<url::Origin>& request_initiator_origin,
|
||||
const std::optional<url::Origin>& request_initiator_origin,
|
||||
NonNetworkURLLoaderFactoryMap* factories) override;
|
||||
void RegisterNonNetworkServiceWorkerUpdateURLLoaderFactories(
|
||||
content::BrowserContext* browser_context,
|
||||
|
@ -211,7 +211,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
WebSocketFactory factory,
|
||||
const GURL& url,
|
||||
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>
|
||||
handshake_client) override;
|
||||
bool WillInterceptWebSocket(content::RenderFrameHost*) override;
|
||||
|
@ -221,7 +221,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
int render_process_id,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
absl::optional<int64_t> navigation_id,
|
||||
std::optional<int64_t> navigation_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
||||
|
@ -263,7 +263,7 @@ class ElectronBrowserClient : public content::ContentBrowserClient,
|
|||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
ui::PageTransition page_transition,
|
||||
bool has_user_gesture,
|
||||
const absl::optional<url::Origin>& initiating_origin,
|
||||
const std::optional<url::Origin>& initiating_origin,
|
||||
content::RenderFrameHost* initiator_document,
|
||||
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
||||
override;
|
||||
|
|
|
@ -447,7 +447,7 @@ ElectronBrowserContext::GetURLLoaderFactory() {
|
|||
->WillCreateURLLoaderFactory(
|
||||
this, nullptr, -1,
|
||||
content::ContentBrowserClient::URLLoaderFactoryType::kNavigation,
|
||||
url::Origin(), absl::nullopt, ukm::kInvalidSourceIdObj,
|
||||
url::Origin(), std::nullopt, ukm::kInvalidSourceIdObj,
|
||||
&factory_receiver, &header_client, nullptr, nullptr, nullptr,
|
||||
nullptr);
|
||||
|
||||
|
|
|
@ -7,9 +7,11 @@
|
|||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/weak_ptr.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<ProtocolRegistry> protocol_registry_;
|
||||
|
||||
absl::optional<std::string> user_agent_;
|
||||
std::optional<std::string> user_agent_;
|
||||
base::FilePath path_;
|
||||
bool in_memory_ = false;
|
||||
bool use_cache_ = true;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "shell/browser/electron_browser_main_parts.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -64,7 +65,6 @@
|
|||
#include "shell/common/logging.h"
|
||||
#include "shell/common/node_bindings.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/l10n/l10n_util.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
|
||||
// locale.
|
||||
auto env = base::Environment::Create();
|
||||
absl::optional<std::string> lc_all;
|
||||
std::optional<std::string> lc_all;
|
||||
if (!locale.empty()) {
|
||||
std::string str;
|
||||
if (env->GetVar("LC_ALL", &str))
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_ELECTRON_BROWSER_MAIN_PARTS_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
|
@ -16,7 +17,6 @@
|
|||
#include "electron/buildflags/buildflags.h"
|
||||
#include "mojo/public/cpp/bindings/remote.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/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.
|
||||
// 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_;
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ PdfViewerPrivateIsAllowedLocalFileAccessFunction::
|
|||
|
||||
ExtensionFunction::ResponseAction
|
||||
PdfViewerPrivateIsAllowedLocalFileAccessFunction::Run() {
|
||||
absl::optional<IsAllowedLocalFileAccess::Params> params =
|
||||
std::optional<IsAllowedLocalFileAccess::Params> params =
|
||||
IsAllowedLocalFileAccess::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -81,7 +81,7 @@ PdfViewerPrivateSetPdfOcrPrefFunction::
|
|||
|
||||
// TODO(codebytere): enable when https://crbug.com/1393069 works properly.
|
||||
ExtensionFunction::ResponseAction PdfViewerPrivateSetPdfOcrPrefFunction::Run() {
|
||||
absl::optional<SetPdfOcrPref::Params> params =
|
||||
std::optional<SetPdfOcrPref::Params> params =
|
||||
SetPdfOcrPref::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
return RespondNow(WithArguments(false));
|
||||
|
|
|
@ -40,7 +40,7 @@ ResourcesPrivateGetStringsFunction::~ResourcesPrivateGetStringsFunction() =
|
|||
default;
|
||||
|
||||
ExtensionFunction::ResponseAction ResourcesPrivateGetStringsFunction::Run() {
|
||||
absl::optional<get_strings::Params> params(
|
||||
std::optional<get_strings::Params> params(
|
||||
get_strings::Params::Create(args()));
|
||||
base::Value::Dict dict;
|
||||
|
||||
|
|
|
@ -198,14 +198,14 @@ bool GetFileResources(const std::vector<std::string>& files,
|
|||
|
||||
using ResourcesLoadedCallback =
|
||||
base::OnceCallback<void(std::vector<InjectedFileSource>,
|
||||
absl::optional<std::string>)>;
|
||||
std::optional<std::string>)>;
|
||||
|
||||
// Checks the loaded content of extension resources. Invokes `callback` with
|
||||
// the constructed file sources on success or with an error on failure.
|
||||
void CheckLoadedResources(std::vector<std::string> file_names,
|
||||
ResourcesLoadedCallback callback,
|
||||
std::vector<std::unique_ptr<std::string>> file_data,
|
||||
absl::optional<std::string> load_error) {
|
||||
std::optional<std::string> load_error) {
|
||||
if (load_error) {
|
||||
std::move(callback).Run({}, std::move(load_error));
|
||||
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
|
||||
|
@ -582,7 +582,7 @@ ScriptingExecuteScriptFunction::ScriptingExecuteScriptFunction() = default;
|
|||
ScriptingExecuteScriptFunction::~ScriptingExecuteScriptFunction() = default;
|
||||
|
||||
ExtensionFunction::ResponseAction ScriptingExecuteScriptFunction::Run() {
|
||||
absl::optional<api::scripting::ExecuteScript::Params> params =
|
||||
std::optional<api::scripting::ExecuteScript::Params> params =
|
||||
api::scripting::ExecuteScript::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
injection_ = std::move(params->injection);
|
||||
|
@ -654,7 +654,7 @@ ExtensionFunction::ResponseAction ScriptingExecuteScriptFunction::Run() {
|
|||
|
||||
void ScriptingExecuteScriptFunction::DidLoadResources(
|
||||
std::vector<InjectedFileSource> file_sources,
|
||||
absl::optional<std::string> load_error) {
|
||||
std::optional<std::string> load_error) {
|
||||
if (load_error) {
|
||||
Respond(Error(std::move(*load_error)));
|
||||
return;
|
||||
|
@ -749,7 +749,7 @@ ScriptingInsertCSSFunction::ScriptingInsertCSSFunction() = default;
|
|||
ScriptingInsertCSSFunction::~ScriptingInsertCSSFunction() = default;
|
||||
|
||||
ExtensionFunction::ResponseAction ScriptingInsertCSSFunction::Run() {
|
||||
absl::optional<api::scripting::InsertCSS::Params> params =
|
||||
std::optional<api::scripting::InsertCSS::Params> params =
|
||||
api::scripting::InsertCSS::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -793,7 +793,7 @@ ExtensionFunction::ResponseAction ScriptingInsertCSSFunction::Run() {
|
|||
|
||||
void ScriptingInsertCSSFunction::DidLoadResources(
|
||||
std::vector<InjectedFileSource> file_sources,
|
||||
absl::optional<std::string> load_error) {
|
||||
std::optional<std::string> load_error) {
|
||||
if (load_error) {
|
||||
Respond(Error(std::move(*load_error)));
|
||||
return;
|
||||
|
@ -850,7 +850,7 @@ ScriptingRemoveCSSFunction::ScriptingRemoveCSSFunction() = default;
|
|||
ScriptingRemoveCSSFunction::~ScriptingRemoveCSSFunction() = default;
|
||||
|
||||
ExtensionFunction::ResponseAction ScriptingRemoveCSSFunction::Run() {
|
||||
absl::optional<api::scripting::RemoveCSS::Params> params =
|
||||
std::optional<api::scripting::RemoveCSS::Params> params =
|
||||
api::scripting::RemoveCSS::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -929,7 +929,7 @@ ScriptingRegisterContentScriptsFunction::
|
|||
~ScriptingRegisterContentScriptsFunction() = default;
|
||||
|
||||
ExtensionFunction::ResponseAction ScriptingUpdateContentScriptsFunction::Run() {
|
||||
absl::optional<api::scripting::UpdateContentScripts::Params> params =
|
||||
std::optional<api::scripting::UpdateContentScripts::Params> params =
|
||||
api::scripting::UpdateContentScripts::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ void ScriptingRegisterContentScriptsFunction::OnContentScriptFilesValidated(
|
|||
}
|
||||
|
||||
void ScriptingRegisterContentScriptsFunction::OnContentScriptsRegistered(
|
||||
const absl::optional<std::string>& error) {
|
||||
const std::optional<std::string>& error) {
|
||||
if (error.has_value())
|
||||
Respond(Error(std::move(*error)));
|
||||
else
|
||||
|
@ -1102,11 +1102,11 @@ ScriptingGetRegisteredContentScriptsFunction::
|
|||
|
||||
ExtensionFunction::ResponseAction
|
||||
ScriptingGetRegisteredContentScriptsFunction::Run() {
|
||||
absl::optional<api::scripting::GetRegisteredContentScripts::Params> params =
|
||||
std::optional<api::scripting::GetRegisteredContentScripts::Params> params =
|
||||
api::scripting::GetRegisteredContentScripts::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
const absl::optional<api::scripting::ContentScriptFilter>& filter =
|
||||
const std::optional<api::scripting::ContentScriptFilter>& filter =
|
||||
params->filter;
|
||||
std::set<std::string> id_filter;
|
||||
if (filter && filter->ids) {
|
||||
|
@ -1157,7 +1157,7 @@ ScriptingUnregisterContentScriptsFunction::Run() {
|
|||
api::scripting::UnregisterContentScripts::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
absl::optional<api::scripting::ContentScriptFilter>& filter = params->filter;
|
||||
std::optional<api::scripting::ContentScriptFilter>& filter = params->filter;
|
||||
ExtensionUserScriptLoader* loader =
|
||||
ExtensionSystem::Get(browser_context())
|
||||
->user_script_manager()
|
||||
|
@ -1206,7 +1206,7 @@ ScriptingUnregisterContentScriptsFunction::Run() {
|
|||
}
|
||||
|
||||
void ScriptingUnregisterContentScriptsFunction::OnContentScriptsUnregistered(
|
||||
const absl::optional<std::string>& error) {
|
||||
const std::optional<std::string>& error) {
|
||||
if (error.has_value())
|
||||
Respond(Error(std::move(*error)));
|
||||
else
|
||||
|
@ -1220,7 +1220,7 @@ ScriptingUpdateContentScriptsFunction::
|
|||
|
||||
ExtensionFunction::ResponseAction
|
||||
ScriptingRegisterContentScriptsFunction::Run() {
|
||||
absl::optional<api::scripting::RegisterContentScripts::Params> params =
|
||||
std::optional<api::scripting::RegisterContentScripts::Params> params =
|
||||
api::scripting::RegisterContentScripts::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -1341,7 +1341,7 @@ void ScriptingUpdateContentScriptsFunction::OnContentScriptFilesValidated(
|
|||
}
|
||||
|
||||
void ScriptingUpdateContentScriptsFunction::OnContentScriptsUpdated(
|
||||
const absl::optional<std::string>& error) {
|
||||
const std::optional<std::string>& error) {
|
||||
if (error.has_value())
|
||||
Respond(Error(std::move(*error)));
|
||||
else
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_EXTENSIONS_API_SCRIPTING_SCRIPTING_API_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -16,7 +17,6 @@
|
|||
#include "extensions/browser/script_executor.h"
|
||||
#include "extensions/common/mojom/code_injection.mojom.h"
|
||||
#include "extensions/common/user_script.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace extensions {
|
||||
|
||||
|
@ -49,7 +49,7 @@ class ScriptingExecuteScriptFunction : public ExtensionFunction {
|
|||
|
||||
// Called when the resource files to be injected has been loaded.
|
||||
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.
|
||||
// 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.
|
||||
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.
|
||||
// Returns true on success; on failure, populates `error`.
|
||||
|
@ -132,7 +132,7 @@ class ScriptingRegisterContentScriptsFunction : public ExtensionFunction {
|
|||
scripting::ValidateScriptsResult result);
|
||||
|
||||
// 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 {
|
||||
|
@ -171,7 +171,7 @@ class ScriptingUnregisterContentScriptsFunction : public ExtensionFunction {
|
|||
~ScriptingUnregisterContentScriptsFunction() override;
|
||||
|
||||
// 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 {
|
||||
|
@ -197,7 +197,7 @@ class ScriptingUpdateContentScriptsFunction : public ExtensionFunction {
|
|||
scripting::ValidateScriptsResult result);
|
||||
|
||||
// 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
|
||||
|
|
|
@ -71,7 +71,7 @@ void ZoomModeToZoomSettings(WebContentsZoomController::ZoomMode zoom_mode,
|
|||
// 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
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
@ -210,7 +210,7 @@ bool TabsExecuteScriptFunction::ShouldRemoveCSS() const {
|
|||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsReloadFunction::Run() {
|
||||
absl::optional<tabs::Reload::Params> params =
|
||||
std::optional<tabs::Reload::Params> params =
|
||||
tabs::Reload::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -233,7 +233,7 @@ ExtensionFunction::ResponseAction TabsReloadFunction::Run() {
|
|||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsQueryFunction::Run() {
|
||||
absl::optional<tabs::Query::Params> params =
|
||||
std::optional<tabs::Query::Params> params =
|
||||
tabs::Query::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -255,8 +255,8 @@ ExtensionFunction::ResponseAction TabsQueryFunction::Run() {
|
|||
}
|
||||
|
||||
std::string title = params->query_info.title.value_or(std::string());
|
||||
absl::optional<bool> audible = params->query_info.audible;
|
||||
absl::optional<bool> muted = params->query_info.muted;
|
||||
std::optional<bool> audible = params->query_info.audible;
|
||||
std::optional<bool> muted = params->query_info.muted;
|
||||
|
||||
base::Value::List result;
|
||||
|
||||
|
@ -321,7 +321,7 @@ ExtensionFunction::ResponseAction TabsQueryFunction::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);
|
||||
int tab_id = params->tab_id;
|
||||
|
||||
|
@ -349,7 +349,7 @@ ExtensionFunction::ResponseAction TabsGetFunction::Run() {
|
|||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
||||
absl::optional<tabs::SetZoom::Params> params =
|
||||
std::optional<tabs::SetZoom::Params> params =
|
||||
tabs::SetZoom::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -377,7 +377,7 @@ ExtensionFunction::ResponseAction TabsSetZoomFunction::Run() {
|
|||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
||||
absl::optional<tabs::GetZoomSettings::Params> params =
|
||||
std::optional<tabs::GetZoomSettings::Params> params =
|
||||
tabs::GetZoomSettings::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -393,7 +393,7 @@ ExtensionFunction::ResponseAction TabsGetZoomFunction::Run() {
|
|||
}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
||||
absl::optional<tabs::GetZoomSettings::Params> params =
|
||||
std::optional<tabs::GetZoomSettings::Params> params =
|
||||
tabs::GetZoomSettings::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -417,7 +417,7 @@ ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
|
|||
ExtensionFunction::ResponseAction TabsSetZoomSettingsFunction::Run() {
|
||||
using tabs::ZoomSettings;
|
||||
|
||||
absl::optional<tabs::SetZoomSettings::Params> params =
|
||||
std::optional<tabs::SetZoomSettings::Params> params =
|
||||
tabs::SetZoomSettings::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
@ -588,7 +588,7 @@ base::expected<GURL, std::string> PrepareURLForNavigation(
|
|||
TabsUpdateFunction::TabsUpdateFunction() : web_contents_(nullptr) {}
|
||||
|
||||
ExtensionFunction::ResponseAction TabsUpdateFunction::Run() {
|
||||
absl::optional<tabs::Update::Params> params =
|
||||
std::optional<tabs::Update::Params> params =
|
||||
tabs::Update::Params::Create(args());
|
||||
EXTENSION_FUNCTION_VALIDATE(params);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ ElectronMessagingDelegate::IsNativeMessagingHostAllowed(
|
|||
return PolicyPermission::DISALLOW;
|
||||
}
|
||||
|
||||
absl::optional<base::Value::Dict> ElectronMessagingDelegate::MaybeGetTabInfo(
|
||||
std::optional<base::Value::Dict> ElectronMessagingDelegate::MaybeGetTabInfo(
|
||||
content::WebContents* web_contents) {
|
||||
if (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 absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
content::WebContents* ElectronMessagingDelegate::GetWebContentsByTabId(
|
||||
|
|
|
@ -27,7 +27,7 @@ class ElectronMessagingDelegate : public MessagingDelegate {
|
|||
PolicyPermission IsNativeMessagingHostAllowed(
|
||||
content::BrowserContext* browser_context,
|
||||
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* GetWebContentsByTabId(
|
||||
content::BrowserContext* browser_context,
|
||||
|
|
|
@ -52,7 +52,7 @@ void LoginHandler::EmitEvent(
|
|||
|
||||
api::WebContents* api_web_contents = api::WebContents::From(web_contents());
|
||||
if (!api_web_contents) {
|
||||
std::move(auth_required_callback_).Run(absl::nullopt);
|
||||
std::move(auth_required_callback_).Run(std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ void LoginHandler::EmitEvent(
|
|||
// deleted. Check the weak ptr before accessing any member variables to
|
||||
// prevent UAF.
|
||||
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_) {
|
||||
std::u16string username, 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;
|
||||
}
|
||||
std::move(auth_required_callback_)
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_OBSERVER_H_
|
||||
#define ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_OBSERVER_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
#include "base/memory/raw_ptr_exclusion.h"
|
||||
#include "base/memory/weak_ptr.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
#if defined(__OBJC__)
|
||||
@class InAppTransactionObserver;
|
||||
|
@ -39,7 +39,7 @@ struct Payment {
|
|||
std::string productIdentifier = "";
|
||||
int quantity = 1;
|
||||
std::string applicationUsername;
|
||||
absl::optional<PaymentDiscount> paymentDiscount;
|
||||
std::optional<PaymentDiscount> paymentDiscount;
|
||||
|
||||
Payment();
|
||||
Payment(const Payment&);
|
||||
|
|
|
@ -5,11 +5,11 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_PRODUCT_H_
|
||||
#define ELECTRON_SHELL_BROWSER_MAC_IN_APP_PURCHASE_PRODUCT_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/functional/callback.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace in_app_purchase {
|
||||
|
||||
|
@ -31,7 +31,7 @@ struct ProductDiscount {
|
|||
std::string priceLocale;
|
||||
std::string paymentMode;
|
||||
int numberOfPeriods;
|
||||
absl::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
||||
std::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
||||
|
||||
ProductDiscount(const ProductDiscount&);
|
||||
ProductDiscount();
|
||||
|
@ -50,10 +50,10 @@ struct Product {
|
|||
double price = 0.0;
|
||||
std::string formattedPrice;
|
||||
std::string currencyCode;
|
||||
absl::optional<ProductDiscount> introductoryPrice;
|
||||
std::optional<ProductDiscount> introductoryPrice;
|
||||
std::vector<ProductDiscount> discounts;
|
||||
std::string subscriptionGroupIdentifier;
|
||||
absl::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
||||
std::optional<ProductSubscriptionPeriod> subscriptionPeriod;
|
||||
|
||||
// Downloadable Content Information
|
||||
bool isDownloadable = false;
|
||||
|
|
|
@ -488,7 +488,7 @@ bool NativeWindow::AddTabbedWindow(NativeWindow* window) {
|
|||
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
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ void NativeWindow::PreviewFile(const std::string& path,
|
|||
|
||||
void NativeWindow::CloseFilePreview() {}
|
||||
|
||||
absl::optional<gfx::Rect> NativeWindow::GetWindowControlsOverlayRect() {
|
||||
std::optional<gfx::Rect> NativeWindow::GetWindowControlsOverlayRect() {
|
||||
return overlay_rect_;
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -22,7 +23,6 @@
|
|||
#include "shell/browser/draggable_region_provider.h"
|
||||
#include "shell/browser/native_window_observer.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"
|
||||
|
||||
class SkRegion;
|
||||
|
@ -229,8 +229,8 @@ class NativeWindow : public base::SupportsUserData,
|
|||
#if BUILDFLAG(IS_MAC)
|
||||
virtual void SetWindowButtonVisibility(bool visible) = 0;
|
||||
virtual bool GetWindowButtonVisibility() const = 0;
|
||||
virtual void SetWindowButtonPosition(absl::optional<gfx::Point> position) = 0;
|
||||
virtual absl::optional<gfx::Point> GetWindowButtonPosition() const = 0;
|
||||
virtual void SetWindowButtonPosition(std::optional<gfx::Point> position) = 0;
|
||||
virtual std::optional<gfx::Point> GetWindowButtonPosition() const = 0;
|
||||
virtual void RedrawTrafficLights() = 0;
|
||||
virtual void UpdateFrame() = 0;
|
||||
#endif
|
||||
|
@ -254,7 +254,7 @@ class NativeWindow : public base::SupportsUserData,
|
|||
virtual void MoveTabToNewWindow();
|
||||
virtual void ToggleTabBar();
|
||||
virtual bool AddTabbedWindow(NativeWindow* window);
|
||||
virtual absl::optional<std::string> GetTabbingIdentifier() const;
|
||||
virtual std::optional<std::string> GetTabbingIdentifier() const;
|
||||
|
||||
// Toggle the menu bar.
|
||||
virtual void SetAutoHideMenuBar(bool auto_hide);
|
||||
|
@ -284,7 +284,7 @@ class NativeWindow : public base::SupportsUserData,
|
|||
return weak_factory_.GetWeakPtr();
|
||||
}
|
||||
|
||||
virtual absl::optional<gfx::Rect> GetWindowControlsOverlayRect();
|
||||
virtual std::optional<gfx::Rect> GetWindowControlsOverlayRect();
|
||||
virtual void SetWindowControlsOverlayRect(const gfx::Rect& overlay_rect);
|
||||
|
||||
// Methods called by the WebContents.
|
||||
|
@ -433,11 +433,11 @@ class NativeWindow : public base::SupportsUserData,
|
|||
TitleBarStyle title_bar_style_ = TitleBarStyle::kNormal;
|
||||
|
||||
// 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
|
||||
// constraints beacause converting between them will cause rounding errors
|
||||
// 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_;
|
||||
FullScreenTransitionState fullscreen_transition_state_ =
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -127,8 +128,8 @@ class NativeWindowMac : public NativeWindow,
|
|||
void SetVibrancy(const std::string& type) override;
|
||||
void SetWindowButtonVisibility(bool visible) override;
|
||||
bool GetWindowButtonVisibility() const override;
|
||||
void SetWindowButtonPosition(absl::optional<gfx::Point> position) override;
|
||||
absl::optional<gfx::Point> GetWindowButtonPosition() const override;
|
||||
void SetWindowButtonPosition(std::optional<gfx::Point> position) override;
|
||||
std::optional<gfx::Point> GetWindowButtonPosition() const override;
|
||||
void RedrawTrafficLights() override;
|
||||
void UpdateFrame() override;
|
||||
void SetTouchBar(
|
||||
|
@ -142,7 +143,7 @@ class NativeWindowMac : public NativeWindow,
|
|||
void MoveTabToNewWindow() override;
|
||||
void ToggleTabBar() 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,
|
||||
const gfx::Size& extra_size) override;
|
||||
void PreviewFile(const std::string& path,
|
||||
|
@ -150,7 +151,7 @@ class NativeWindowMac : public NativeWindow,
|
|||
void CloseFilePreview() override;
|
||||
gfx::Rect ContentBoundsToWindowBounds(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 NotifyWindowLeaveFullScreen() override;
|
||||
void SetActive(bool is_key) override;
|
||||
|
@ -249,7 +250,7 @@ class NativeWindowMac : public NativeWindow,
|
|||
bool fullscreen_before_kiosk_ = false;
|
||||
bool is_kiosk_ = 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
|
||||
// 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
|
||||
// setWindowButtonVisibility().
|
||||
absl::optional<bool> window_button_visibility_;
|
||||
std::optional<bool> window_button_visibility_;
|
||||
|
||||
// Controls the position and visibility of window buttons.
|
||||
WindowButtonsProxy* __strong buttons_proxy_;
|
||||
|
|
|
@ -1545,7 +1545,7 @@ bool NativeWindowMac::GetWindowButtonVisibility() const {
|
|||
}
|
||||
|
||||
void NativeWindowMac::SetWindowButtonPosition(
|
||||
absl::optional<gfx::Point> position) {
|
||||
std::optional<gfx::Point> position) {
|
||||
traffic_light_position_ = std::move(position);
|
||||
if (buttons_proxy_) {
|
||||
[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_;
|
||||
}
|
||||
|
||||
|
@ -1623,9 +1623,9 @@ bool NativeWindowMac::AddTabbedWindow(NativeWindow* window) {
|
|||
return true;
|
||||
}
|
||||
|
||||
absl::optional<std::string> NativeWindowMac::GetTabbingIdentifier() const {
|
||||
std::optional<std::string> NativeWindowMac::GetTabbingIdentifier() const {
|
||||
if ([window_ tabbingMode] == NSWindowTabbingModeDisallowed)
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
return base::SysNSStringToUTF8([window_ tabbingIdentifier]);
|
||||
}
|
||||
|
@ -1870,9 +1870,9 @@ void NativeWindowMac::SetForwardMouseMessages(bool forward) {
|
|||
[window_ setAcceptsMouseMovedEvents:forward];
|
||||
}
|
||||
|
||||
absl::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
||||
std::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
||||
if (!titlebar_overlay_)
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
|
||||
// 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
|
||||
|
@ -1896,7 +1896,7 @@ absl::optional<gfx::Rect> NativeWindowMac::GetWindowControlsOverlayRect() {
|
|||
return overlay;
|
||||
}
|
||||
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
// static
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "shell/browser/native_window.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
|
||||
|
@ -304,7 +305,7 @@ class NativeWindowViews : public NativeWindow,
|
|||
// Whether the window is currently being moved.
|
||||
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
|
||||
// Controls Overlay if enabled on Windows.
|
||||
|
|
|
@ -7,12 +7,12 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "crypto/secure_hash.h"
|
||||
#include "mojo/public/cpp/system/file_data_source.h"
|
||||
#include "mojo/public/cpp/system/filtered_data_source.h"
|
||||
#include "shell/common/asar/archive.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace asar {
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
|
|||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_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,
|
||||
int32_t intra_priority_value) override {}
|
||||
void PauseReadingBodyFromNet() override {}
|
||||
|
@ -270,7 +270,7 @@ class AsarURLLoader : public network::mojom::URLLoader {
|
|||
head->mime_type.c_str());
|
||||
}
|
||||
client_->OnReceiveResponse(std::move(head), std::move(consumer_handle),
|
||||
absl::nullopt);
|
||||
std::nullopt);
|
||||
|
||||
if (total_bytes_to_send == 0) {
|
||||
// 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 std::string& hostname,
|
||||
int flags,
|
||||
const absl::optional<std::string>& ocsp_response,
|
||||
const std::optional<std::string>& ocsp_response,
|
||||
VerifyCallback callback) {
|
||||
VerifyRequestParams params;
|
||||
params.hostname = hostname;
|
||||
|
|
|
@ -40,7 +40,7 @@ class CertVerifierClient : public network::mojom::CertVerifierClient {
|
|||
const scoped_refptr<net::X509Certificate>& certificate,
|
||||
const std::string& hostname,
|
||||
int flags,
|
||||
const absl::optional<std::string>& ocsp_response,
|
||||
const std::optional<std::string>& ocsp_response,
|
||||
VerifyCallback callback) override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -211,7 +211,7 @@ void ElectronURLLoaderFactory::RedirectedRequest::FollowRedirect(
|
|||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_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
|
||||
// The following references code in WorkerScriptLoader::FollowRedirect
|
||||
bool should_clear_upload = false;
|
||||
|
@ -592,7 +592,7 @@ void ElectronURLLoaderFactory::StartLoadingStream(
|
|||
// Note that We must submit a empty body otherwise NetworkService would
|
||||
// crash.
|
||||
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
|
||||
absl::nullopt);
|
||||
std::nullopt);
|
||||
producer.reset(); // The data pipe is empty.
|
||||
client_remote->OnComplete(network::URLLoaderCompletionStatus(net::OK));
|
||||
return;
|
||||
|
@ -640,7 +640,7 @@ void ElectronURLLoaderFactory::SendContents(
|
|||
}
|
||||
|
||||
client_remote->OnReceiveResponse(std::move(head), std::move(consumer),
|
||||
absl::nullopt);
|
||||
std::nullopt);
|
||||
|
||||
auto write_data = std::make_unique<WriteData>();
|
||||
write_data->client = std::move(client_remote);
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_NET_ELECTRON_URL_LOADER_FACTORY_H_
|
||||
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -21,7 +22,6 @@
|
|||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||
#include "services/network/public/mojom/url_response_head.mojom.h"
|
||||
#include "shell/common/gin_helper/dictionary.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -73,7 +73,7 @@ class ElectronURLLoaderFactory : public network::SelfDeletingURLLoaderFactory {
|
|||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_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,
|
||||
int32_t intra_priority_value) override {}
|
||||
void PauseReadingBodyFromNet() override {}
|
||||
|
|
|
@ -59,7 +59,7 @@ void NodeStreamLoader::Start(network::mojom::URLResponseHeadPtr head) {
|
|||
|
||||
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
|
||||
client_->OnReceiveResponse(std::move(head), std::move(consumer),
|
||||
absl::nullopt);
|
||||
std::nullopt);
|
||||
|
||||
auto weak = weak_factory_.GetWeakPtr();
|
||||
On("end",
|
||||
|
|
|
@ -60,7 +60,7 @@ class NodeStreamLoader : public network::mojom::URLLoader {
|
|||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_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,
|
||||
int32_t intra_priority_value) override {}
|
||||
void PauseReadingBodyFromNet() override {}
|
||||
|
|
|
@ -93,11 +93,11 @@ ProxyingURLLoaderFactory::InProgressRequest::~InProgressRequest() {
|
|||
}
|
||||
if (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_) {
|
||||
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 net::HttpRequestHeaders& modified_headers,
|
||||
const net::HttpRequestHeaders& modified_cors_exempt_headers,
|
||||
const absl::optional<GURL>& new_url) {
|
||||
const std::optional<GURL>& new_url) {
|
||||
if (new_url)
|
||||
request_.url = new_url.value();
|
||||
|
||||
|
@ -241,7 +241,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveEarlyHints(
|
|||
void ProxyingURLLoaderFactory::InProgressRequest::OnReceiveResponse(
|
||||
network::mojom::URLResponseHeadPtr head,
|
||||
mojo::ScopedDataPipeConsumerHandle body,
|
||||
absl::optional<mojo_base::BigBuffer> cached_metadata) {
|
||||
std::optional<mojo_base::BigBuffer> cached_metadata) {
|
||||
current_body_ = std::move(body);
|
||||
current_cached_metadata_ = std::move(cached_metadata);
|
||||
if (current_request_uses_header_client_) {
|
||||
|
@ -342,7 +342,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnBeforeSendHeaders(
|
|||
const net::HttpRequestHeaders& headers,
|
||||
OnBeforeSendHeadersCallback callback) {
|
||||
if (!current_request_uses_header_client_) {
|
||||
std::move(callback).Run(net::OK, absl::nullopt);
|
||||
std::move(callback).Run(net::OK, std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::OnHeadersReceived(
|
|||
const net::IPEndPoint& remote_endpoint,
|
||||
OnHeadersReceivedCallback callback) {
|
||||
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_) {
|
||||
// CORS preflight is supported only when "extraHeaders" is specified.
|
||||
|
@ -581,7 +581,7 @@ void ProxyingURLLoaderFactory::InProgressRequest::
|
|||
}
|
||||
|
||||
DCHECK(on_headers_received_callback_);
|
||||
absl::optional<std::string> headers;
|
||||
std::optional<std::string> headers;
|
||||
if (override_headers_) {
|
||||
headers = override_headers_->raw_headers();
|
||||
if (current_request_uses_header_client_) {
|
||||
|
@ -749,7 +749,7 @@ ProxyingURLLoaderFactory::ProxyingURLLoaderFactory(
|
|||
int frame_routing_id,
|
||||
uint64_t* request_id_generator,
|
||||
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::PendingRemote<network::mojom::URLLoaderFactory> target_factory_remote,
|
||||
mojo::PendingReceiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <cstdint>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -33,7 +34,6 @@
|
|||
#include "services/network/url_loader_factory.h"
|
||||
#include "shell/browser/net/electron_url_loader_factory.h"
|
||||
#include "shell/browser/net/web_request_api_interface.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -83,7 +83,7 @@ class ProxyingURLLoaderFactory
|
|||
const std::vector<std::string>& removed_headers,
|
||||
const net::HttpRequestHeaders& modified_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,
|
||||
int32_t intra_priority_value) override;
|
||||
void PauseReadingBodyFromNet() override;
|
||||
|
@ -95,7 +95,7 @@ class ProxyingURLLoaderFactory
|
|||
void OnReceiveResponse(
|
||||
network::mojom::URLResponseHeadPtr head,
|
||||
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,
|
||||
network::mojom::URLResponseHeadPtr head) override;
|
||||
void OnUploadProgress(int64_t current_position,
|
||||
|
@ -135,7 +135,7 @@ class ProxyingURLLoaderFactory
|
|||
|
||||
raw_ptr<ProxyingURLLoaderFactory> const factory_;
|
||||
network::ResourceRequest request_;
|
||||
const absl::optional<url::Origin> original_initiator_;
|
||||
const std::optional<url::Origin> original_initiator_;
|
||||
const uint64_t request_id_ = 0;
|
||||
const int32_t network_service_request_id_ = 0;
|
||||
const int32_t frame_routing_id_ = MSG_ROUTING_NONE;
|
||||
|
@ -144,7 +144,7 @@ class ProxyingURLLoaderFactory
|
|||
mojo::Receiver<network::mojom::URLLoader> proxied_loader_receiver_;
|
||||
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_{
|
||||
this};
|
||||
|
@ -180,7 +180,7 @@ class ProxyingURLLoaderFactory
|
|||
std::vector<std::string> removed_headers;
|
||||
net::HttpRequestHeaders modified_headers;
|
||||
net::HttpRequestHeaders modified_cors_exempt_headers;
|
||||
absl::optional<GURL> new_url;
|
||||
std::optional<GURL> new_url;
|
||||
|
||||
// disable copy
|
||||
FollowRedirectParams(const FollowRedirectParams&) = delete;
|
||||
|
@ -188,7 +188,7 @@ class ProxyingURLLoaderFactory
|
|||
};
|
||||
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};
|
||||
};
|
||||
|
@ -200,7 +200,7 @@ class ProxyingURLLoaderFactory
|
|||
int frame_routing_id,
|
||||
uint64_t* request_id_generator,
|
||||
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::PendingRemote<network::mojom::URLLoaderFactory>
|
||||
target_factory_remote,
|
||||
|
@ -264,7 +264,7 @@ class ProxyingURLLoaderFactory
|
|||
const int frame_routing_id_;
|
||||
raw_ptr<uint64_t> request_id_generator_; // managed by ElectronBrowserClient
|
||||
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::Remote<network::mojom::URLLoaderFactory> target_factory_;
|
||||
mojo::Receiver<network::mojom::TrustedURLLoaderHeaderClient>
|
||||
|
|
|
@ -44,16 +44,16 @@ ProxyingWebSocket::ProxyingWebSocket(
|
|||
/*is_download=*/false,
|
||||
/*is_async=*/true,
|
||||
/*is_service_worker_script=*/false,
|
||||
/*navigation_id=*/absl::nullopt)) {}
|
||||
/*navigation_id=*/std::nullopt)) {}
|
||||
|
||||
ProxyingWebSocket::~ProxyingWebSocket() {
|
||||
if (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_) {
|
||||
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,
|
||||
const GURL& url,
|
||||
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>
|
||||
handshake_client,
|
||||
bool has_extra_headers,
|
||||
|
@ -358,11 +358,11 @@ void ProxyingWebSocket::OnHeadersReceivedComplete(int error_code) {
|
|||
}
|
||||
|
||||
if (on_headers_received_callback_) {
|
||||
absl::optional<std::string> headers;
|
||||
std::optional<std::string> headers;
|
||||
if (override_headers_)
|
||||
headers = override_headers_->raw_headers();
|
||||
std::move(on_headers_received_callback_)
|
||||
.Run(net::OK, headers, absl::nullopt);
|
||||
.Run(net::OK, headers, std::nullopt);
|
||||
}
|
||||
|
||||
if (override_headers_) {
|
||||
|
@ -384,7 +384,7 @@ void ProxyingWebSocket::OnAuthRequiredComplete(AuthRequiredResponse rv) {
|
|||
switch (rv) {
|
||||
case AuthRequiredResponse::kNoAction:
|
||||
case AuthRequiredResponse::kCancelAuth:
|
||||
std::move(auth_required_callback_).Run(absl::nullopt);
|
||||
std::move(auth_required_callback_).Run(std::nullopt);
|
||||
break;
|
||||
|
||||
case AuthRequiredResponse::kSetAuth:
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_NET_PROXYING_WEBSOCKET_H_
|
||||
#define ELECTRON_SHELL_BROWSER_NET_PROXYING_WEBSOCKET_H_
|
||||
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
@ -19,7 +20,6 @@
|
|||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "services/network/public/mojom/websocket.mojom.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/origin.h"
|
||||
|
||||
|
@ -101,7 +101,7 @@ class ProxyingWebSocket : public network::mojom::WebSocketHandshakeClient,
|
|||
WebSocketFactory factory,
|
||||
const GURL& url,
|
||||
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>
|
||||
handshake_client,
|
||||
bool has_extra_headers,
|
||||
|
|
|
@ -53,8 +53,8 @@ void ResolveHostFunction::Run() {
|
|||
receiver_.set_disconnect_handler(base::BindOnce(
|
||||
&ResolveHostFunction::OnComplete, this, net::ERR_NAME_NOT_RESOLVED,
|
||||
net::ResolveErrorInfo(net::ERR_FAILED),
|
||||
/*resolved_addresses=*/absl::nullopt,
|
||||
/*endpoint_results_with_metadata=*/absl::nullopt));
|
||||
/*resolved_addresses=*/std::nullopt,
|
||||
/*endpoint_results_with_metadata=*/std::nullopt));
|
||||
if (electron::IsUtilityProcess()) {
|
||||
URLLoaderBundle::GetInstance()->GetHostResolver()->ResolveHost(
|
||||
network::mojom::HostResolverHost::NewHostPortPair(
|
||||
|
@ -75,8 +75,8 @@ void ResolveHostFunction::Run() {
|
|||
void ResolveHostFunction::OnComplete(
|
||||
int result,
|
||||
const net::ResolveErrorInfo& resolve_error_info,
|
||||
const absl::optional<net::AddressList>& resolved_addresses,
|
||||
const absl::optional<net::HostResolverEndpointResults>&
|
||||
const std::optional<net::AddressList>& resolved_addresses,
|
||||
const std::optional<net::HostResolverEndpointResults>&
|
||||
endpoint_results_with_metadata) {
|
||||
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_NET_RESOLVE_HOST_FUNCTION_H_
|
||||
#define ELECTRON_SHELL_BROWSER_NET_RESOLVE_HOST_FUNCTION_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
|
@ -16,7 +17,6 @@
|
|||
#include "services/network/public/cpp/resolve_host_client_base.h"
|
||||
#include "services/network/public/mojom/host_resolver.mojom.h"
|
||||
#include "services/network/public/mojom/network_context.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace electron {
|
||||
|
||||
|
@ -26,9 +26,8 @@ class ResolveHostFunction
|
|||
: public base::RefCountedThreadSafe<ResolveHostFunction>,
|
||||
network::ResolveHostClientBase {
|
||||
public:
|
||||
using ResolveHostCallback = base::OnceCallback<void(
|
||||
int64_t,
|
||||
const absl::optional<net::AddressList>& resolved_addresses)>;
|
||||
using ResolveHostCallback = base::OnceCallback<
|
||||
void(int64_t, const std::optional<net::AddressList>& resolved_addresses)>;
|
||||
|
||||
explicit ResolveHostFunction(ElectronBrowserContext* browser_context,
|
||||
std::string host,
|
||||
|
@ -50,8 +49,8 @@ class ResolveHostFunction
|
|||
// network::mojom::ResolveHostClient implementation
|
||||
void OnComplete(int result,
|
||||
const net::ResolveErrorInfo& resolve_error_info,
|
||||
const absl::optional<net::AddressList>& resolved_addresses,
|
||||
const absl::optional<net::HostResolverEndpointResults>&
|
||||
const std::optional<net::AddressList>& resolved_addresses,
|
||||
const std::optional<net::HostResolverEndpointResults>&
|
||||
endpoint_results_with_metadata) override;
|
||||
|
||||
SEQUENCE_CHECKER(sequence_checker_);
|
||||
|
|
|
@ -53,7 +53,7 @@ void ResolveProxyHelper::StartPendingRequest() {
|
|||
receiver_.BindNewPipeAndPassRemote();
|
||||
receiver_.set_disconnect_handler(
|
||||
base::BindOnce(&ResolveProxyHelper::OnProxyLookupComplete,
|
||||
base::Unretained(this), net::ERR_ABORTED, absl::nullopt));
|
||||
base::Unretained(this), net::ERR_ABORTED, std::nullopt));
|
||||
browser_context_->GetDefaultStoragePartition()
|
||||
->GetNetworkContext()
|
||||
->LookUpProxyForURL(pending_requests_.front().url,
|
||||
|
@ -63,7 +63,7 @@ void ResolveProxyHelper::StartPendingRequest() {
|
|||
|
||||
void ResolveProxyHelper::OnProxyLookupComplete(
|
||||
int32_t net_error,
|
||||
const absl::optional<net::ProxyInfo>& proxy_info) {
|
||||
const std::optional<net::ProxyInfo>& proxy_info) {
|
||||
DCHECK_CURRENTLY_ON(BrowserThread::UI);
|
||||
DCHECK(!pending_requests_.empty());
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@
|
|||
#define ELECTRON_SHELL_BROWSER_NET_RESOLVE_PROXY_HELPER_H_
|
||||
|
||||
#include <deque>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "base/memory/ref_counted.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "services/network/public/mojom/proxy_lookup_client.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -61,7 +61,7 @@ class ResolveProxyHelper
|
|||
// network::mojom::ProxyLookupClient implementation.
|
||||
void OnProxyLookupComplete(
|
||||
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.
|
||||
scoped_refptr<ResolveProxyHelper> owned_self_;
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#ifndef 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 "chrome/browser/net/proxy_config_monitor.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/url_loader.mojom.h"
|
||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace electron {
|
||||
network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams();
|
||||
|
|
|
@ -72,7 +72,7 @@ void URLPipeLoader::OnResponseStarted(
|
|||
producer_ = std::make_unique<mojo::DataPipeProducer>(std::move(producer));
|
||||
|
||||
client_->OnReceiveResponse(response_head.Clone(), std::move(consumer),
|
||||
absl::nullopt);
|
||||
std::nullopt);
|
||||
}
|
||||
|
||||
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 net::HttpRequestHeaders& modified_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,
|
||||
int32_t intra_priority_value) override {}
|
||||
void PauseReadingBodyFromNet() override {}
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
|
@ -31,7 +32,6 @@
|
|||
#include "content/public/browser/render_process_host.h"
|
||||
#include "gpu/command_buffer/client/gl_helper.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/skia/include/core/SkCanvas.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_;
|
||||
}
|
||||
|
||||
|
@ -508,9 +508,9 @@ gfx::Rect OffScreenRenderWidgetHostView::GetBoundsInRootWindow() {
|
|||
return gfx::Rect(size_);
|
||||
}
|
||||
|
||||
absl::optional<content::DisplayFeature>
|
||||
std::optional<content::DisplayFeature>
|
||||
OffScreenRenderWidgetHostView::GetDisplayFeature() {
|
||||
return absl::nullopt;
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::SetDisplayFeatureForTesting(
|
||||
|
@ -530,8 +530,8 @@ OffScreenRenderWidgetHostView::CreateSyntheticGestureTarget() {
|
|||
|
||||
void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
|
||||
const gfx::Range&,
|
||||
const absl::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||
const absl::optional<std::vector<gfx::Rect>>& line_bounds) {}
|
||||
const std::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||
const std::optional<std::vector<gfx::Rect>>& line_bounds) {}
|
||||
|
||||
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
|
||||
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
|
||||
|
|
|
@ -95,7 +95,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
gfx::Size GetVisibleViewportSize() override;
|
||||
void SetInsets(const gfx::Insets&) override;
|
||||
void SetBackgroundColor(SkColor color) override;
|
||||
absl::optional<SkColor> GetBackgroundColor() override;
|
||||
std::optional<SkColor> GetBackgroundColor() override;
|
||||
void UpdateBackgroundColor() override;
|
||||
blink::mojom::PointerLockResult LockMouse(
|
||||
bool request_unadjusted_movement) override;
|
||||
|
@ -141,7 +141,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
display::ScreenInfo GetScreenInfo() const override;
|
||||
void TransformPointToRootSurface(gfx::PointF* point) override;
|
||||
gfx::Rect GetBoundsInRootWindow(void) override;
|
||||
absl::optional<content::DisplayFeature> GetDisplayFeature() override;
|
||||
std::optional<content::DisplayFeature> GetDisplayFeature() override;
|
||||
void SetDisplayFeatureForTesting(
|
||||
const content::DisplayFeature* display_feature) override;
|
||||
void NotifyHostAndDelegateOnWasShown(
|
||||
|
@ -154,8 +154,8 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
CreateSyntheticGestureTarget() override;
|
||||
void ImeCompositionRangeChanged(
|
||||
const gfx::Range&,
|
||||
const absl::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||
const absl::optional<std::vector<gfx::Rect>>& line_bounds) override;
|
||||
const std::optional<std::vector<gfx::Rect>>& character_bounds,
|
||||
const std::optional<std::vector<gfx::Rect>>& line_bounds) override;
|
||||
gfx::Size GetCompositorViewportPixelSize() override;
|
||||
ui::Compositor* GetCompositor() override;
|
||||
|
||||
|
|
|
@ -128,7 +128,7 @@ void OffScreenVideoConsumer::OnFrameCaptured(
|
|||
new FramePinner{std::move(mapping), callbacks_remote.Unbind()});
|
||||
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()) {
|
||||
update_rect = content_rect;
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ bool StringToAccelerator(const std::string& shortcut,
|
|||
// Now, parse it into an accelerator.
|
||||
int modifiers = ui::EF_NONE;
|
||||
ui::KeyboardCode key = ui::VKEY_UNKNOWN;
|
||||
absl::optional<char16_t> shifted_char;
|
||||
std::optional<char16_t> shifted_char;
|
||||
for (const auto& token : tokens) {
|
||||
ui::KeyboardCode code = electron::KeyboardCodeFromStr(token, &shifted_char);
|
||||
if (shifted_char)
|
||||
|
|
|
@ -7,9 +7,10 @@
|
|||
|
||||
#include <Quartz/Quartz.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
#include "base/memory/raw_ptr.h"
|
||||
#include "components/remote_cocoa/app_shim/views_nswindow_delegate.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
|
||||
namespace electron {
|
||||
class NativeWindowMac;
|
||||
|
@ -30,7 +31,7 @@ class NativeWindowMac;
|
|||
// Only valid during a live resize.
|
||||
// Used to keep track of whether a resize is happening horizontally or
|
||||
// vertically, even if physically the user is resizing in both directions.
|
||||
absl::optional<bool> resizingHorizontally_;
|
||||
std::optional<bool> resizingHorizontally_;
|
||||
}
|
||||
- (id)initWithShell:(electron::NativeWindowMac*)shell;
|
||||
@end
|
||||
|
|
|
@ -7,7 +7,8 @@
|
|||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include <optional>
|
||||
|
||||
#include "ui/gfx/geometry/point.h"
|
||||
|
||||
@class WindowButtonsProxy;
|
||||
|
@ -48,7 +49,7 @@
|
|||
- (void)setShowOnHover:(BOOL)yes;
|
||||
|
||||
// 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
|
||||
- (void)setHeight:(const float)height;
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
[self updateButtonsVisibility];
|
||||
}
|
||||
|
||||
- (void)setMargin:(const absl::optional<gfx::Point>&)margin {
|
||||
- (void)setMargin:(const std::optional<gfx::Point>&)margin {
|
||||
if (margin)
|
||||
margin_ = *margin;
|
||||
else
|
||||
|
|
|
@ -100,7 +100,7 @@ void ElectronMenuModel::SetSharingItem(SharingItem item) {
|
|||
sharing_item_.emplace(std::move(item));
|
||||
}
|
||||
|
||||
const absl::optional<ElectronMenuModel::SharingItem>&
|
||||
const std::optional<ElectronMenuModel::SharingItem>&
|
||||
ElectronMenuModel::GetSharingItem() const {
|
||||
return sharing_item_;
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
|
||||
#define ELECTRON_SHELL_BROWSER_UI_ELECTRON_MENU_MODEL_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "base/memory/weak_ptr.h"
|
||||
#include "base/observer_list.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 "url/gurl.h"
|
||||
|
||||
|
@ -29,9 +29,9 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
|||
SharingItem(const SharingItem&) = delete;
|
||||
~SharingItem();
|
||||
|
||||
absl::optional<std::vector<std::string>> texts;
|
||||
absl::optional<std::vector<GURL>> urls;
|
||||
absl::optional<std::vector<base::FilePath>> file_paths;
|
||||
std::optional<std::vector<std::string>> texts;
|
||||
std::optional<std::vector<GURL>> urls;
|
||||
std::optional<std::vector<base::FilePath>> file_paths;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
@ -98,7 +98,7 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
|||
bool GetSharingItemAt(size_t index, SharingItem* item) const;
|
||||
// Set/Get the SharingItem of this menu.
|
||||
void SetSharingItem(SharingItem item);
|
||||
const absl::optional<SharingItem>& GetSharingItem() const;
|
||||
const std::optional<SharingItem>& GetSharingItem() const;
|
||||
#endif
|
||||
|
||||
// ui::SimpleMenuModel:
|
||||
|
@ -116,7 +116,7 @@ class ElectronMenuModel : public ui::SimpleMenuModel {
|
|||
raw_ptr<Delegate> delegate_; // weak ref.
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
absl::optional<SharingItem> sharing_item_;
|
||||
std::optional<SharingItem> sharing_item_;
|
||||
#endif
|
||||
|
||||
base::flat_map<int, std::u16string> toolTips_; // command id -> tooltip
|
||||
|
|
|
@ -5,12 +5,12 @@
|
|||
#ifndef ELECTRON_SHELL_BROWSER_UI_MESSAGE_BOX_H_
|
||||
#define ELECTRON_SHELL_BROWSER_UI_MESSAGE_BOX_H_
|
||||
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/functional/callback_forward.h"
|
||||
#include "base/memory/raw_ptr_exclusion.h"
|
||||
#include "third_party/abseil-cpp/absl/types/optional.h"
|
||||
#include "ui/gfx/image/image_skia.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -29,7 +29,7 @@ struct MessageBoxSettings {
|
|||
RAW_PTR_EXCLUSION electron::NativeWindow* parent_window = nullptr;
|
||||
MessageBoxType type = electron::MessageBoxType::kNone;
|
||||
std::vector<std::string> buttons;
|
||||
absl::optional<int> id;
|
||||
std::optional<int> id;
|
||||
int default_id;
|
||||
int cancel_id;
|
||||
bool no_link = false;
|
||||
|
|
|
@ -192,7 +192,7 @@ class GtkMessageBox : public NativeWindowObserver {
|
|||
|
||||
private:
|
||||
// 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.
|
||||
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
|
||||
// only store the pointer, by duplication we can force gcd to store a copy.
|
||||
__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;
|
||||
|
||||
auto handler = ^(NSModalResponse response) {
|
||||
|
|
|
@ -304,7 +304,7 @@ void ShowMessageBox(const MessageBoxSettings& settings,
|
|||
dialog_thread::Run(base::BindOnce(&ShowTaskDialogUTF8, settings,
|
||||
parent_widget, base::Unretained(hwnd)),
|
||||
base::BindOnce(
|
||||
[](MessageBoxCallback callback, absl::optional<int> id,
|
||||
[](MessageBoxCallback callback, std::optional<int> id,
|
||||
DialogResult result) {
|
||||
if (id)
|
||||
GetDialogsMap().erase(*id);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace electron {
|
|||
|
||||
class TrayIcon {
|
||||
public:
|
||||
static TrayIcon* Create(absl::optional<UUID> guid);
|
||||
static TrayIcon* Create(std::optional<UUID> guid);
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
using ImageType = HICON;
|
||||
|
|
|
@ -422,7 +422,7 @@ gfx::Rect TrayIconCocoa::GetBounds() {
|
|||
}
|
||||
|
||||
// static
|
||||
TrayIcon* TrayIcon::Create(absl::optional<UUID> guid) {
|
||||
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
|
||||
return new TrayIconCocoa;
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ ui::StatusIconLinux* TrayIconLinux::GetStatusIcon() {
|
|||
}
|
||||
|
||||
// static
|
||||
TrayIcon* TrayIcon::Create(absl::optional<UUID> guid) {
|
||||
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
|
||||
return new TrayIconLinux;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
namespace electron {
|
||||
|
||||
// static
|
||||
TrayIcon* TrayIcon::Create(absl::optional<UUID> guid) {
|
||||
TrayIcon* TrayIcon::Create(std::optional<UUID> guid) {
|
||||
static NotifyIconHost host;
|
||||
return host.CreateNotifyIcon(guid);
|
||||
}
|
||||
|
|
|
@ -147,8 +147,8 @@ bool AutofillPopupView::CanStartDragForView(views::View*,
|
|||
}
|
||||
|
||||
void AutofillPopupView::OnSelectedRowChanged(
|
||||
absl::optional<int> previous_row_selection,
|
||||
absl::optional<int> current_row_selection) {
|
||||
std::optional<int> previous_row_selection,
|
||||
std::optional<int> current_row_selection) {
|
||||
SchedulePaint();
|
||||
|
||||
if (current_row_selection) {
|
||||
|
@ -436,7 +436,7 @@ void AutofillPopupView::AcceptSelection(const gfx::Point& point) {
|
|||
AcceptSelectedLine();
|
||||
}
|
||||
|
||||
void AutofillPopupView::SetSelectedLine(absl::optional<int> selected_line) {
|
||||
void AutofillPopupView::SetSelectedLine(std::optional<int> selected_line) {
|
||||
if (!popup_)
|
||||
return;
|
||||
if (selected_line_ == selected_line)
|
||||
|
@ -479,7 +479,7 @@ void AutofillPopupView::SelectPreviousLine() {
|
|||
}
|
||||
|
||||
void AutofillPopupView::ClearSelection() {
|
||||
SetSelectedLine(absl::nullopt);
|
||||
SetSelectedLine(std::nullopt);
|
||||
}
|
||||
|
||||
void AutofillPopupView::RemoveObserver() {
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
#define ELECTRON_SHELL_BROWSER_UI_VIEWS_AUTOFILL_POPUP_VIEW_H_
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
|
||||
#include "shell/browser/ui/autofill_popup.h"
|
||||
|
||||
|
@ -14,7 +15,6 @@
|
|||
#include "content/public/common/input/native_web_keyboard_event.h"
|
||||
#include "electron/buildflags/buildflags.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/base/metadata/metadata_header_macros.h"
|
||||
#include "ui/base/metadata/metadata_impl_macros.h"
|
||||
|
@ -84,8 +84,8 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
|||
private:
|
||||
friend class AutofillPopup;
|
||||
|
||||
void OnSelectedRowChanged(absl::optional<int> previous_row_selection,
|
||||
absl::optional<int> current_row_selection);
|
||||
void OnSelectedRowChanged(std::optional<int> previous_row_selection,
|
||||
std::optional<int> current_row_selection);
|
||||
|
||||
// Draw the given autofill entry in |entry_rect|.
|
||||
void DrawAutofillEntry(gfx::Canvas* canvas,
|
||||
|
@ -122,7 +122,7 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
|||
void AcceptSuggestion(int index);
|
||||
bool AcceptSelectedLine();
|
||||
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 SelectNextLine();
|
||||
void SelectPreviousLine();
|
||||
|
@ -141,7 +141,7 @@ class AutofillPopupView : public views::WidgetDelegateView,
|
|||
base::Time show_time_;
|
||||
|
||||
// The index of the currently selected line
|
||||
absl::optional<int> selected_line_;
|
||||
std::optional<int> selected_line_;
|
||||
|
||||
std::unique_ptr<OffscreenViewProxy> view_proxy_;
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ const gfx::FontList* MenuDelegate::GetLabelFontList(int id) const {
|
|||
return adapter_->GetLabelFontList(id);
|
||||
}
|
||||
|
||||
absl::optional<SkColor> MenuDelegate::GetLabelColor(int id) const {
|
||||
std::optional<SkColor> MenuDelegate::GetLabelColor(int id) const {
|
||||
return adapter_->GetLabelColor(id);
|
||||
}
|
||||
|
||||
|
|
|
@ -53,7 +53,7 @@ class MenuDelegate : public views::MenuDelegate {
|
|||
bool GetAccelerator(int id, ui::Accelerator* accelerator) const override;
|
||||
std::u16string GetLabel(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 IsCommandVisible(int id) const override;
|
||||
bool IsItemChecked(int id) const override;
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "shell/browser/ui/webui/accessibility_ui.h"
|
||||
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
@ -42,7 +43,6 @@
|
|||
#include "content/public/browser/web_ui_data_source.h"
|
||||
#include "shell/browser/native_window.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_delegate.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 <optional>
|
||||
|
||||
#include "base/win/windows_version.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "shell/browser/ui/views/win_frame_view.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/shell.h"
|
||||
|
||||
|
|
|
@ -7,8 +7,9 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
#include <optional>
|
||||
|
||||
#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"
|
||||
|
||||
namespace electron {
|
||||
|
@ -44,7 +45,7 @@ class ElectronDesktopWindowTreeHostWin : public views::DesktopWindowTreeHostWin,
|
|||
|
||||
private:
|
||||
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
|
||||
|
|
|
@ -191,7 +191,7 @@ NotifyIconHost::~NotifyIconHost() {
|
|||
delete ptr;
|
||||
}
|
||||
|
||||
NotifyIcon* NotifyIconHost::CreateNotifyIcon(absl::optional<UUID> guid) {
|
||||
NotifyIcon* NotifyIconHost::CreateNotifyIcon(std::optional<UUID> guid) {
|
||||
if (guid.has_value()) {
|
||||
for (NotifyIcons::const_iterator i(notify_icons_.begin());
|
||||
i != notify_icons_.end(); ++i) {
|
||||
|
|
|
@ -7,10 +7,10 @@
|
|||
|
||||
#include <windows.h>
|
||||
|
||||
#include <optional>
|
||||
#include <vector>
|
||||
|
||||
#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}};
|
||||
|
||||
|
@ -27,7 +27,7 @@ class NotifyIconHost {
|
|||
NotifyIconHost(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);
|
||||
|
||||
private:
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue