mirror of
https://github.com/electron/electron.git
synced 2026-02-19 03:14:51 -05:00
fix: base::Value::Dict -> base::DictValue
https://chromium-review.googlesource.com/c/chromium/src/+/7513889
This commit is contained in:
@@ -510,7 +510,7 @@ int ImportIntoCertStore(CertificateManagerModel* model, base::Value options) {
|
||||
net::ScopedCERTCertificateList imported_certs;
|
||||
int rv = -1;
|
||||
|
||||
if (const base::Value::Dict* dict = options.GetIfDict(); dict != nullptr) {
|
||||
if (const base::DictValue* dict = options.GetIfDict(); dict != nullptr) {
|
||||
if (const std::string* str = dict->FindString("certificate"); str)
|
||||
cert_path = *str;
|
||||
|
||||
@@ -611,7 +611,7 @@ void App::OnWillFinishLaunching() {
|
||||
Emit("will-finish-launching");
|
||||
}
|
||||
|
||||
void App::OnFinishLaunching(base::Value::Dict launch_info) {
|
||||
void App::OnFinishLaunching(base::DictValue launch_info) {
|
||||
#if BUILDFLAG(IS_LINUX)
|
||||
// Set the application name for audio streams shown in external
|
||||
// applications. Only affects pulseaudio currently.
|
||||
@@ -662,8 +662,8 @@ void App::OnDidFailToContinueUserActivity(const std::string& type,
|
||||
|
||||
void App::OnContinueUserActivity(bool* prevent_default,
|
||||
const std::string& type,
|
||||
base::Value::Dict user_info,
|
||||
base::Value::Dict details) {
|
||||
base::DictValue user_info,
|
||||
base::DictValue details) {
|
||||
if (Emit("continue-activity", type, base::Value(std::move(user_info)),
|
||||
base::Value(std::move(details)))) {
|
||||
*prevent_default = true;
|
||||
@@ -671,13 +671,13 @@ void App::OnContinueUserActivity(bool* prevent_default,
|
||||
}
|
||||
|
||||
void App::OnUserActivityWasContinued(const std::string& type,
|
||||
base::Value::Dict user_info) {
|
||||
base::DictValue user_info) {
|
||||
Emit("activity-was-continued", type, base::Value(std::move(user_info)));
|
||||
}
|
||||
|
||||
void App::OnUpdateUserActivityState(bool* prevent_default,
|
||||
const std::string& type,
|
||||
base::Value::Dict user_info) {
|
||||
base::DictValue user_info) {
|
||||
if (Emit("update-activity-state", type, base::Value(std::move(user_info)))) {
|
||||
*prevent_default = true;
|
||||
}
|
||||
@@ -1584,7 +1584,7 @@ v8::Local<v8::Promise> App::SetProxy(gin::Arguments* args) {
|
||||
return handle;
|
||||
}
|
||||
|
||||
base::Value::Dict proxy_config;
|
||||
base::DictValue proxy_config;
|
||||
switch (proxy_mode) {
|
||||
case ProxyPrefs::MODE_DIRECT:
|
||||
proxy_config = ProxyConfigDictionary::CreateDirect();
|
||||
|
||||
@@ -106,7 +106,7 @@ class App final : public gin::Wrappable<App>,
|
||||
void OnOpenURL(const std::string& url) override;
|
||||
void OnActivate(bool has_visible_windows) override;
|
||||
void OnWillFinishLaunching() override;
|
||||
void OnFinishLaunching(base::Value::Dict launch_info) override;
|
||||
void OnFinishLaunching(base::DictValue launch_info) override;
|
||||
void OnAccessibilitySupportChanged() override;
|
||||
void OnPreMainMessageLoopRun() override;
|
||||
void OnPreCreateThreads() override;
|
||||
@@ -117,13 +117,13 @@ class App final : public gin::Wrappable<App>,
|
||||
const std::string& error) override;
|
||||
void OnContinueUserActivity(bool* prevent_default,
|
||||
const std::string& type,
|
||||
base::Value::Dict user_info,
|
||||
base::Value::Dict details) override;
|
||||
base::DictValue user_info,
|
||||
base::DictValue details) override;
|
||||
void OnUserActivityWasContinued(const std::string& type,
|
||||
base::Value::Dict user_info) override;
|
||||
base::DictValue user_info) override;
|
||||
void OnUpdateUserActivityState(bool* prevent_default,
|
||||
const std::string& type,
|
||||
base::Value::Dict user_info) override;
|
||||
base::DictValue user_info) override;
|
||||
void OnNewWindowForTab() override;
|
||||
void OnDidBecomeActive() override;
|
||||
void OnDidResignActive() override;
|
||||
|
||||
@@ -333,7 +333,7 @@ void BaseWindow::OnExecuteAppCommand(const std::string_view command_name) {
|
||||
}
|
||||
|
||||
void BaseWindow::OnTouchBarItemResult(const std::string& item_id,
|
||||
const base::Value::Dict& details) {
|
||||
const base::DictValue& details) {
|
||||
Emit("-touch-bar-interaction", item_id, details);
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class BaseWindow : public gin_helper::TrackableObject<BaseWindow>,
|
||||
void OnWindowAlwaysOnTopChanged() override;
|
||||
void OnExecuteAppCommand(std::string_view command_name) override;
|
||||
void OnTouchBarItemResult(const std::string& item_id,
|
||||
const base::Value::Dict& details) override;
|
||||
const base::DictValue& details) override;
|
||||
void OnNewWindowForTab() override;
|
||||
void OnSystemContextMenu(int x, int y, bool* prevent_default) override;
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
||||
@@ -45,7 +45,7 @@ struct Converter<base::trace_event::TraceConfig> {
|
||||
}
|
||||
}
|
||||
|
||||
base::Value::Dict memory_dump_config;
|
||||
base::DictValue memory_dump_config;
|
||||
if (ConvertFromV8(isolate, val, &memory_dump_config)) {
|
||||
*out = base::trace_event::TraceConfig(std::move(memory_dump_config));
|
||||
return true;
|
||||
|
||||
@@ -103,7 +103,7 @@ namespace electron::api {
|
||||
namespace {
|
||||
|
||||
// Returns whether |cookie| matches |filter|.
|
||||
bool MatchesCookie(const base::Value::Dict& filter,
|
||||
bool MatchesCookie(const base::DictValue& filter,
|
||||
const net::CanonicalCookie& cookie) {
|
||||
const std::string* str;
|
||||
if ((str = filter.FindString("name")) && *str != cookie.Name())
|
||||
@@ -125,7 +125,7 @@ bool MatchesCookie(const base::Value::Dict& filter,
|
||||
}
|
||||
|
||||
// Remove cookies from |list| not matching |filter|, and pass it to |callback|.
|
||||
void FilterCookies(base::Value::Dict filter,
|
||||
void FilterCookies(base::DictValue filter,
|
||||
gin_helper::Promise<net::CookieList> promise,
|
||||
const net::CookieList& cookies) {
|
||||
net::CookieList result;
|
||||
@@ -137,7 +137,7 @@ void FilterCookies(base::Value::Dict filter,
|
||||
}
|
||||
|
||||
void FilterCookieWithStatuses(
|
||||
base::Value::Dict filter,
|
||||
base::DictValue filter,
|
||||
gin_helper::Promise<net::CookieList> promise,
|
||||
const net::CookieAccessResultList& list,
|
||||
const net::CookieAccessResultList& excluded_list) {
|
||||
@@ -294,7 +294,7 @@ v8::Local<v8::Promise> Cookies::Get(v8::Isolate* isolate,
|
||||
auto* storage_partition = browser_context_->GetDefaultStoragePartition();
|
||||
auto* manager = storage_partition->GetCookieManagerForBrowserProcess();
|
||||
|
||||
base::Value::Dict dict;
|
||||
base::DictValue dict;
|
||||
gin::ConvertFromV8(isolate, filter.GetHandle(), &dict);
|
||||
|
||||
std::string url;
|
||||
@@ -343,7 +343,7 @@ v8::Local<v8::Promise> Cookies::Remove(v8::Isolate* isolate,
|
||||
}
|
||||
|
||||
v8::Local<v8::Promise> Cookies::Set(v8::Isolate* isolate,
|
||||
base::Value::Dict details) {
|
||||
base::DictValue details) {
|
||||
gin_helper::Promise<void> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class Cookies final : public gin_helper::DeprecatedWrappable<Cookies>,
|
||||
|
||||
v8::Local<v8::Promise> Get(v8::Isolate*,
|
||||
const gin_helper::Dictionary& filter);
|
||||
v8::Local<v8::Promise> Set(v8::Isolate*, base::Value::Dict details);
|
||||
v8::Local<v8::Promise> Set(v8::Isolate*, base::DictValue details);
|
||||
v8::Local<v8::Promise> Remove(v8::Isolate*,
|
||||
const GURL& url,
|
||||
const std::string& name);
|
||||
|
||||
@@ -53,31 +53,31 @@ void Debugger::DispatchProtocolMessage(DevToolsAgentHost* agent_host,
|
||||
message_str, base::JSON_REPLACE_INVALID_CHARACTERS);
|
||||
if (!parsed_message || !parsed_message->is_dict())
|
||||
return;
|
||||
base::Value::Dict& dict = parsed_message->GetDict();
|
||||
base::DictValue& dict = parsed_message->GetDict();
|
||||
std::optional<int> id = dict.FindInt("id");
|
||||
if (!id) {
|
||||
std::string* method = dict.FindString("method");
|
||||
if (!method)
|
||||
return;
|
||||
std::string* session_id = dict.FindString("sessionId");
|
||||
base::Value::Dict* params = dict.FindDict("params");
|
||||
Emit("message", *method, params ? std::move(*params) : base::Value::Dict(),
|
||||
base::DictValue* params = dict.FindDict("params");
|
||||
Emit("message", *method, params ? std::move(*params) : base::DictValue(),
|
||||
session_id ? *session_id : "");
|
||||
} else {
|
||||
auto it = pending_requests_.find(*id);
|
||||
if (it == pending_requests_.end())
|
||||
return;
|
||||
|
||||
gin_helper::Promise<base::Value::Dict> promise = std::move(it->second);
|
||||
gin_helper::Promise<base::DictValue> promise = std::move(it->second);
|
||||
pending_requests_.erase(it);
|
||||
|
||||
base::Value::Dict* error = dict.FindDict("error");
|
||||
base::DictValue* error = dict.FindDict("error");
|
||||
if (error) {
|
||||
std::string* error_message = error->FindString("message");
|
||||
promise.RejectWithErrorMessage(error_message ? *error_message : "");
|
||||
} else {
|
||||
base::Value::Dict* result = dict.FindDict("result");
|
||||
promise.Resolve(result ? std::move(*result) : base::Value::Dict());
|
||||
base::DictValue* result = dict.FindDict("result");
|
||||
promise.Resolve(result ? std::move(*result) : base::DictValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -132,7 +132,7 @@ void Debugger::Detach() {
|
||||
|
||||
v8::Local<v8::Promise> Debugger::SendCommand(gin::Arguments* args) {
|
||||
v8::Isolate* isolate = args->isolate();
|
||||
gin_helper::Promise<base::Value::Dict> promise(isolate);
|
||||
gin_helper::Promise<base::DictValue> promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
||||
if (!agent_host_) {
|
||||
@@ -146,7 +146,7 @@ v8::Local<v8::Promise> Debugger::SendCommand(gin::Arguments* args) {
|
||||
return handle;
|
||||
}
|
||||
|
||||
base::Value::Dict command_params;
|
||||
base::DictValue command_params;
|
||||
args->GetNext(&command_params);
|
||||
|
||||
std::string session_id;
|
||||
@@ -155,7 +155,7 @@ v8::Local<v8::Promise> Debugger::SendCommand(gin::Arguments* args) {
|
||||
return handle;
|
||||
}
|
||||
|
||||
base::Value::Dict request;
|
||||
base::DictValue request;
|
||||
int request_id = ++previous_request_id_;
|
||||
pending_requests_.emplace(request_id, std::move(promise));
|
||||
request.Set("id", request_id);
|
||||
|
||||
@@ -68,8 +68,7 @@ class Debugger final : public gin::Wrappable<Debugger>,
|
||||
content::RenderFrameHost* new_rfh) override;
|
||||
|
||||
private:
|
||||
using PendingRequestMap =
|
||||
std::map<int, gin_helper::Promise<base::Value::Dict>>;
|
||||
using PendingRequestMap = std::map<int, gin_helper::Promise<base::DictValue>>;
|
||||
|
||||
void Attach(gin::Arguments* args);
|
||||
bool IsAttached();
|
||||
|
||||
@@ -133,7 +133,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
|
||||
auto command_line_string =
|
||||
base::CommandLine::ForCurrentProcess()->GetCommandLineString();
|
||||
auto channel_string = std::string("Electron " ELECTRON_VERSION);
|
||||
base::Value::Dict custom_constants = net_log::GetPlatformConstantsForNetLog(
|
||||
base::DictValue custom_constants = net_log::GetPlatformConstantsForNetLog(
|
||||
command_line_string, channel_string);
|
||||
|
||||
auto* network_context =
|
||||
@@ -155,7 +155,7 @@ v8::Local<v8::Promise> NetLog::StartLogging(base::FilePath log_path,
|
||||
|
||||
void NetLog::StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode,
|
||||
uint64_t max_file_size,
|
||||
base::Value::Dict custom_constants,
|
||||
base::DictValue custom_constants,
|
||||
base::File output_file) {
|
||||
if (!net_log_exporter_) {
|
||||
// Theoretically the mojo pipe could have been closed by the time we get
|
||||
@@ -206,7 +206,7 @@ v8::Local<v8::Promise> NetLog::StopLogging(v8::Isolate* const isolate) {
|
||||
// pointer lives long enough to resolve the promise. Moving it into the
|
||||
// callback will cause the instance variable to become empty.
|
||||
net_log_exporter_->Stop(
|
||||
base::Value::Dict(),
|
||||
base::DictValue(),
|
||||
base::BindOnce(
|
||||
[](mojo::Remote<network::mojom::NetLogExporter>,
|
||||
gin_helper::Promise<void> promise, int32_t error) {
|
||||
|
||||
@@ -67,7 +67,7 @@ class NetLog final : public gin::Wrappable<NetLog> {
|
||||
|
||||
void StartNetLogAfterCreateFile(net::NetLogCaptureMode capture_mode,
|
||||
uint64_t max_file_size,
|
||||
base::Value::Dict custom_constants,
|
||||
base::DictValue custom_constants,
|
||||
base::File output_file);
|
||||
void NetLogStarted(int32_t error);
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ class PushNotifications final
|
||||
PushNotifications& operator=(const PushNotifications&) = delete;
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
void OnDidReceiveAPNSNotification(const base::Value::Dict& user_info);
|
||||
void OnDidReceiveAPNSNotification(const base::DictValue& user_info);
|
||||
void ResolveAPNSPromiseSetWithToken(const std::string& token_string);
|
||||
void RejectAPNSPromiseSetWithError(const std::string& error_message);
|
||||
#endif
|
||||
|
||||
@@ -46,7 +46,7 @@ void PushNotifications::UnregisterForAPNSNotifications() {
|
||||
}
|
||||
|
||||
void PushNotifications::OnDidReceiveAPNSNotification(
|
||||
const base::Value::Dict& user_info) {
|
||||
const base::DictValue& user_info) {
|
||||
Emit("received-apns-notification", user_info);
|
||||
}
|
||||
|
||||
|
||||
@@ -369,10 +369,10 @@ class ClearDataTask : public gin_helper::CleanedUpAtExit {
|
||||
std::vector<std::unique_ptr<ClearDataOperation>> operations_;
|
||||
};
|
||||
|
||||
base::Value::Dict createProxyConfig(ProxyPrefs::ProxyMode proxy_mode,
|
||||
std::string const& pac_url,
|
||||
std::string const& proxy_server,
|
||||
std::string const& bypass_list) {
|
||||
base::DictValue createProxyConfig(ProxyPrefs::ProxyMode proxy_mode,
|
||||
std::string const& pac_url,
|
||||
std::string const& proxy_server,
|
||||
std::string const& bypass_list) {
|
||||
if (proxy_mode == ProxyPrefs::MODE_DIRECT) {
|
||||
return ProxyConfigDictionary::CreateDirect();
|
||||
}
|
||||
@@ -1579,7 +1579,7 @@ void Session::SetSpellCheckerLanguages(
|
||||
gin_helper::ErrorThrower thrower,
|
||||
const std::vector<std::string>& languages) {
|
||||
#if !BUILDFLAG(IS_MAC)
|
||||
base::Value::List language_codes;
|
||||
base::ListValue language_codes;
|
||||
for (const std::string& lang : languages) {
|
||||
std::string code = spellcheck::GetCorrespondingSpellCheckLanguage(lang);
|
||||
if (code.empty()) {
|
||||
@@ -1738,7 +1738,7 @@ Session* Session::FromOrCreate(v8::Isolate* isolate,
|
||||
// static
|
||||
Session* Session::FromPartition(v8::Isolate* isolate,
|
||||
const std::string& partition,
|
||||
base::Value::Dict options) {
|
||||
base::DictValue options) {
|
||||
ElectronBrowserContext* browser_context;
|
||||
if (partition.empty()) {
|
||||
browser_context =
|
||||
@@ -1757,7 +1757,7 @@ Session* Session::FromPartition(v8::Isolate* isolate,
|
||||
// static
|
||||
Session* Session::FromPath(gin::Arguments* args,
|
||||
const base::FilePath& path,
|
||||
base::Value::Dict options) {
|
||||
base::DictValue options) {
|
||||
ElectronBrowserContext* browser_context;
|
||||
|
||||
if (path.empty()) {
|
||||
@@ -1902,7 +1902,7 @@ Session* FromPartition(const std::string& partition, gin::Arguments* args) {
|
||||
args->ThrowTypeError("Session can only be received when app is ready");
|
||||
return {};
|
||||
}
|
||||
base::Value::Dict options;
|
||||
base::DictValue options;
|
||||
args->GetNext(&options);
|
||||
return Session::FromPartition(args->isolate(), partition, std::move(options));
|
||||
}
|
||||
@@ -1912,7 +1912,7 @@ Session* FromPath(const base::FilePath& path, gin::Arguments* args) {
|
||||
args->ThrowTypeError("Session can only be received when app is ready");
|
||||
return {};
|
||||
}
|
||||
base::Value::Dict options;
|
||||
base::DictValue options;
|
||||
args->GetNext(&options);
|
||||
return Session::FromPath(args, path, std::move(options));
|
||||
}
|
||||
|
||||
@@ -90,12 +90,12 @@ class Session final : public gin::Wrappable<Session>,
|
||||
// Gets the Session of |partition|.
|
||||
static Session* FromPartition(v8::Isolate* isolate,
|
||||
const std::string& partition,
|
||||
base::Value::Dict options = {});
|
||||
base::DictValue options = {});
|
||||
|
||||
// Gets the Session based on |path|.
|
||||
static Session* FromPath(gin::Arguments* args,
|
||||
const base::FilePath& path,
|
||||
base::Value::Dict options = {});
|
||||
base::DictValue options = {});
|
||||
|
||||
static void FillObjectTemplate(v8::Isolate*, v8::Local<v8::ObjectTemplate>);
|
||||
static const char* GetClassName() { return "Session"; }
|
||||
|
||||
@@ -77,25 +77,25 @@ class SystemPreferences final
|
||||
void OnWndProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
|
||||
|
||||
// BrowserObserver:
|
||||
void OnFinishLaunching(base::Value::Dict launch_info) override;
|
||||
void OnFinishLaunching(base::DictValue launch_info) override;
|
||||
|
||||
#elif BUILDFLAG(IS_MAC)
|
||||
using NotificationCallback = base::RepeatingCallback<
|
||||
void(const std::string&, base::Value, const std::string&)>;
|
||||
|
||||
void PostNotification(const std::string& name,
|
||||
base::Value::Dict user_info,
|
||||
base::DictValue user_info,
|
||||
gin::Arguments* args);
|
||||
int SubscribeNotification(v8::Local<v8::Value> maybe_name,
|
||||
const NotificationCallback& callback);
|
||||
void UnsubscribeNotification(int id);
|
||||
void PostLocalNotification(const std::string& name,
|
||||
base::Value::Dict user_info);
|
||||
base::DictValue user_info);
|
||||
int SubscribeLocalNotification(v8::Local<v8::Value> maybe_name,
|
||||
const NotificationCallback& callback);
|
||||
void UnsubscribeLocalNotification(int request_id);
|
||||
void PostWorkspaceNotification(const std::string& name,
|
||||
base::Value::Dict user_info);
|
||||
base::DictValue user_info);
|
||||
int SubscribeWorkspaceNotification(v8::Local<v8::Value> maybe_name,
|
||||
const NotificationCallback& callback);
|
||||
void UnsubscribeWorkspaceNotification(int request_id);
|
||||
|
||||
@@ -129,7 +129,7 @@ NSNotificationCenter* GetNotificationCenter(NotificationCenterKind kind) {
|
||||
} // namespace
|
||||
|
||||
void SystemPreferences::PostNotification(const std::string& name,
|
||||
base::Value::Dict user_info,
|
||||
base::DictValue user_info,
|
||||
gin::Arguments* args) {
|
||||
bool immediate = false;
|
||||
args->GetNext(&immediate);
|
||||
@@ -157,7 +157,7 @@ void SystemPreferences::UnsubscribeNotification(int request_id) {
|
||||
}
|
||||
|
||||
void SystemPreferences::PostLocalNotification(const std::string& name,
|
||||
base::Value::Dict user_info) {
|
||||
base::DictValue user_info) {
|
||||
NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
|
||||
[center
|
||||
postNotificationName:base::SysUTF8ToNSString(name)
|
||||
@@ -178,7 +178,7 @@ void SystemPreferences::UnsubscribeLocalNotification(int request_id) {
|
||||
}
|
||||
|
||||
void SystemPreferences::PostWorkspaceNotification(const std::string& name,
|
||||
base::Value::Dict user_info) {
|
||||
base::DictValue user_info) {
|
||||
NSNotificationCenter* center =
|
||||
[[NSWorkspace sharedWorkspace] notificationCenter];
|
||||
[center
|
||||
@@ -236,7 +236,7 @@ int SystemPreferences::DoSubscribeNotification(
|
||||
} else {
|
||||
copied_callback.Run(
|
||||
base::SysNSStringToUTF8(notification.name),
|
||||
base::Value(base::Value::Dict()), object);
|
||||
base::Value(base::DictValue()), object);
|
||||
}
|
||||
}];
|
||||
return request_id;
|
||||
@@ -285,7 +285,7 @@ v8::Local<v8::Value> SystemPreferences::GetUserDefault(
|
||||
}
|
||||
|
||||
void SystemPreferences::RegisterDefaults(gin::Arguments* args) {
|
||||
base::Value::Dict dict_value;
|
||||
base::DictValue dict_value;
|
||||
|
||||
if (!args->GetNext(&dict_value)) {
|
||||
args->ThrowError();
|
||||
|
||||
@@ -221,7 +221,7 @@ void SystemPreferences::OnWndProc(HWND hwnd,
|
||||
Emit("color-changed");
|
||||
}
|
||||
|
||||
void SystemPreferences::OnFinishLaunching(base::Value::Dict launch_info) {
|
||||
void SystemPreferences::OnFinishLaunching(base::DictValue launch_info) {
|
||||
hwnd_subscription_ =
|
||||
gfx::SingletonHwnd::GetInstance()->RegisterCallback(base::BindRepeating(
|
||||
&SystemPreferences::OnWndProc, base::Unretained(this)));
|
||||
|
||||
@@ -667,8 +667,8 @@ FileSystem CreateFileSystemStruct(content::WebContents* web_contents,
|
||||
return FileSystem(type, file_system_name, root_url, file_system_path);
|
||||
}
|
||||
|
||||
base::Value::Dict CreateFileSystemValue(const FileSystem& file_system) {
|
||||
base::Value::Dict value;
|
||||
base::DictValue CreateFileSystemValue(const FileSystem& file_system) {
|
||||
base::DictValue value;
|
||||
value.Set("type", file_system.type);
|
||||
value.Set("fileSystemName", file_system.file_system_name);
|
||||
value.Set("rootURL", file_system.root_url);
|
||||
@@ -711,7 +711,7 @@ PrefService* GetPrefService(content::WebContents* web_contents) {
|
||||
}
|
||||
|
||||
// returns a Dict of filesystem_path -> type
|
||||
[[nodiscard]] const base::Value::Dict& GetAddedFileSystems(
|
||||
[[nodiscard]] const base::DictValue& GetAddedFileSystems(
|
||||
content::WebContents* web_contents) {
|
||||
return GetPrefService(web_contents)->GetDict(prefs::kDevToolsFileSystemPaths);
|
||||
}
|
||||
@@ -3026,7 +3026,7 @@ bool WebContents::IsCurrentlyAudible() {
|
||||
namespace {
|
||||
|
||||
void OnGetDeviceNameToUse(base::WeakPtr<content::WebContents> web_contents,
|
||||
base::Value::Dict print_settings,
|
||||
base::DictValue print_settings,
|
||||
printing::CompletionCallback print_callback,
|
||||
// <error, device_name>
|
||||
std::pair<std::string, std::u16string> info) {
|
||||
@@ -3105,7 +3105,7 @@ void WebContents::Print(gin::Arguments* const args) {
|
||||
return;
|
||||
}
|
||||
|
||||
base::Value::Dict settings;
|
||||
base::DictValue settings;
|
||||
if (options.IsEmptyObject()) {
|
||||
content::RenderFrameHost* rfh = GetRenderFrameHostToUse(web_contents());
|
||||
if (!rfh)
|
||||
@@ -3136,7 +3136,7 @@ void WebContents::Print(gin::Arguments* const args) {
|
||||
|
||||
if (margin_type == printing::mojom::MarginType::kCustomMargins) {
|
||||
settings.Set(printing::kSettingMarginsCustom,
|
||||
base::Value::Dict{}
|
||||
base::DictValue{}
|
||||
.Set(printing::kSettingMarginTop,
|
||||
margins.ValueOrDefault("top", 0))
|
||||
.Set(printing::kSettingMarginBottom,
|
||||
@@ -3204,11 +3204,11 @@ void WebContents::Print(gin::Arguments* const args) {
|
||||
// Set custom page ranges to print
|
||||
std::vector<gin_helper::Dictionary> page_ranges;
|
||||
if (options.Get("pageRanges", &page_ranges)) {
|
||||
base::Value::List page_range_list;
|
||||
base::ListValue page_range_list;
|
||||
for (auto& range : page_ranges) {
|
||||
int from, to;
|
||||
if (range.Get("from", &from) && range.Get("to", &to)) {
|
||||
base::Value::Dict range_dict;
|
||||
base::DictValue range_dict;
|
||||
// Chromium uses 1-based page ranges, so increment each by 1.
|
||||
range_dict.Set(printing::kSettingPageRangeFrom, from + 1);
|
||||
range_dict.Set(printing::kSettingPageRangeTo, to + 1);
|
||||
@@ -3226,13 +3226,13 @@ void WebContents::Print(gin::Arguments* const args) {
|
||||
"duplexMode", printing::mojom::DuplexMode::kSimplex);
|
||||
settings.Set(printing::kSettingDuplexMode, static_cast<int>(duplex_mode));
|
||||
|
||||
base::Value::Dict media_size;
|
||||
base::DictValue media_size;
|
||||
if (options.Get("mediaSize", &media_size)) {
|
||||
settings.Set(printing::kSettingMediaSize, std::move(media_size));
|
||||
} else {
|
||||
// Default to A4 paper size (210mm x 297mm)
|
||||
settings.Set(printing::kSettingMediaSize,
|
||||
base::Value::Dict()
|
||||
base::DictValue()
|
||||
.Set(printing::kSettingMediaSizeHeightMicrons, 297000)
|
||||
.Set(printing::kSettingMediaSizeWidthMicrons, 210000)
|
||||
.Set(printing::kSettingsImageableAreaLeftMicrons, 0)
|
||||
@@ -4182,9 +4182,9 @@ void WebContents::DevToolsAppendToFile(const std::string& url,
|
||||
void WebContents::DevToolsRequestFileSystems() {
|
||||
const std::string empty_str;
|
||||
content::WebContents* const dtwc = GetDevToolsWebContents();
|
||||
const base::Value::Dict& added_paths = GetAddedFileSystems(dtwc);
|
||||
const base::DictValue& added_paths = GetAddedFileSystems(dtwc);
|
||||
|
||||
auto filesystems = base::Value::List::with_capacity(added_paths.size());
|
||||
auto filesystems = base::ListValue::with_capacity(added_paths.size());
|
||||
for (const auto path_and_type : added_paths) {
|
||||
const auto& [path, type_val] = path_and_type;
|
||||
const auto& type = type_val.is_string() ? type_val.GetString() : empty_str;
|
||||
@@ -4221,7 +4221,7 @@ void WebContents::DevToolsAddFileSystem(
|
||||
|
||||
FileSystem file_system = CreateFileSystemStruct(
|
||||
GetDevToolsWebContents(), file_system_id, path.AsUTF8Unsafe(), type);
|
||||
base::Value::Dict file_system_value = CreateFileSystemValue(file_system);
|
||||
base::DictValue file_system_value = CreateFileSystemValue(file_system);
|
||||
|
||||
auto* pref_service = GetPrefService(GetDevToolsWebContents());
|
||||
ScopedDictPrefUpdate update(pref_service, prefs::kDevToolsFileSystemPaths);
|
||||
@@ -4331,7 +4331,7 @@ void WebContents::DevToolsSetEyeDropperActive(bool active) {
|
||||
}
|
||||
|
||||
void WebContents::ColorPickedInEyeDropper(int r, int g, int b, int a) {
|
||||
base::Value::Dict color;
|
||||
base::DictValue color;
|
||||
color.Set("r", r);
|
||||
color.Set("g", g);
|
||||
color.Set("b", b);
|
||||
@@ -4383,7 +4383,7 @@ void WebContents::OnDevToolsSearchCompleted(
|
||||
int request_id,
|
||||
const std::string& file_system_path,
|
||||
const std::vector<std::string>& file_paths) {
|
||||
base::Value::List file_paths_value;
|
||||
base::ListValue file_paths_value;
|
||||
for (const auto& file_path : file_paths)
|
||||
file_paths_value.Append(file_path);
|
||||
inspectable_web_contents_->CallClientFunction(
|
||||
|
||||
@@ -90,7 +90,7 @@ extensions::WebRequestResourceType ParseResourceType(std::string_view value) {
|
||||
// to pass the original keys.
|
||||
v8::Local<v8::Value> HttpResponseHeadersToV8(
|
||||
net::HttpResponseHeaders* headers) {
|
||||
base::Value::Dict response_headers;
|
||||
base::DictValue response_headers;
|
||||
if (headers) {
|
||||
size_t iter = 0;
|
||||
std::string key;
|
||||
|
||||
@@ -104,7 +104,7 @@ void GPUInfoEnumerator::EndOverlayInfo() {
|
||||
value_stack_.pop();
|
||||
}
|
||||
|
||||
base::Value::Dict GPUInfoEnumerator::GetDictionary() {
|
||||
base::DictValue GPUInfoEnumerator::GetDictionary() {
|
||||
return std::move(current_);
|
||||
}
|
||||
|
||||
|
||||
@@ -47,12 +47,12 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
|
||||
void EndAuxAttributes() override;
|
||||
void BeginOverlayInfo() override;
|
||||
void EndOverlayInfo() override;
|
||||
base::Value::Dict GetDictionary();
|
||||
base::DictValue GetDictionary();
|
||||
|
||||
private:
|
||||
// The stack is used to manage nested values
|
||||
std::stack<base::Value::Dict> value_stack_;
|
||||
base::Value::Dict current_;
|
||||
std::stack<base::DictValue> value_stack_;
|
||||
base::DictValue current_;
|
||||
};
|
||||
|
||||
} // namespace electron
|
||||
|
||||
@@ -33,7 +33,7 @@ GPUInfoManager::~GPUInfoManager() {
|
||||
|
||||
// Should be posted to the task runner
|
||||
void GPUInfoManager::ProcessCompleteInfo() {
|
||||
base::Value::Dict result = EnumerateGPUInfo(gpu_data_manager_->GetGPUInfo());
|
||||
base::DictValue result = EnumerateGPUInfo(gpu_data_manager_->GetGPUInfo());
|
||||
// We have received the complete information, resolve all promises that
|
||||
// were waiting for this info.
|
||||
for (auto& promise : complete_info_promise_set_) {
|
||||
@@ -76,8 +76,7 @@ void GPUInfoManager::FetchBasicInfo(gin_helper::Promise<base::Value> promise) {
|
||||
promise.Resolve(base::Value(EnumerateGPUInfo(gpu_info)));
|
||||
}
|
||||
|
||||
base::Value::Dict GPUInfoManager::EnumerateGPUInfo(
|
||||
gpu::GPUInfo gpu_info) const {
|
||||
base::DictValue GPUInfoManager::EnumerateGPUInfo(gpu::GPUInfo gpu_info) const {
|
||||
GPUInfoEnumerator enumerator;
|
||||
gpu_info.EnumerateFields(&enumerator);
|
||||
return enumerator.GetDictionary();
|
||||
|
||||
@@ -40,7 +40,7 @@ class GPUInfoManager : private content::GpuDataManagerObserver,
|
||||
// content::GpuDataManagerObserver
|
||||
void OnGpuInfoUpdate() override;
|
||||
|
||||
base::Value::Dict EnumerateGPUInfo(gpu::GPUInfo gpu_info) const;
|
||||
base::DictValue EnumerateGPUInfo(gpu::GPUInfo gpu_info) const;
|
||||
|
||||
// These should be posted to the task queue
|
||||
void CompleteInfoFetcher(gin_helper::Promise<base::Value> promise);
|
||||
|
||||
Reference in New Issue
Block a user