chore: bump chromium to 62327c655093c821aa0fcfc6db53f5fd943e08c7 (master) (#19792)
* chore: bump chromium in DEPS to f3bf493731e868e1f5f48e7e1adc02ea5eccfbbd * chore: bump chromium in DEPS to 4db0c87d4aa6f27ffa0b5fc77d20e10047962484 * chore: bump chromium in DEPS to d933a504c264dc8fe85267f47aef3588531875b5 * chore: bump chromium in DEPS to 34afdb68980f581ae911b85b727bc17e126cf5f9 * update disable-redraw-lock.patch1600387
* update desktop_media_list.patch1729156
* update notification_provenance.patch1742779
* update printing.patch1646772
* update verbose_generate_bpad_syms.patch1745986
* update patch metadata * remove printing_compositor manifests1742734
* update for URLLoaderFactoryType enum1754716
* remove gin string16 converter1750093
* ClearCompositorFrame() has been removed1746301
* message_loop -> message_loop_current1738552
* include resource_response header * pdf compositor no longer uses service manager1742734
* chore: bump chromium in DEPS to 00d5933101d8d8dc9546eadbe7ee1b41077e6db1 * pane focus fns aren't pure virtual anymore1708767
* fix: make std::hash value-non-const broken by1711202
* update swiftshader in zip_manifests https://swiftshader-review.googlesource.com/c/SwiftShader/+/34911 * address feedback from @deepak1556 * don't enable kLegacyWindowsDWriteFontFallback1753006
* chore: bump chromium in DEPS to 84497314005e1968da06804f8fde539d9872310e * update printing.patch remove bottom diff owing to1678182
and update for1678182
* convert CookieChangeListener to new Mojo types1753371
* rename ui::ClipboardType -> ui::ClipboardBuffer1758730
* logging::LoggingSettings log_file -> log_file_path1699477
* roll DEPS to latest lkgr * fix: override GetFontLookupTableCacheDir() When Chromium goes to use its fallback font table creation code paths, it creates the cache directory it uses by calling GetFontLookupTableCacheDir() with a path that doesn't exist in Electron. To ensure that a legitimate file path is created, we need to override it with Electron's DIR_USER_DATA so it doesn't use chrome::DIR_USER_DATA. * chore: bump chromium in DEPS to 6758a0879931bc4df630a80a36c82d7855ae3155 * update pthread_fchdir patch1759149
* update printing patch * update cookie usage and fn signatures1758437
* chore: bump chromium in DEPS to bdaca97e1cc27fb977e56f30f74cdb906da9527e * remove fix_make_std_hash_value-non-const.patch1762335
* Convert enum to enum class for FocusManager::FocusChangeReason1767281
* roll DEPS to latest lkgr * update dom_storage_limits.patch1767556
This commit is contained in:
parent
c89debd19a
commit
b7d25ccb77
85 changed files with 314 additions and 444 deletions
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include "base/command_line.h"
|
||||
#include "base/files/file_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/strings/string_split.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
|
@ -16,6 +17,7 @@
|
|||
#include "content/public/common/pepper_plugin_info.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "ppapi/shared_impl/ppapi_permissions.h"
|
||||
#include "shell/browser/atom_paths.h"
|
||||
#include "shell/common/options_switches.h"
|
||||
#include "ui/base/l10n/l10n_util.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "content/public/common/content_client.h"
|
||||
|
||||
namespace electron {
|
||||
|
|
|
@ -9,33 +9,12 @@
|
|||
#include "printing/buildflags/buildflags.h"
|
||||
#include "services/service_manager/public/cpp/manifest_builder.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
#include "components/services/pdf_compositor/public/cpp/manifest.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
// TODO(https://crbug.com/781334): Remove these helpers and just update the
|
||||
// manifest definitions to be marked out-of-process. This is here only to avoid
|
||||
// extra churn when transitioning away from content_packaged_services.
|
||||
service_manager::Manifest MakeOutOfProcess(
|
||||
const service_manager::Manifest& manifest) {
|
||||
// cpplint.py emits a false positive [build/include_what_you_use]
|
||||
service_manager::Manifest copy(manifest); // NOLINT
|
||||
copy.options.execution_mode =
|
||||
service_manager::Manifest::ExecutionMode::kOutOfProcessBuiltin;
|
||||
return copy;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
|
||||
static base::NoDestructor<service_manager::Manifest> manifest{
|
||||
service_manager::ManifestBuilder()
|
||||
.WithDisplayName("Electron (browser process)")
|
||||
.RequireCapability("device", "device:geolocation_control")
|
||||
.RequireCapability("chrome_printing", "converter")
|
||||
.RequireCapability("pdf_compositor", "compositor")
|
||||
.ExposeInterfaceFilterCapability_Deprecated(
|
||||
"navigation:frame", "renderer",
|
||||
service_manager::Manifest::InterfaceList<
|
||||
|
@ -43,13 +22,3 @@ const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
|
|||
.Build()};
|
||||
return *manifest;
|
||||
}
|
||||
|
||||
const std::vector<service_manager::Manifest>&
|
||||
GetElectronBuiltinServiceManifests() {
|
||||
static base::NoDestructor<std::vector<service_manager::Manifest>> manifests{{
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
MakeOutOfProcess(printing::GetPdfCompositorManifest()),
|
||||
#endif
|
||||
}};
|
||||
return *manifests;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,5 @@
|
|||
#include "services/service_manager/public/cpp/manifest.h"
|
||||
|
||||
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest();
|
||||
const std::vector<service_manager::Manifest>&
|
||||
GetElectronBuiltinServiceManifests();
|
||||
|
||||
#endif // SHELL_APP_MANIFESTS_H_
|
||||
|
|
|
@ -122,10 +122,11 @@ bool MatchesCookie(const base::Value& filter,
|
|||
// Remove cookies from |list| not matching |filter|, and pass it to |callback|.
|
||||
void FilterCookies(const base::Value& filter,
|
||||
util::Promise<net::CookieList> promise,
|
||||
const net::CookieList& list,
|
||||
const net::CookieStatusList& list,
|
||||
const net::CookieStatusList& excluded_list) {
|
||||
net::CookieList result;
|
||||
for (const auto& cookie : list) {
|
||||
net::CookieList stripped_cookies = net::cookie_util::StripStatuses(list);
|
||||
for (const auto& cookie : stripped_cookies) {
|
||||
if (MatchesCookie(filter, cookie))
|
||||
result.push_back(cookie);
|
||||
}
|
||||
|
@ -184,22 +185,13 @@ v8::Local<v8::Promise> Cookies::Get(const base::DictionaryValue& filter) {
|
|||
browser_context_.get());
|
||||
auto* manager = storage_partition->GetCookieManagerForBrowserProcess();
|
||||
|
||||
if (url.is_empty()) {
|
||||
// GetAllCookies has a different callback signature than GetCookieList, but
|
||||
// can be treated as the same, just returning no excluded cookies.
|
||||
// |AddCookieStatusList| takes a |GetCookieListCallback| and returns a
|
||||
// callback that calls the input callback with an empty excluded list.
|
||||
manager->GetAllCookies(
|
||||
net::cookie_util::AddCookieStatusList(std::move(callback)));
|
||||
} else {
|
||||
net::CookieOptions options;
|
||||
options.set_include_httponly();
|
||||
options.set_same_site_cookie_context(
|
||||
net::CookieOptions::SameSiteCookieContext::SAME_SITE_STRICT);
|
||||
options.set_do_not_update_access_time();
|
||||
net::CookieOptions options;
|
||||
options.set_include_httponly();
|
||||
options.set_same_site_cookie_context(
|
||||
net::CookieOptions::SameSiteCookieContext::SAME_SITE_STRICT);
|
||||
options.set_do_not_update_access_time();
|
||||
|
||||
manager->GetCookieList(url, options, std::move(callback));
|
||||
}
|
||||
manager->GetCookieList(url, options, std::move(callback));
|
||||
|
||||
return handle;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include <utility>
|
||||
|
||||
#include "base/mac/scoped_sending_event.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/no_destructor.h"
|
||||
#include "base/optional.h"
|
||||
#include "base/strings/utf_string_conversions.h"
|
||||
|
@ -1674,6 +1674,8 @@ void WebContents::Print(mate::Arguments* args) {
|
|||
|
||||
settings.SetString(printing::kSettingHeaderFooterTitle, header);
|
||||
settings.SetString(printing::kSettingHeaderFooterURL, footer);
|
||||
} else {
|
||||
settings.SetBoolean(printing::kSettingHeaderFooterEnabled, false);
|
||||
}
|
||||
|
||||
// We don't want to allow the user to enable these settings
|
||||
|
|
|
@ -769,11 +769,6 @@ AtomBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
|
|||
return base::nullopt;
|
||||
}
|
||||
|
||||
std::vector<service_manager::Manifest>
|
||||
AtomBrowserClient::GetExtraServiceManifests() {
|
||||
return GetElectronBuiltinServiceManifests();
|
||||
}
|
||||
|
||||
std::unique_ptr<content::BrowserMainParts>
|
||||
AtomBrowserClient::CreateBrowserMainParts(
|
||||
const content::MainFunctionParams& params) {
|
||||
|
@ -983,8 +978,7 @@ bool AtomBrowserClient::WillCreateURLLoaderFactory(
|
|||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame_host,
|
||||
int render_process_id,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
|
@ -1080,6 +1074,13 @@ std::string AtomBrowserClient::GetApplicationLocale() {
|
|||
return *g_application_locale;
|
||||
}
|
||||
|
||||
base::FilePath AtomBrowserClient::GetFontLookupTableCacheDir() {
|
||||
base::FilePath user_data_dir;
|
||||
base::PathService::Get(DIR_USER_DATA, &user_data_dir);
|
||||
DCHECK(!user_data_dir.empty());
|
||||
return user_data_dir.Append(FILE_PATH_LITERAL("FontLookupTableCache"));
|
||||
}
|
||||
|
||||
bool AtomBrowserClient::ShouldEnableStrictSiteIsolation() {
|
||||
// Enable site isolation. It is off by default in Chromium <= 69.
|
||||
return true;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "base/synchronization/lock.h"
|
||||
#include "content/public/browser/content_browser_client.h"
|
||||
#include "content/public/browser/render_process_host_observer.h"
|
||||
|
@ -60,6 +61,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
|
||||
// content::ContentBrowserClient:
|
||||
std::string GetApplicationLocale() override;
|
||||
base::FilePath GetFontLookupTableCacheDir() override;
|
||||
|
||||
// content::ContentBrowserClient:
|
||||
bool ShouldEnableStrictSiteIsolation() override;
|
||||
|
@ -148,7 +150,6 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
||||
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
|
||||
base::StringPiece name) override;
|
||||
std::vector<service_manager::Manifest> GetExtraServiceManifests() override;
|
||||
content::MediaObserver* GetMediaObserver() override;
|
||||
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
|
||||
content::PlatformNotificationService* GetPlatformNotificationService(
|
||||
|
@ -173,8 +174,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
|
|||
content::BrowserContext* browser_context,
|
||||
content::RenderFrameHost* frame,
|
||||
int render_process_id,
|
||||
bool is_navigation,
|
||||
bool is_download,
|
||||
URLLoaderFactoryType type,
|
||||
const url::Origin& request_initiator,
|
||||
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
||||
network::mojom::TrustedURLLoaderHeaderClientPtrInfo* header_client,
|
||||
|
|
|
@ -18,7 +18,7 @@ using content::BrowserThread;
|
|||
namespace electron {
|
||||
|
||||
CookieChangeNotifier::CookieChangeNotifier(AtomBrowserContext* browser_context)
|
||||
: browser_context_(browser_context), binding_(this) {
|
||||
: browser_context_(browser_context), receiver_(this) {
|
||||
StartListening();
|
||||
}
|
||||
|
||||
|
@ -34,28 +34,26 @@ CookieChangeNotifier::RegisterCookieChangeCallback(
|
|||
|
||||
void CookieChangeNotifier::StartListening() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
DCHECK(!binding_.is_bound());
|
||||
DCHECK(!receiver_.is_bound());
|
||||
|
||||
network::mojom::CookieManager* cookie_manager =
|
||||
content::BrowserContext::GetDefaultStoragePartition(browser_context_)
|
||||
->GetCookieManagerForBrowserProcess();
|
||||
|
||||
// Cookie manager should be created whenever network context is created,
|
||||
// if this fails then there is something wrong with our context creation
|
||||
// cycle.
|
||||
CHECK(cookie_manager);
|
||||
|
||||
network::mojom::CookieChangeListenerPtr listener_ptr;
|
||||
binding_.Bind(mojo::MakeRequest(&listener_ptr));
|
||||
binding_.set_connection_error_handler(base::BindOnce(
|
||||
cookie_manager->AddGlobalChangeListener(receiver_.BindNewPipeAndPassRemote());
|
||||
receiver_.set_disconnect_handler(base::BindOnce(
|
||||
&CookieChangeNotifier::OnConnectionError, base::Unretained(this)));
|
||||
|
||||
cookie_manager->AddGlobalChangeListener(std::move(listener_ptr));
|
||||
}
|
||||
|
||||
void CookieChangeNotifier::OnConnectionError() {
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
|
||||
binding_.Close();
|
||||
receiver_.reset();
|
||||
StartListening();
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "base/callback_list.h"
|
||||
#include "base/macros.h"
|
||||
#include "mojo/public/cpp/bindings/binding.h"
|
||||
#include "mojo/public/cpp/bindings/receiver.h"
|
||||
#include "services/network/public/mojom/cookie_manager.mojom.h"
|
||||
|
||||
namespace electron {
|
||||
|
@ -38,7 +38,8 @@ class CookieChangeNotifier : public network::mojom::CookieChangeListener {
|
|||
|
||||
AtomBrowserContext* browser_context_;
|
||||
base::CallbackList<void(const CookieDetails*)> cookie_change_sub_list_;
|
||||
mojo::Binding<network::mojom::CookieChangeListener> binding_;
|
||||
|
||||
mojo::Receiver<network::mojom::CookieChangeListener> receiver_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CookieChangeNotifier);
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/task/thread_pool/initialization_util.h"
|
||||
#include "base/threading/thread_task_runner_handle.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#ifndef SHELL_BROWSER_MICROTASKS_RUNNER_H_
|
||||
#define SHELL_BROWSER_MICROTASKS_RUNNER_H_
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/task/task_observer.h"
|
||||
|
||||
namespace v8 {
|
||||
class Isolate;
|
||||
|
@ -19,11 +19,11 @@ namespace electron {
|
|||
// Node follows the kExplicit MicrotasksPolicy, and we do the same in browser
|
||||
// process. Hence, we need to have this task observer to flush the queued
|
||||
// microtasks.
|
||||
class MicrotasksRunner : public base::MessageLoop::TaskObserver {
|
||||
class MicrotasksRunner : public base::TaskObserver {
|
||||
public:
|
||||
explicit MicrotasksRunner(v8::Isolate* isolate);
|
||||
|
||||
// base::MessageLoop::TaskObserver
|
||||
// base::TaskObserver
|
||||
void WillProcessTask(const base::PendingTask& pending_task) override;
|
||||
void DidProcessTask(const base::PendingTask& pending_task) override;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "mojo/public/cpp/bindings/binding_set.h"
|
||||
#include "native_mate/dictionary.h"
|
||||
#include "net/url_request/url_request_job_factory.h"
|
||||
#include "services/network/public/cpp/resource_response.h"
|
||||
#include "services/network/public/mojom/url_loader_factory.mojom.h"
|
||||
|
||||
namespace electron {
|
||||
|
|
|
@ -486,10 +486,6 @@ void OffScreenRenderWidgetHostView::SubmitCompositorFrame(
|
|||
NOTREACHED();
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::ClearCompositorFrame() {
|
||||
NOTREACHED();
|
||||
}
|
||||
|
||||
void OffScreenRenderWidgetHostView::ResetFallbackToFirstNavigationSurface() {
|
||||
GetDelegatedFrameHost()->ResetFallbackToFirstNavigationSurface();
|
||||
}
|
||||
|
|
|
@ -122,7 +122,6 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
|
|||
viz::CompositorFrame frame,
|
||||
base::Optional<viz::HitTestRegionList> hit_test_region_list) override;
|
||||
|
||||
void ClearCompositorFrame(void) override;
|
||||
void ResetFallbackToFirstNavigationSurface() override;
|
||||
void InitAsPopup(content::RenderWidgetHostView* rwhv,
|
||||
const gfx::Rect& rect) override;
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "base/message_loop/message_loop.h"
|
||||
#include "base/message_loop/message_loop_current.h"
|
||||
#include "base/message_loop/message_pump_mac.h"
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "base/task/post_task.h"
|
||||
|
|
|
@ -150,11 +150,13 @@ bool MenuBar::AcceleratorPressed(const ui::Accelerator& accelerator) {
|
|||
return true;
|
||||
case ui::VKEY_HOME:
|
||||
GetFocusManager()->SetFocusedViewWithReason(
|
||||
GetFirstFocusableChild(), views::FocusManager::kReasonFocusTraversal);
|
||||
GetFirstFocusableChild(),
|
||||
views::FocusManager::FocusChangeReason::kFocusTraversal);
|
||||
return true;
|
||||
case ui::VKEY_END:
|
||||
GetFocusManager()->SetFocusedViewWithReason(
|
||||
GetLastFocusableChild(), views::FocusManager::kReasonFocusTraversal);
|
||||
GetLastFocusableChild(),
|
||||
views::FocusManager::FocusChangeReason::kFocusTraversal);
|
||||
return true;
|
||||
default: {
|
||||
auto children = GetChildrenInZOrder();
|
||||
|
|
|
@ -71,8 +71,6 @@ class MenuBar : public views::AccessiblePaneView,
|
|||
|
||||
// views::AccessiblePaneView:
|
||||
bool AcceleratorPressed(const ui::Accelerator& accelerator) override;
|
||||
bool SetPaneFocus(views::View* initial_focus) override;
|
||||
void RemovePaneFocus() override;
|
||||
|
||||
protected:
|
||||
// views::View:
|
||||
|
@ -84,6 +82,9 @@ class MenuBar : public views::AccessiblePaneView,
|
|||
const ui::Event* event) override;
|
||||
void OnThemeChanged() override;
|
||||
|
||||
bool SetPaneFocus(views::View* initial_focus);
|
||||
void RemovePaneFocus();
|
||||
|
||||
private:
|
||||
friend class MenuBarColorUpdater;
|
||||
|
||||
|
|
|
@ -160,7 +160,8 @@ void RootView::RestoreFocus() {
|
|||
View* last_focused_view = last_focused_view_tracker_->view();
|
||||
if (last_focused_view) {
|
||||
GetFocusManager()->SetFocusedViewWithReason(
|
||||
last_focused_view, views::FocusManager::kReasonFocusRestore);
|
||||
last_focused_view,
|
||||
views::FocusManager::FocusChangeReason::kFocusRestore);
|
||||
}
|
||||
if (menu_bar_autohide_)
|
||||
SetMenuBarVisibility(false);
|
||||
|
|
|
@ -18,19 +18,20 @@ namespace electron {
|
|||
|
||||
namespace api {
|
||||
|
||||
ui::ClipboardType Clipboard::GetClipboardType(mate::Arguments* args) {
|
||||
ui::ClipboardBuffer Clipboard::GetClipboardBuffer(mate::Arguments* args) {
|
||||
std::string type;
|
||||
if (args->GetNext(&type) && type == "selection")
|
||||
return ui::ClipboardType::kSelection;
|
||||
return ui::ClipboardBuffer::kSelection;
|
||||
else
|
||||
return ui::ClipboardType::kCopyPaste;
|
||||
return ui::ClipboardBuffer::kCopyPaste;
|
||||
}
|
||||
|
||||
std::vector<base::string16> Clipboard::AvailableFormats(mate::Arguments* args) {
|
||||
std::vector<base::string16> format_types;
|
||||
bool ignore;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
clipboard->ReadAvailableTypes(GetClipboardType(args), &format_types, &ignore);
|
||||
clipboard->ReadAvailableTypes(GetClipboardBuffer(args), &format_types,
|
||||
&ignore);
|
||||
return format_types;
|
||||
}
|
||||
|
||||
|
@ -38,7 +39,7 @@ bool Clipboard::Has(const std::string& format_string, mate::Arguments* args) {
|
|||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
ui::ClipboardFormatType format(
|
||||
ui::ClipboardFormatType::GetType(format_string));
|
||||
return clipboard->IsFormatAvailable(format, GetClipboardType(args));
|
||||
return clipboard->IsFormatAvailable(format, GetClipboardBuffer(args));
|
||||
}
|
||||
|
||||
std::string Clipboard::Read(const std::string& format_string) {
|
||||
|
@ -66,14 +67,14 @@ void Clipboard::WriteBuffer(const std::string& format,
|
|||
return;
|
||||
}
|
||||
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
writer.WriteData(
|
||||
ui::ClipboardFormatType::GetType(format).Serialize(),
|
||||
std::string(node::Buffer::Data(buffer), node::Buffer::Length(buffer)));
|
||||
}
|
||||
|
||||
void Clipboard::Write(const mate::Dictionary& data, mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
base::string16 text, html, bookmark;
|
||||
gfx::Image image;
|
||||
|
||||
|
@ -99,7 +100,7 @@ void Clipboard::Write(const mate::Dictionary& data, mate::Arguments* args) {
|
|||
base::string16 Clipboard::ReadText(mate::Arguments* args) {
|
||||
base::string16 data;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
auto type = GetClipboardType(args);
|
||||
auto type = GetClipboardBuffer(args);
|
||||
if (clipboard->IsFormatAvailable(ui::ClipboardFormatType::GetPlainTextWType(),
|
||||
type)) {
|
||||
clipboard->ReadText(type, &data);
|
||||
|
@ -113,19 +114,19 @@ base::string16 Clipboard::ReadText(mate::Arguments* args) {
|
|||
}
|
||||
|
||||
void Clipboard::WriteText(const base::string16& text, mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
writer.WriteText(text);
|
||||
}
|
||||
|
||||
base::string16 Clipboard::ReadRTF(mate::Arguments* args) {
|
||||
std::string data;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
clipboard->ReadRTF(GetClipboardType(args), &data);
|
||||
clipboard->ReadRTF(GetClipboardBuffer(args), &data);
|
||||
return base::UTF8ToUTF16(data);
|
||||
}
|
||||
|
||||
void Clipboard::WriteRTF(const std::string& text, mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
writer.WriteRTF(text);
|
||||
}
|
||||
|
||||
|
@ -136,13 +137,13 @@ base::string16 Clipboard::ReadHTML(mate::Arguments* args) {
|
|||
uint32_t start;
|
||||
uint32_t end;
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
clipboard->ReadHTML(GetClipboardType(args), &html, &url, &start, &end);
|
||||
clipboard->ReadHTML(GetClipboardBuffer(args), &html, &url, &start, &end);
|
||||
data = html.substr(start, end - start);
|
||||
return data;
|
||||
}
|
||||
|
||||
void Clipboard::WriteHTML(const base::string16& html, mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
writer.WriteHTML(html, std::string());
|
||||
}
|
||||
|
||||
|
@ -160,18 +161,18 @@ v8::Local<v8::Value> Clipboard::ReadBookmark(mate::Arguments* args) {
|
|||
void Clipboard::WriteBookmark(const base::string16& title,
|
||||
const std::string& url,
|
||||
mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
writer.WriteBookmark(title, url);
|
||||
}
|
||||
|
||||
gfx::Image Clipboard::ReadImage(mate::Arguments* args) {
|
||||
ui::Clipboard* clipboard = ui::Clipboard::GetForCurrentThread();
|
||||
SkBitmap bitmap = clipboard->ReadImage(GetClipboardType(args));
|
||||
SkBitmap bitmap = clipboard->ReadImage(GetClipboardBuffer(args));
|
||||
return gfx::Image::CreateFrom1xBitmap(bitmap);
|
||||
}
|
||||
|
||||
void Clipboard::WriteImage(const gfx::Image& image, mate::Arguments* args) {
|
||||
ui::ScopedClipboardWriter writer(GetClipboardType(args));
|
||||
ui::ScopedClipboardWriter writer(GetClipboardBuffer(args));
|
||||
SkBitmap orig = image.AsBitmap();
|
||||
SkBitmap bmp;
|
||||
|
||||
|
@ -189,7 +190,7 @@ base::string16 Clipboard::ReadFindText() {
|
|||
#endif
|
||||
|
||||
void Clipboard::Clear(mate::Arguments* args) {
|
||||
ui::Clipboard::GetForCurrentThread()->Clear(GetClipboardType(args));
|
||||
ui::Clipboard::GetForCurrentThread()->Clear(GetClipboardBuffer(args));
|
||||
}
|
||||
|
||||
} // namespace api
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace api {
|
|||
|
||||
class Clipboard {
|
||||
public:
|
||||
static ui::ClipboardType GetClipboardType(mate::Arguments* args);
|
||||
static ui::ClipboardBuffer GetClipboardBuffer(mate::Arguments* args);
|
||||
static std::vector<base::string16> AvailableFormats(mate::Arguments* args);
|
||||
static bool Has(const std::string& format_string, mate::Arguments* args);
|
||||
static void Clear(mate::Arguments* args);
|
||||
|
|
|
@ -62,13 +62,13 @@ int Main(std::vector<char*>* args) {
|
|||
base::FilePath operating_dir(
|
||||
cmd_line->GetSwitchValueNative(crash_reporter::kCrashesDirectoryKey));
|
||||
CreateCrashServiceDirectory(operating_dir);
|
||||
base::FilePath log_file = operating_dir.Append(kStandardLogFile);
|
||||
base::FilePath log_file_path = operating_dir.Append(kStandardLogFile);
|
||||
|
||||
// Logging to stderr (to help with debugging failures on the
|
||||
// buildbots) and to a file.
|
||||
logging::LoggingSettings settings;
|
||||
settings.logging_dest = logging::LOG_TO_ALL;
|
||||
settings.log_file = log_file.value().c_str();
|
||||
settings.log_file_path = log_file_path.value().c_str();
|
||||
logging::InitLogging(settings);
|
||||
// Logging with pid, tid and timestamp.
|
||||
logging::SetLogItems(true, true, true, false);
|
||||
|
|
|
@ -6,10 +6,9 @@
|
|||
#define SHELL_COMMON_GIN_CONVERTERS_FILE_PATH_CONVERTER_H_
|
||||
|
||||
#include "base/files/file_path.h"
|
||||
#include "shell/common/gin_converters/string16_converter.h"
|
||||
#include "gin/converter.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<base::FilePath> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
|
@ -22,6 +21,12 @@ struct Converter<base::FilePath> {
|
|||
if (val->IsNull())
|
||||
return true;
|
||||
|
||||
v8::String::Value str(isolate, val);
|
||||
if (str.length() == 0) {
|
||||
*out = base::FilePath();
|
||||
return true;
|
||||
}
|
||||
|
||||
base::FilePath::StringType path;
|
||||
if (Converter<base::FilePath::StringType>::FromV8(isolate, val, &path)) {
|
||||
*out = base::FilePath(path);
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include "base/strings/string_number_conversions.h"
|
||||
#include "base/strings/string_util.h"
|
||||
#include "base/values.h"
|
||||
#include "gin/converter.h"
|
||||
#include "gin/dictionary.h"
|
||||
#include "net/base/upload_bytes_element_reader.h"
|
||||
#include "net/base/upload_data_stream.h"
|
||||
|
@ -23,7 +24,6 @@
|
|||
#include "services/network/public/cpp/resource_request.h"
|
||||
#include "shell/common/gin_converters/gurl_converter.h"
|
||||
#include "shell/common/gin_converters/std_converter.h"
|
||||
#include "shell/common/gin_converters/string16_converter.h"
|
||||
#include "shell/common/gin_converters/value_converter_gin_adapter.h"
|
||||
#include "shell/common/node_includes.h"
|
||||
|
||||
|
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (c) 2019 GitHub, Inc.
|
||||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef SHELL_COMMON_GIN_CONVERTERS_STRING16_CONVERTER_H_
|
||||
#define SHELL_COMMON_GIN_CONVERTERS_STRING16_CONVERTER_H_
|
||||
|
||||
#include "base/strings/string16.h"
|
||||
#include "gin/converter.h"
|
||||
|
||||
namespace gin {
|
||||
|
||||
template <>
|
||||
struct Converter<base::string16> {
|
||||
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
|
||||
const base::string16& val) {
|
||||
return v8::String::NewFromTwoByte(
|
||||
isolate, reinterpret_cast<const uint16_t*>(val.data()),
|
||||
v8::NewStringType::kNormal, val.size())
|
||||
.ToLocalChecked();
|
||||
}
|
||||
static bool FromV8(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> val,
|
||||
base::string16* out) {
|
||||
if (!val->IsString())
|
||||
return false;
|
||||
|
||||
v8::String::Value s(isolate, val);
|
||||
out->assign(reinterpret_cast<const base::char16*>(*s), s.length());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
inline v8::Local<v8::String> StringToV8(v8::Isolate* isolate,
|
||||
const base::string16& input) {
|
||||
return ConvertToV8(isolate, input).As<v8::String>();
|
||||
}
|
||||
|
||||
} // namespace gin
|
||||
|
||||
#endif // SHELL_COMMON_GIN_CONVERTERS_STRING16_CONVERTER_H_
|
|
@ -417,7 +417,7 @@ v8::Local<v8::Value> EditFlagsToV8(v8::Isolate* isolate, int editFlags) {
|
|||
std::vector<base::string16> types;
|
||||
bool ignore;
|
||||
ui::Clipboard::GetForCurrentThread()->ReadAvailableTypes(
|
||||
ui::ClipboardType::kCopyPaste, &types, &ignore);
|
||||
ui::ClipboardBuffer::kCopyPaste, &types, &ignore);
|
||||
pasteFlag = !types.empty();
|
||||
}
|
||||
dict.Set("canPaste", pasteFlag);
|
||||
|
|
|
@ -5,8 +5,8 @@
|
|||
#ifndef SHELL_COMMON_NATIVE_MATE_CONVERTERS_STRING16_CONVERTER_H_
|
||||
#define SHELL_COMMON_NATIVE_MATE_CONVERTERS_STRING16_CONVERTER_H_
|
||||
|
||||
#include "gin/converter.h"
|
||||
#include "native_mate/converter.h"
|
||||
#include "shell/common/gin_converters/string16_converter.h"
|
||||
|
||||
namespace mate {
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "services/service_manager/sandbox/switches.h"
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
#include "components/services/pdf_compositor/public/cpp/pdf_compositor_service_factory.h"
|
||||
#include "components/services/pdf_compositor/pdf_compositor_impl.h"
|
||||
#include "components/services/pdf_compositor/public/mojom/pdf_compositor.mojom.h"
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
@ -36,13 +36,6 @@ namespace electron {
|
|||
|
||||
namespace {
|
||||
|
||||
void RunServiceAsyncThenTerminateProcess(
|
||||
std::unique_ptr<service_manager::Service> service) {
|
||||
service_manager::Service::RunAsyncUntilTermination(
|
||||
std::move(service),
|
||||
base::BindOnce([] { content::UtilityThread::Get()->ReleaseProcess(); }));
|
||||
}
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)
|
||||
auto RunPrintingService(
|
||||
mojo::PendingReceiver<printing::mojom::PrintingService> receiver) {
|
||||
|
@ -50,6 +43,15 @@ auto RunPrintingService(
|
|||
}
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
auto RunPdfCompositor(
|
||||
mojo::PendingReceiver<printing::mojom::PdfCompositor> receiver) {
|
||||
return std::make_unique<printing::PdfCompositorImpl>(
|
||||
std::move(receiver), true /* initialize_environment */,
|
||||
content::UtilityThread::Get()->GetIOTaskRunner());
|
||||
}
|
||||
#endif
|
||||
|
||||
auto RunProxyResolver(
|
||||
mojo::PendingReceiver<proxy_resolver::mojom::ProxyResolverFactory>
|
||||
receiver) {
|
||||
|
@ -114,22 +116,13 @@ bool AtomContentUtilityClient::OnMessageReceived(const IPC::Message& message) {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool AtomContentUtilityClient::HandleServiceRequest(
|
||||
const std::string& service_name,
|
||||
service_manager::mojom::ServiceRequest request) {
|
||||
auto service = MaybeCreateMainThreadService(service_name, std::move(request));
|
||||
if (service) {
|
||||
RunServiceAsyncThenTerminateProcess(std::move(service));
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
mojo::ServiceFactory* AtomContentUtilityClient::GetMainThreadServiceFactory() {
|
||||
static base::NoDestructor<mojo::ServiceFactory> factory {
|
||||
#if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)
|
||||
RunPrintingService
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
RunPdfCompositor,
|
||||
#if defined(OS_WIN)
|
||||
RunPrintingService
|
||||
#endif
|
||||
#endif
|
||||
};
|
||||
return factory.get();
|
||||
|
@ -140,17 +133,4 @@ mojo::ServiceFactory* AtomContentUtilityClient::GetIOThreadServiceFactory() {
|
|||
return factory.get();
|
||||
}
|
||||
|
||||
std::unique_ptr<service_manager::Service>
|
||||
AtomContentUtilityClient::MaybeCreateMainThreadService(
|
||||
const std::string& service_name,
|
||||
service_manager::mojom::ServiceRequest request) {
|
||||
#if BUILDFLAG(ENABLE_PRINTING)
|
||||
if (service_name == printing::mojom::kServiceName) {
|
||||
return printing::CreatePdfCompositorService(std::move(request));
|
||||
}
|
||||
#endif
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace electron
|
||||
|
|
|
@ -26,16 +26,10 @@ class AtomContentUtilityClient : public content::ContentUtilityClient {
|
|||
|
||||
void UtilityThreadStarted() override;
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
bool HandleServiceRequest(
|
||||
const std::string& service_name,
|
||||
service_manager::mojom::ServiceRequest request) override;
|
||||
mojo::ServiceFactory* GetMainThreadServiceFactory() override;
|
||||
mojo::ServiceFactory* GetIOThreadServiceFactory() override;
|
||||
|
||||
private:
|
||||
std::unique_ptr<service_manager::Service> MaybeCreateMainThreadService(
|
||||
const std::string& service_name,
|
||||
service_manager::mojom::ServiceRequest request);
|
||||
#if BUILDFLAG(ENABLE_PRINTING) && defined(OS_WIN)
|
||||
std::unique_ptr<printing::PrintingHandler> printing_handler_;
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue