
* Update to Chromium 68.0.3440.128 and Node 10.10.0
* update v8, ffmpeg, chromium, crashpad, boringssl, and webrtc patches
* fix SSL_get_tlsext_status_type patch
* pass encryption_modes_supported to CdmInfo
* kNoSandbox moved into service_manager
* bump CHROME_VERSION_STRING
TODO: automatically pull in the real chrome version
* PathService -> base::PathService
* net::X509Certificate::Equals -> net::X509Certificate::EqualsExcludingChain
* use content::ChildProcessTerminationInfo
* GetHandle() -> GetProcess().Handle()
* ScopedNestableTaskAllower doesn't take an argument
* net::HttpAuthCache::ClearEntriesAddedWithin -> ClearAllEntries
* std::unique_ptr<WebContents>
* blink::WebFullscreenOptions
* OnAudioStateChanged doesn't take a WebContents
* content::RESULT_CODE_NORMAL_EXIT -> service_manager::RESULT_CODE_NORMAL_EXIT
* MessageLoopCurrent
* WasResized -> SynchronizeVisualProperties
* SetTimeStamp takes a base::TimeTicks
* ExecuteScriptInIsolatedWorld is single-script only
* DispatchNonPersistentCloseEvent takes a callback now
* expose URLRequestContextGetter::{Add,Remove}Observer
* test: remove no longer existing Chromium test deps
cc_blink_unittests has been removed in
https://chromium-review.googlesource.com/1053765
mojo_common_unittests has been removed in
https://chromium-review.googlesource.com/1028000
* SetFdLimit -> IncreaseFdLimitTo
NOTE: the behaviour of this API has changed slightly, and we should
mention that in the notes.
* MessageLoop::QuitWhenIdleClosure -> RunLoop::QuitCurrentWhenIdleClosureDeprecated
* certificate_transparency moved out of net/
pending a clearer decision about what to do with CT
in the mean time, copy CreateLogVerifiersForKnownLogs from deleted chromium source
* add secure_origin_whitelist to chrome source list
NOTE: is this something we actually want? cc @deepak1556
* DrainBackgroundTasks -> DrainTasks
* use new node options parser
* fix disable_scroll_begin_dcheck.patch
* ViewsDelegate::CreateWebContents went away
see 1031314
* kZygoteProcess moved into service_manager
* test: minor improvements to the Node spec
- reformat some parts
- better failures reporting with `expect`
- skip some tests instead of marking them as passed
* chromium removed *_posix.cc from the source filters
* test: fix :electron_tests compilation
* better crash diagnostics in ffmpeg test
* fix: enable back a DCHECK in viz::ServerSharedBitmapManager
Fixes #14327.
Backports https://chromium-review.googlesource.com/802574.
* chore: update linux sysroots
* chore: remove obsolete "install-sysroot.py" script
* test: fix frame-subscriber test on Mac
* disable OSR for now
* test: make before-input-event test more robust
* test: make run-as-node --inspect test more robust on windows
* roll node to v10.11.0
* avoid duplicate files when building a zip
* disable failing assert in beginFrameSubscription dirty-rectangle test
* experiment with is_cfi = false
* fix: build torque with x64 toolchain
Co-Authored-By: Alexey Kuzmin <github@alexeykuzmin.com>
* test: disable the "app.relaunch" test on Linux
* chore: bump node to get header tar file
* chore: bump node to fix tar.py line endings
203 lines
7.6 KiB
C++
203 lines
7.6 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 ATOM_BROWSER_COMMON_WEB_CONTENTS_DELEGATE_H_
|
|
#define ATOM_BROWSER_COMMON_WEB_CONTENTS_DELEGATE_H_
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "brightray/browser/inspectable_web_contents_delegate.h"
|
|
#include "brightray/browser/inspectable_web_contents_impl.h"
|
|
#include "brightray/browser/inspectable_web_contents_view_delegate.h"
|
|
#include "chrome/browser/devtools/devtools_file_system_indexer.h"
|
|
#include "content/public/browser/web_contents_delegate.h"
|
|
|
|
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
|
|
#include "atom/browser/ui/autofill_popup.h"
|
|
#endif
|
|
|
|
namespace base {
|
|
class SequencedTaskRunner;
|
|
}
|
|
|
|
namespace atom {
|
|
|
|
class AtomBrowserContext;
|
|
class NativeWindow;
|
|
class WebDialogHelper;
|
|
|
|
class CommonWebContentsDelegate
|
|
: public content::WebContentsDelegate,
|
|
public brightray::InspectableWebContentsDelegate,
|
|
public brightray::InspectableWebContentsViewDelegate {
|
|
public:
|
|
CommonWebContentsDelegate();
|
|
~CommonWebContentsDelegate() override;
|
|
|
|
// Creates a InspectableWebContents object and takes onwership of
|
|
// |web_contents|.
|
|
void InitWithWebContents(content::WebContents* web_contents,
|
|
AtomBrowserContext* browser_context,
|
|
bool is_guest);
|
|
|
|
// Set the window as owner window.
|
|
void SetOwnerWindow(NativeWindow* owner_window);
|
|
void SetOwnerWindow(content::WebContents* web_contents,
|
|
NativeWindow* owner_window);
|
|
|
|
// Returns the WebContents managed by this delegate.
|
|
content::WebContents* GetWebContents() const;
|
|
|
|
// Returns the WebContents of devtools.
|
|
content::WebContents* GetDevToolsWebContents() const;
|
|
|
|
brightray::InspectableWebContents* managed_web_contents() const {
|
|
return web_contents_.get();
|
|
}
|
|
|
|
NativeWindow* owner_window() const { return owner_window_.get(); }
|
|
|
|
bool is_html_fullscreen() const { return html_fullscreen_; }
|
|
|
|
protected:
|
|
// content::WebContentsDelegate:
|
|
content::WebContents* OpenURLFromTab(
|
|
content::WebContents* source,
|
|
const content::OpenURLParams& params) override;
|
|
bool CanOverscrollContent() const override;
|
|
content::ColorChooser* OpenColorChooser(
|
|
content::WebContents* web_contents,
|
|
SkColor color,
|
|
const std::vector<blink::mojom::ColorSuggestionPtr>& suggestions)
|
|
override;
|
|
void RunFileChooser(content::RenderFrameHost* render_frame_host,
|
|
const content::FileChooserParams& params) override;
|
|
void EnumerateDirectory(content::WebContents* web_contents,
|
|
int request_id,
|
|
const base::FilePath& path) override;
|
|
void EnterFullscreenModeForTab(
|
|
content::WebContents* source,
|
|
const GURL& origin,
|
|
const blink::WebFullscreenOptions& options) override;
|
|
void ExitFullscreenModeForTab(content::WebContents* source) override;
|
|
bool IsFullscreenForTabOrPending(
|
|
const content::WebContents* source) const override;
|
|
blink::WebSecurityStyle GetSecurityStyle(
|
|
content::WebContents* web_contents,
|
|
content::SecurityStyleExplanations* explanations) override;
|
|
void HandleKeyboardEvent(
|
|
content::WebContents* source,
|
|
const content::NativeWebKeyboardEvent& event) override;
|
|
|
|
// Autofill related events.
|
|
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
|
|
void ShowAutofillPopup(content::RenderFrameHost* frame_host,
|
|
content::RenderFrameHost* embedder_frame_host,
|
|
bool offscreen,
|
|
const gfx::RectF& bounds,
|
|
const std::vector<base::string16>& values,
|
|
const std::vector<base::string16>& labels);
|
|
void HideAutofillPopup();
|
|
#endif
|
|
|
|
// brightray::InspectableWebContentsDelegate:
|
|
void DevToolsSaveToFile(const std::string& url,
|
|
const std::string& content,
|
|
bool save_as) override;
|
|
void DevToolsAppendToFile(const std::string& url,
|
|
const std::string& content) override;
|
|
void DevToolsRequestFileSystems() override;
|
|
void DevToolsAddFileSystem(const std::string& type,
|
|
const base::FilePath& file_system_path) override;
|
|
void DevToolsRemoveFileSystem(
|
|
const base::FilePath& file_system_path) override;
|
|
void DevToolsIndexPath(int request_id,
|
|
const std::string& file_system_path,
|
|
const std::string& excluded_folders_message) override;
|
|
void DevToolsStopIndexing(int request_id) override;
|
|
void DevToolsSearchInPath(int request_id,
|
|
const std::string& file_system_path,
|
|
const std::string& query) override;
|
|
|
|
// brightray::InspectableWebContentsViewDelegate:
|
|
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
|
|
gfx::ImageSkia GetDevToolsWindowIcon() override;
|
|
#endif
|
|
#if defined(USE_X11)
|
|
void GetDevToolsWindowWMClass(std::string* name,
|
|
std::string* class_name) override;
|
|
#endif
|
|
|
|
// Destroy the managed InspectableWebContents object.
|
|
void ResetManagedWebContents(bool async);
|
|
|
|
private:
|
|
// DevTools index event callbacks.
|
|
void OnDevToolsIndexingWorkCalculated(int request_id,
|
|
const std::string& file_system_path,
|
|
int total_work);
|
|
void OnDevToolsIndexingWorked(int request_id,
|
|
const std::string& file_system_path,
|
|
int worked);
|
|
void OnDevToolsIndexingDone(int request_id,
|
|
const std::string& file_system_path);
|
|
void OnDevToolsSearchCompleted(int request_id,
|
|
const std::string& file_system_path,
|
|
const std::vector<std::string>& file_paths);
|
|
|
|
// Set fullscreen mode triggered by html api.
|
|
void SetHtmlApiFullscreen(bool enter_fullscreen);
|
|
|
|
// The window that this WebContents belongs to.
|
|
base::WeakPtr<NativeWindow> owner_window_;
|
|
|
|
bool offscreen_ = false;
|
|
|
|
// Whether window is fullscreened by HTML5 api.
|
|
bool html_fullscreen_ = false;
|
|
|
|
// Whether window is fullscreened by window api.
|
|
bool native_fullscreen_ = false;
|
|
|
|
// UI related helper classes.
|
|
#if defined(TOOLKIT_VIEWS) && !defined(OS_MACOSX)
|
|
std::unique_ptr<AutofillPopup> autofill_popup_;
|
|
#endif
|
|
std::unique_ptr<WebDialogHelper> web_dialog_helper_;
|
|
|
|
scoped_refptr<DevToolsFileSystemIndexer> devtools_file_system_indexer_;
|
|
|
|
// Make sure BrowserContext is alwasys destroyed after WebContents.
|
|
scoped_refptr<AtomBrowserContext> browser_context_;
|
|
|
|
// The stored InspectableWebContents object.
|
|
// Notice that web_contents_ must be placed after dialog_manager_, so we can
|
|
// make sure web_contents_ is destroyed before dialog_manager_, otherwise a
|
|
// crash would happen.
|
|
std::unique_ptr<brightray::InspectableWebContents> web_contents_;
|
|
|
|
// Maps url to file path, used by the file requests sent from devtools.
|
|
typedef std::map<std::string, base::FilePath> PathsMap;
|
|
PathsMap saved_files_;
|
|
|
|
// Map id to index job, used for file system indexing requests from devtools.
|
|
typedef std::
|
|
map<int, scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob>>
|
|
DevToolsIndexingJobsMap;
|
|
DevToolsIndexingJobsMap devtools_indexing_jobs_;
|
|
|
|
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
|
|
|
|
base::WeakPtrFactory<CommonWebContentsDelegate> weak_factory_;
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CommonWebContentsDelegate);
|
|
};
|
|
|
|
} // namespace atom
|
|
|
|
#endif // ATOM_BROWSER_COMMON_WEB_CONTENTS_DELEGATE_H_
|