mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
* chore: bump chromium in DEPS to 87.0.4265.1 * chore: bump chromium in DEPS to 87.0.4266.2 * chore: bump chromium in DEPS to 87.0.4267.1 * update patches * chore: bump chromium in DEPS to 87.0.4270.0 * Update patches * Move content::WebPreferences struct to Blink https://chromium-review.googlesource.com/c/chromium/src/+/2397670 (cherry picked from commit5c98c5ebf4) * viz: Rename RenderPass to CompositorRenderPass (and related types). https://chromium-review.googlesource.com/c/chromium/src/+/2380730 (cherry picked from commitae999b29c1) * 2320268: Migrate DragHostMsg_StartDragging to Mojo Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2320268 (cherry picked from commit4e835d505d) * Make FileURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2337411 (cherry picked from commit284abad17d) * fix: add a patch to remove deprecated factory (cherry picked from commit98c9616829) Co-Authored-By: Robo <hop2deep@gmail.com> * fixup patch (cherry picked from commit98c9616829) Co-Authored-By: Robo <hop2deep@gmail.com> * Add MIME sniffer overloads that take base::StringPieces https://chromium-review.googlesource.com/c/chromium/src/+/2382896 (cherry picked from commit211fd4f8f0) * chore: implement GetSurveyAPIKey Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2362182 (cherry picked from commit6c539bc6fc) * 2415752: Reland "Reland "OOR-CORS: Remove BlinkCORS supporting code outside Blink"" Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2415752 (cherry picked from commitb67757d77d) * Make FileURLLoaderFactory always owned by its |receivers_|. https://chromium-review.googlesource.com/c/chromium/src/+/2337411 (cherry picked from commit507eb0965f) * fixup! Make FileURLLoaderFactory always owned by its |receivers_|. (cherry picked from commite19400b4e2) * 2418471: PDF Viewer update: Add missing aria-labels to various buttons. https://chromium-review.googlesource.com/c/chromium/src/+/2418471 * chore: bump chromium in DEPS to 87.0.4271.0 * Refactor WebContentSettingsClient to dedupe AllowXYZ methods https://chromium-review.googlesource.com/c/chromium/src/+/2353552 (cherry picked from commitf1a5414372) * 2402123: Use end date when deleting http auth cache Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2402123 (cherry picked from commitd00971d0cb) * [printing] Move PrintHostMsg_PreviewIds to print.mojom https://chromium-review.googlesource.com/c/chromium/src/+/2379455 (cherry picked from commite212297da9) * update patches * 2401303: Move content/browser/frame_host/* over to content/browser/renderer_host/ https://chromium-review.googlesource.com/c/chromium/src/+/2401303 (cherry picked from commitbcffa8aeab) * Introduce NonNetworkURLLoaderFactoryBase class. https://chromium-review.googlesource.com/c/chromium/src/+/2357559 (cherry picked from commit33e2e12114) * fix: add a patch to remove deprecated factory (cherry picked from commit98c9616829) * chore: non_network_url_loader_factory_base was moved Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2357431 (cherry picked from commita1a8878402) * chore: replace CreateWebUIURLLoader with CreateWebUIURLLoaderFactory Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2358309 (cherry picked from commit40bfaa5ea4) * 2346803: Study whether blocking of requests via webRequest is fingerprintable https://chromium-review.googlesource.com/c/chromium/src/+/2346803 * lint cleanup * chore: bump chromium in DEPS to 87.0.4272.0 * update patches * 2387901: Accessing C++ enums in Java for WebBluetooth https://chromium-review.googlesource.com/c/chromium/src/+/2387901 * chore: bump chromium in DEPS to 87.0.4273.0 * Update patches (cherry picked from commit b389d4adca71e268c390c41370e87033b69c649c) * chore: bump chromium in DEPS to 87.0.4274.0 * chore: bump chromium in DEPS to 87.0.4275.0 * chore: bump chromium in DEPS to 87.0.4276.0 * update patches * 2418443: Explicit use of deprecated global sources assignment filter https://chromium-review.googlesource.com/c/chromium/src/+/2418443 * fixup 2418443: Explicit use of deprecated global sources assignment filter * Use 87.0.4274.2 for now * 2401847: Cache Storage Permissions on ContentSettingsClientImpl https://chromium-review.googlesource.com/c/chromium/src/+/2401847 * 2418568: Remove ConvertPointToPixel() methods. https://chromium-review.googlesource.com/c/chromium/src/+/2418568 * 2419388: Rename Button methods to be suitable for builders and properties. https://chromium-review.googlesource.com/c/chromium/src/+/2419388 * [XProto] Remove usage of all Xlib headers https: //chromium-review.googlesource.com/c/chromium/src/+/2392140 Co-Authored-By: Robo <hop2deep@gmail.com> * service_manager::kCrashDumpSignal -> kCrashDumpSignal Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2417073 (cherry picked from commit 7d9d2a172f50e12830a2b8fbfbb2fe344756c377) * gfx::ConvertPointToPixel -> gfx::ConvertPointToPixels Refs: https://chromium-review.googlesource.com/c/chromium/src/+/2418568 (cherry picked from commit a0bf07570409f84a3b7fa9d12bddd8c1805f43c5) * Fixup [XProto] Remove usage of all Xlib headers * Set appid on Pip windows. https: //chromium-review.googlesource.com/c/chromium/src/+/2388274 Co-Authored-By: Robo <hop2deep@gmail.com> * chore: update node patches for common.gypi Co-Authored-By: Samuel Attard <MarshallOfSound@users.noreply.github.com> * Try using lower number of processes for linux * fixup call to diagnose_goma_log.py * Use larger machines on linux to work around goma issue * Don't fail on goma stats * don't exit immediately * turn off pipefail * always return true Co-authored-by: John Kleinschmidt <jkleinsc@github.com> Co-authored-by: deepak1556 <hop2deep@gmail.com> Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com> Co-authored-by: Andy Locascio <andy@slack-corp.com> Co-authored-by: Samuel Attard <MarshallOfSound@users.noreply.github.com>
99 lines
2.9 KiB
C++
99 lines
2.9 KiB
C++
// Copyright (c) 2015 GitHub, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef SHELL_BROWSER_WEB_CONTENTS_PREFERENCES_H_
|
|
#define SHELL_BROWSER_WEB_CONTENTS_PREFERENCES_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "base/values.h"
|
|
#include "content/public/browser/web_contents_user_data.h"
|
|
|
|
namespace base {
|
|
class CommandLine;
|
|
}
|
|
|
|
namespace content {
|
|
struct WebPreferences;
|
|
}
|
|
|
|
namespace gin_helper {
|
|
class Dictionary;
|
|
}
|
|
|
|
namespace electron {
|
|
|
|
// Stores and applies the preferences of WebContents.
|
|
class WebContentsPreferences
|
|
: public content::WebContentsUserData<WebContentsPreferences> {
|
|
public:
|
|
// Get self from WebContents.
|
|
static WebContentsPreferences* From(content::WebContents* web_contents);
|
|
|
|
WebContentsPreferences(content::WebContents* web_contents,
|
|
const gin_helper::Dictionary& web_preferences);
|
|
~WebContentsPreferences() override;
|
|
|
|
// Set WebPreferences defaults onto the JS object.
|
|
void SetDefaults();
|
|
|
|
// A simple way to know whether a Boolean property is enabled.
|
|
bool IsEnabled(base::StringPiece name, bool default_value = false) const;
|
|
|
|
// $.extend(|web_preferences|, |new_web_preferences|).
|
|
void Merge(const base::DictionaryValue& new_web_preferences);
|
|
|
|
// Append command paramters according to preferences.
|
|
void AppendCommandLineSwitches(base::CommandLine* command_line,
|
|
bool is_subframe);
|
|
|
|
// Modify the WebPreferences according to preferences.
|
|
void OverrideWebkitPrefs(blink::web_pref::WebPreferences* prefs);
|
|
|
|
// Clear the current WebPreferences.
|
|
void Clear();
|
|
|
|
// Return true if the particular preference value exists.
|
|
bool GetPreference(base::StringPiece name, std::string* value) const;
|
|
|
|
// Returns the preload script path.
|
|
bool GetPreloadPath(base::FilePath::StringType* path) const;
|
|
|
|
// Returns the web preferences.
|
|
base::Value* preference() { return &preference_; }
|
|
base::Value* last_preference() { return &last_preference_; }
|
|
|
|
private:
|
|
friend class content::WebContentsUserData<WebContentsPreferences>;
|
|
friend class ElectronBrowserClient;
|
|
|
|
// Get WebContents according to process ID.
|
|
static content::WebContents* GetWebContentsFromProcessID(int process_id);
|
|
|
|
// Checks if the key is not defined
|
|
bool IsUndefined(base::StringPiece key);
|
|
|
|
// Set preference value to given bool if user did not provide value
|
|
bool SetDefaultBoolIfUndefined(base::StringPiece key, bool val);
|
|
|
|
// Set preference value to given bool
|
|
void SetBool(base::StringPiece key, bool value);
|
|
|
|
static std::vector<WebContentsPreferences*> instances_;
|
|
|
|
content::WebContents* web_contents_;
|
|
|
|
base::Value preference_ = base::Value(base::Value::Type::DICTIONARY);
|
|
base::Value last_preference_ = base::Value(base::Value::Type::DICTIONARY);
|
|
|
|
WEB_CONTENTS_USER_DATA_KEY_DECL();
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(WebContentsPreferences);
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // SHELL_BROWSER_WEB_CONTENTS_PREFERENCES_H_
|