mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Compare commits
23 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
c3988e90bb | ||
|
442c6008f9 | ||
|
d008a99a60 | ||
|
e7de5c3d91 | ||
|
85b7cdfa58 | ||
|
f316e3d072 | ||
|
cbc1c5b766 | ||
|
5aac06d3fe | ||
|
0556b3019a | ||
|
a076956043 | ||
|
95d37ffb05 | ||
|
aa21e05ef5 | ||
|
81c1144af1 | ||
|
f9c2d00bf2 | ||
|
cf8c6b2e4c | ||
|
9f9c3933ba | ||
|
326fa6594a | ||
|
52aa456302 | ||
|
98006e1d14 | ||
|
d6b6801d33 | ||
|
2b6e40a822 | ||
|
ee5de71957 | ||
|
d336310385 |
@@ -7,5 +7,6 @@
|
||||
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
|
||||
|
||||
{
|
||||
'chromium_checkout': 'refs/tags/135.0.7049.0'
|
||||
'chromium_checkout': 'refs/tags/135.0.7049.115',
|
||||
'depot_tools_checkout': '6678906cf8'
|
||||
}
|
||||
|
@@ -313,6 +313,30 @@
|
||||
#define STACK_UNINITIALIZED
|
||||
#endif
|
||||
|
||||
// Attribute "no_stack_protector" disables -fstack-protector for the specified
|
||||
// function.
|
||||
//
|
||||
// "stack_protector" is enabled on most POSIX builds. The flag adds a canary
|
||||
// to each stack frame, which on function return is checked against a reference
|
||||
// canary. If the canaries do not match, it's likely that a stack buffer
|
||||
// overflow has occurred, so immediately crashing will prevent exploitation in
|
||||
// many cases.
|
||||
//
|
||||
// In some cases it's desirable to remove this, e.g. on hot functions, or if
|
||||
// we have purposely changed the reference canary.
|
||||
//
|
||||
// On Linux systems the reference canary will be purposely changed when forking
|
||||
// sub-processes (see https://crbug.com/40181003). To avoid sub-process shutdown
|
||||
// crashes the NO_STACK_PROTECTOR annotation must be added to all functions in
|
||||
// the call stack leading to CefExecuteProcess(). Applications that cannot add
|
||||
// this annotation must instead pass the `--change-stack-guard-on-fork=disable`
|
||||
// command-line flag.
|
||||
#if defined(COMPILER_GCC) || defined(__clang__)
|
||||
#define NO_STACK_PROTECTOR __attribute__((no_stack_protector))
|
||||
#else
|
||||
#define NO_STACK_PROTECTOR
|
||||
#endif
|
||||
|
||||
// The ANALYZER_ASSUME_TRUE(bool arg) macro adds compiler-specific hints
|
||||
// to Clang which control what code paths are statically analyzed,
|
||||
// and is meant to be used in conjunction with assert & assert-like functions.
|
||||
|
@@ -59,7 +59,7 @@ class CefApp;
|
||||
/// |windows_sandbox_info| parameter is only used on Windows and may be NULL
|
||||
/// (see cef_sandbox_win.h for details).
|
||||
///
|
||||
/*--cef(api_hash_check,optional_param=application,
|
||||
/*--cef(api_hash_check,no_stack_protector,optional_param=application,
|
||||
optional_param=windows_sandbox_info)--*/
|
||||
int CefExecuteProcess(const CefMainArgs& args,
|
||||
CefRefPtr<CefApp> application,
|
||||
|
@@ -249,7 +249,7 @@ class CefPdfPrintCallback : public virtual CefBaseRefCounted {
|
||||
/// is the output path. |ok| will be true if the printing completed
|
||||
/// successfully or false otherwise.
|
||||
///
|
||||
/*--cef()--*/
|
||||
/*--cef(optional_param=path)--*/
|
||||
virtual void OnPdfPrintFinished(const CefString& path, bool ok) = 0;
|
||||
};
|
||||
|
||||
|
@@ -901,29 +901,6 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetAudioMuted,
|
||||
this, mute));
|
||||
return;
|
||||
}
|
||||
if (!web_contents()) {
|
||||
return;
|
||||
}
|
||||
web_contents()->SetAudioMuted(mute);
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::IsAudioMuted() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
if (!web_contents()) {
|
||||
return false;
|
||||
}
|
||||
return web_contents()->IsAudioMuted();
|
||||
}
|
||||
|
||||
// content::WebContentsDelegate methods.
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
@@ -1057,14 +1034,7 @@ void AlloyBrowserHostImpl::BeforeUnloadFired(content::WebContents* source,
|
||||
|
||||
bool AlloyBrowserHostImpl::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
|
||||
if (handler.get()) {
|
||||
handler->OnTakeFocus(this, !reverse);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
return contents_delegate_.TakeFocus(source, reverse);
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::CanDownload(
|
||||
|
@@ -115,8 +115,6 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
|
||||
void DragTargetDrop(const CefMouseEvent& event) override;
|
||||
void DragSourceSystemDragEnded() override;
|
||||
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
|
@@ -629,6 +629,17 @@ void CefBrowserContentsDelegate::OnFocusChangedInPage(
|
||||
details->is_editable_node;
|
||||
}
|
||||
|
||||
bool CefBrowserContentsDelegate::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
if (auto c = client()) {
|
||||
if (auto handler = c->GetFocusHandler()) {
|
||||
handler->OnTakeFocus(browser(), !reverse);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserContentsDelegate::WebContentsDestroyed() {
|
||||
auto wc = web_contents();
|
||||
ObserveWebContents(nullptr);
|
||||
|
@@ -144,6 +144,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
|
||||
void OnWebContentsFocused(
|
||||
content::RenderWidgetHost* render_widget_host) override;
|
||||
void OnFocusChangedInPage(content::FocusedNodeDetails* details) override;
|
||||
bool TakeFocus(content::WebContents* source, bool reverse) override;
|
||||
void WebContentsDestroyed() override;
|
||||
|
||||
// Accessors for state information. Changes will be signaled to
|
||||
|
@@ -783,6 +783,28 @@ CefRefPtr<CefNavigationEntry> CefBrowserHostBase::GetVisibleNavigationEntry() {
|
||||
return new CefNavigationEntryImpl(entry);
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::SetAudioMuted(bool mute) {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&CefBrowserHostBase::SetAudioMuted,
|
||||
this, mute));
|
||||
return;
|
||||
}
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
web_contents->SetAudioMuted(mute);
|
||||
}
|
||||
}
|
||||
|
||||
bool CefBrowserHostBase::IsAudioMuted() {
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
DCHECK(false) << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
if (auto web_contents = GetWebContents()) {
|
||||
return web_contents->IsAudioMuted();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::NotifyMoveOrResizeStarted() {
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
|
||||
if (!CEF_CURRENTLY_ON_UIT()) {
|
||||
@@ -1398,6 +1420,19 @@ CefDevToolsWindowRunner* CefBrowserHostBase::GetDevToolsWindowRunner() {
|
||||
return devtools_window_runner_.get();
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::set_context_menu_observer(
|
||||
RenderViewContextMenuObserver* observer) {
|
||||
context_menu_observer_ = observer;
|
||||
}
|
||||
|
||||
void CefBrowserHostBase::clear_context_menu_observer(
|
||||
RenderViewContextMenuObserver* observer) {
|
||||
// Don't clear if a new Observer has already been assigned.
|
||||
if (context_menu_observer_ == observer) {
|
||||
context_menu_observer_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
views::Widget* CefBrowserHostBase::GetWindowWidget() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!platform_delegate_) {
|
||||
|
@@ -262,6 +262,8 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
void GetNavigationEntries(CefRefPtr<CefNavigationEntryVisitor> visitor,
|
||||
bool current_only) override;
|
||||
CefRefPtr<CefNavigationEntry> GetVisibleNavigationEntry() override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void NotifyMoveOrResizeStarted() override;
|
||||
bool IsFullscreen() override;
|
||||
void ExitFullscreen(bool will_cause_resize) override;
|
||||
@@ -390,9 +392,8 @@ class CefBrowserHostBase : public CefBrowserHost,
|
||||
RenderViewContextMenuObserver* context_menu_observer() const {
|
||||
return context_menu_observer_;
|
||||
}
|
||||
void set_context_menu_observer(RenderViewContextMenuObserver* observer) {
|
||||
context_menu_observer_ = observer;
|
||||
}
|
||||
void set_context_menu_observer(RenderViewContextMenuObserver* observer);
|
||||
void clear_context_menu_observer(RenderViewContextMenuObserver* observer);
|
||||
|
||||
// Returns the Widget owner for the browser window. Only used with windowed
|
||||
// browsers.
|
||||
|
@@ -476,6 +476,14 @@ void ChromeBrowserDelegate::DraggableRegionsChanged(
|
||||
}
|
||||
}
|
||||
|
||||
bool ChromeBrowserDelegate::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
if (auto delegate = GetDelegateForWebContents(source)) {
|
||||
return delegate->TakeFocus(source, reverse);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserDelegate::WindowFullscreenStateChanged() {
|
||||
// Use a synchronous callback for notification on Windows/Linux. MacOS gets
|
||||
// notified asynchronously via CefNativeWidgetMac callbacks.
|
||||
|
@@ -127,6 +127,7 @@ class ChromeBrowserDelegate : public cef::BrowserDelegate {
|
||||
void DraggableRegionsChanged(
|
||||
const std::vector<blink::mojom::DraggableRegionPtr>& regions,
|
||||
content::WebContents* contents) override;
|
||||
bool TakeFocus(content::WebContents* source, bool reverse) override;
|
||||
|
||||
Browser* browser() const { return browser_; }
|
||||
|
||||
|
@@ -327,15 +327,6 @@ void ChromeBrowserHostImpl::DragSourceEndedAt(int x,
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
NOTIMPLEMENTED();
|
||||
}
|
||||
|
||||
bool ChromeBrowserHostImpl::IsAudioMuted() {
|
||||
NOTIMPLEMENTED();
|
||||
return false;
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) {
|
||||
|
@@ -109,8 +109,6 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
|
||||
void DragTargetDrop(const CefMouseEvent& event) override;
|
||||
void DragSourceSystemDragEnded() override;
|
||||
void DragSourceEndedAt(int x, int y, DragOperationsMask op) override;
|
||||
void SetAudioMuted(bool mute) override;
|
||||
bool IsAudioMuted() override;
|
||||
void SetAutoResizeEnabled(bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) override;
|
||||
|
@@ -132,7 +132,7 @@ void HandleExternalProtocolHelper(
|
||||
ChromeContentBrowserClientCef* self,
|
||||
content::WebContents::Getter web_contents_getter,
|
||||
content::FrameTreeNodeId frame_tree_node_id,
|
||||
content::NavigationUIData* navigation_data,
|
||||
std::unique_ptr<content::NavigationUIData> navigation_data,
|
||||
bool is_primary_main_frame,
|
||||
bool is_in_fenced_frame_tree,
|
||||
network::mojom::WebSandboxFlags sandbox_flags,
|
||||
@@ -153,7 +153,7 @@ void HandleExternalProtocolHelper(
|
||||
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||
self->HandleExternalProtocol(
|
||||
resource_request.url, web_contents_getter, frame_tree_node_id,
|
||||
navigation_data, is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
navigation_data.get(), is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
sandbox_flags,
|
||||
static_cast<ui::PageTransition>(resource_request.transition_type),
|
||||
resource_request.has_user_gesture, initiating_origin, initiator_rfh,
|
||||
@@ -544,10 +544,10 @@ bool ChromeContentBrowserClientCef::HandleExternalProtocol(
|
||||
web_contents_getter, frame_tree_node_id, request,
|
||||
base::BindRepeating(HandleExternalProtocolHelper, base::Unretained(this),
|
||||
web_contents_getter, frame_tree_node_id,
|
||||
navigation_data, is_primary_main_frame,
|
||||
is_in_fenced_frame_tree, sandbox_flags, request,
|
||||
initiating_origin, std::move(weak_initiator_document),
|
||||
isolation_info));
|
||||
base::Passed(navigation_data->Clone()),
|
||||
is_primary_main_frame, is_in_fenced_frame_tree,
|
||||
sandbox_flags, request, initiating_origin,
|
||||
std::move(weak_initiator_document), isolation_info));
|
||||
|
||||
net_service::ProxyURLLoaderFactory::CreateProxy(
|
||||
web_contents_getter, std::move(receiver), std::move(request_handler));
|
||||
|
@@ -82,7 +82,8 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
CefRefPtr<CefBrowserHostBase> browser,
|
||||
CefRefPtr<CefContextMenuHandler> handler)
|
||||
: context_menu_(context_menu), browser_(browser), handler_(handler) {
|
||||
// This remains valid until the next time a context menu is created.
|
||||
// Association remains valid until the next time a context menu is created,
|
||||
// or this Observer is destroyed.
|
||||
browser_->set_context_menu_observer(this);
|
||||
}
|
||||
|
||||
@@ -163,6 +164,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
|
||||
// Clear stored state because this object won't be deleted until a new
|
||||
// context menu is created or the associated browser is destroyed.
|
||||
browser_->clear_context_menu_observer(this);
|
||||
browser_ = nullptr;
|
||||
handler_ = nullptr;
|
||||
params_ = nullptr;
|
||||
|
@@ -291,6 +291,7 @@ int RunMainWithPreferredStackSize(FiberState& fiber_state) {
|
||||
|
||||
} // namespace
|
||||
|
||||
NO_STACK_PROTECTOR
|
||||
int CefExecuteProcess(const CefMainArgs& args,
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info) {
|
||||
|
@@ -206,6 +206,7 @@ void CefMainRunner::QuitMessageLoop() {
|
||||
}
|
||||
|
||||
// static
|
||||
NO_STACK_PROTECTOR
|
||||
int CefMainRunner::RunAsHelperProcess(const CefMainArgs& args,
|
||||
CefRefPtr<CefApp> application,
|
||||
void* windows_sandbox_info) {
|
||||
|
@@ -215,8 +215,10 @@ class CefMediaAccessQuery {
|
||||
content::DesktopMediaID(content::DesktopMediaID::TYPE_SCREEN,
|
||||
-1 /* webrtc::kFullDesktopScreenId */);
|
||||
}
|
||||
video_devices.emplace_back(request_.video_type, media_id.ToString(),
|
||||
"Screen");
|
||||
if (media_id.type != content::DesktopMediaID::TYPE_NONE) {
|
||||
video_devices.emplace_back(request_.video_type, media_id.ToString(),
|
||||
"Screen");
|
||||
}
|
||||
}
|
||||
|
||||
blink::mojom::StreamDevicesSetPtr stream_devices_set =
|
||||
|
@@ -20,6 +20,12 @@
|
||||
#include "content/public/browser/render_widget_host_view.h"
|
||||
#include "third_party/blink/public/mojom/context_menu/context_menu.mojom.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "chrome/browser/spellchecker/spellcheck_factory.h"
|
||||
#include "chrome/browser/spellchecker/spellcheck_service.h"
|
||||
#include "components/spellcheck/browser/spellcheck_platform.h"
|
||||
#endif
|
||||
|
||||
namespace {
|
||||
|
||||
CefString GetLabel(int message_id) {
|
||||
@@ -120,8 +126,8 @@ bool CefMenuManager::IsShowingContextMenu() {
|
||||
return web_contents()->IsShowingContextMenu();
|
||||
}
|
||||
|
||||
bool CefMenuManager::CreateContextMenu(
|
||||
const content::ContextMenuParams& params) {
|
||||
bool CefMenuManager::CreateContextMenu(const content::ContextMenuParams& params,
|
||||
bool query_spellcheck) {
|
||||
// The renderer may send the "show context menu" message multiple times, one
|
||||
// for each right click mouse event it receives. Normally, this doesn't happen
|
||||
// because mouse events are not forwarded once the context menu is showing.
|
||||
@@ -134,6 +140,24 @@ bool CefMenuManager::CreateContextMenu(
|
||||
}
|
||||
|
||||
params_ = params;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
// System spellcheck suggestions need to be queried asynchronously.
|
||||
if (query_spellcheck && !params_.misspelled_word.empty() &&
|
||||
params_.dictionary_suggestions.empty()) {
|
||||
SpellcheckService* spellcheck_service =
|
||||
SpellcheckServiceFactory::GetForContext(
|
||||
browser_->web_contents()->GetBrowserContext());
|
||||
if (spellcheck_service) {
|
||||
spellcheck_platform::GetPerLanguageSuggestions(
|
||||
spellcheck_service->platform_spell_checker(), params_.misspelled_word,
|
||||
base::BindOnce(&CefMenuManager::OnGetPlatformSuggestionsComplete,
|
||||
weak_ptr_factory_.GetWeakPtr()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
#endif
|
||||
|
||||
model_->Clear();
|
||||
|
||||
// Create the default menu model.
|
||||
@@ -511,3 +535,18 @@ bool CefMenuManager::IsCustomContextMenuCommand(int command_id) {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
void CefMenuManager::OnGetPlatformSuggestionsComplete(
|
||||
const spellcheck::PerLanguageSuggestions&
|
||||
platform_per_language_suggestions) {
|
||||
std::vector<std::u16string> combined_suggestions;
|
||||
spellcheck::FillSuggestions(platform_per_language_suggestions,
|
||||
&combined_suggestions);
|
||||
|
||||
params_.dictionary_suggestions = combined_suggestions;
|
||||
|
||||
// Now that we have spelling suggestions, call CreateContextMenu again.
|
||||
CreateContextMenu(params_, /*query_spellcheck=*/false);
|
||||
}
|
||||
#endif
|
||||
|
@@ -13,6 +13,10 @@
|
||||
#include "content/public/browser/context_menu_params.h"
|
||||
#include "content/public/browser/web_contents_observer.h"
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
#include "components/spellcheck/common/spellcheck_common.h"
|
||||
#endif
|
||||
|
||||
namespace content {
|
||||
class RenderFrameHost;
|
||||
class WebContents;
|
||||
@@ -39,7 +43,8 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
|
||||
bool IsShowingContextMenu();
|
||||
|
||||
// Create the context menu.
|
||||
bool CreateContextMenu(const content::ContextMenuParams& params);
|
||||
bool CreateContextMenu(const content::ContextMenuParams& params,
|
||||
bool query_spellcheck = true);
|
||||
void CancelContextMenu();
|
||||
|
||||
private:
|
||||
@@ -62,6 +67,12 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
|
||||
// Returns true if the specified id is a custom context menu command.
|
||||
bool IsCustomContextMenuCommand(int command_id);
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
void OnGetPlatformSuggestionsComplete(
|
||||
const spellcheck::PerLanguageSuggestions&
|
||||
platform_per_language_suggestions);
|
||||
#endif
|
||||
|
||||
// AlloyBrowserHostImpl pointer is guaranteed to outlive this object.
|
||||
raw_ptr<AlloyBrowserHostImpl> browser_;
|
||||
|
||||
|
@@ -173,10 +173,11 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
|
||||
window_info_.parent_window, window_info_.menu,
|
||||
::GetModuleHandle(nullptr), this);
|
||||
|
||||
// It's possible for CreateWindowEx to fail if the parent window was
|
||||
// destroyed between the call to CreateBrowser and the above one.
|
||||
DCHECK(window_info_.window);
|
||||
if (!window_info_.window) {
|
||||
// It's possible for CreateWindowEx to fail if the parent window was destroyed
|
||||
// between the call to CreateBrowser and the above one. It's also possible
|
||||
// that |browser_| will be nullptr if BrowserDestroyed() was called during
|
||||
// this time.
|
||||
if (!window_info_.window || !browser_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -569,10 +570,14 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
|
||||
// Clear the user data pointer.
|
||||
gfx::SetWindowUserData(hwnd, nullptr);
|
||||
|
||||
// Force the browser to be destroyed. This will result in a call to
|
||||
// BrowserDestroyed() that will release the reference added in
|
||||
// CreateHostWindow().
|
||||
AlloyBrowserHostImpl::FromBaseChecked(browser)->WindowDestroyed();
|
||||
// |browser| may be nullptr if the window was destroyed during browser
|
||||
// creation (e.g. CreateHostWindow() returned false).
|
||||
if (browser) {
|
||||
// Force the browser to be destroyed. This will result in a call to
|
||||
// BrowserDestroyed() that will release the reference added in
|
||||
// CreateHostWindow().
|
||||
AlloyBrowserHostImpl::FromBaseChecked(browser)->WindowDestroyed();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@@ -21,7 +21,8 @@ bool CefMenuRunnerMac::RunContextMenu(
|
||||
// Create a menu controller based on the model.
|
||||
MenuControllerCocoa* menu_controller =
|
||||
[[MenuControllerCocoa alloc] initWithModel:model->model()
|
||||
delegate:nil];
|
||||
delegate:nil
|
||||
useWithPopUpButtonCell:NO];
|
||||
|
||||
menu_controller_ = menu_controller;
|
||||
|
||||
|
@@ -341,6 +341,7 @@ class InterceptedRequest : public network::mojom::URLLoader,
|
||||
|
||||
network::URLLoaderCompletionStatus status_;
|
||||
bool got_loader_error_ = false;
|
||||
bool completed_ = false;
|
||||
|
||||
// Used for rate limiting OnUploadProgress callbacks.
|
||||
bool waiting_for_upload_progress_ack_ = false;
|
||||
@@ -1141,7 +1142,17 @@ void InterceptedRequest::OnDestroy() {
|
||||
// We don't want any callbacks after this point.
|
||||
weak_factory_.InvalidateWeakPtrs();
|
||||
|
||||
factory_->request_handler_->OnRequestComplete(id_, request_, status_);
|
||||
bool handled_externally = false;
|
||||
factory_->request_handler_->OnRequestComplete(id_, request_, status_,
|
||||
handled_externally);
|
||||
|
||||
// Don't call OnComplete() if an unhandled request might be handled
|
||||
// externally. The request will instead be canceled implicitly with
|
||||
// ERR_ABORTED.
|
||||
if (!handled_externally && target_client_ && !completed_) {
|
||||
target_client_->OnComplete(status_);
|
||||
completed_ = true;
|
||||
}
|
||||
|
||||
// Destroys |this|.
|
||||
factory_->RemoveRequest(this);
|
||||
@@ -1193,6 +1204,7 @@ void InterceptedRequest::CallOnComplete(
|
||||
|
||||
if (target_client_) {
|
||||
target_client_->OnComplete(status);
|
||||
completed_ = true;
|
||||
}
|
||||
|
||||
if (proxied_loader_receiver_.is_bound() &&
|
||||
@@ -1227,7 +1239,6 @@ void InterceptedRequest::SendErrorStatusAndCompleteImmediately(
|
||||
const network::URLLoaderCompletionStatus& status) {
|
||||
status_ = status;
|
||||
SendErrorCallback(status_.error_code, false);
|
||||
target_client_->OnComplete(status_);
|
||||
OnDestroy();
|
||||
}
|
||||
|
||||
|
@@ -121,7 +121,8 @@ class InterceptedRequestHandler {
|
||||
virtual void OnRequestComplete(
|
||||
int32_t request_id,
|
||||
const network::ResourceRequest& request,
|
||||
const network::URLLoaderCompletionStatus& status) {}
|
||||
const network::URLLoaderCompletionStatus& status,
|
||||
bool& handled_externally) {}
|
||||
|
||||
// Called on error.
|
||||
virtual void OnRequestError(int32_t request_id,
|
||||
|
@@ -1069,10 +1069,10 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
}
|
||||
}
|
||||
|
||||
void OnRequestComplete(
|
||||
int32_t request_id,
|
||||
const network::ResourceRequest& request,
|
||||
const network::URLLoaderCompletionStatus& status) override {
|
||||
void OnRequestComplete(int32_t request_id,
|
||||
const network::ResourceRequest& request,
|
||||
const network::URLLoaderCompletionStatus& status,
|
||||
bool& handled_externally) override {
|
||||
CEF_REQUIRE_IOT();
|
||||
|
||||
RequestState* state = GetState(request_id);
|
||||
@@ -1116,6 +1116,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
|
||||
init_state_->browser_, init_state_->frame_,
|
||||
state->pending_request_.get(), allow_os_execution);
|
||||
if (allow_os_execution && init_state_->unhandled_request_callback_) {
|
||||
handled_externally = true;
|
||||
CEF_POST_TASK(TID_UI, init_state_->unhandled_request_callback_);
|
||||
}
|
||||
}
|
||||
|
@@ -257,6 +257,12 @@ patches = [
|
||||
# https://github.com/chromiumembedded/cef/issues/3314
|
||||
'name': 'chrome_browser_dialogs_native',
|
||||
},
|
||||
{
|
||||
# Fix usage of JavaScript tab modal dialogs with Alloy style browsers.
|
||||
# Modifies the logic added in https://crrev.com/78ce55cbc0.
|
||||
# https://github.com/chromiumembedded/cef/issues/3818
|
||||
'name': 'chrome_browser_dialogs_jsmodal',
|
||||
},
|
||||
{
|
||||
# Support use of chrome Widget dialogs with CEF runtimes.
|
||||
# - Add gfx::AcceleratedWidget dialog parent argument to
|
||||
|
@@ -20,10 +20,10 @@ index 53a73d6c75b7a..05290de4c03a0 100644
|
||||
|
||||
// Make an exception to allow most visited tiles to commit in third-party
|
||||
diff --git content/browser/renderer_host/navigation_request.cc content/browser/renderer_host/navigation_request.cc
|
||||
index f790e2c9ebe6a..7237437f88f50 100644
|
||||
index 7240472cf0f25..47b0a2bee3c76 100644
|
||||
--- content/browser/renderer_host/navigation_request.cc
|
||||
+++ content/browser/renderer_host/navigation_request.cc
|
||||
@@ -8439,10 +8439,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
|
||||
@@ -8444,10 +8444,22 @@ NavigationRequest::GetOriginForURLLoaderFactoryBeforeResponseWithDebugInfo(
|
||||
bool use_opaque_origin =
|
||||
(sandbox_flags & network::mojom::WebSandboxFlags::kOrigin) ==
|
||||
network::mojom::WebSandboxFlags::kOrigin;
|
||||
@@ -47,7 +47,7 @@ index f790e2c9ebe6a..7237437f88f50 100644
|
||||
}
|
||||
|
||||
return origin_and_debug_info;
|
||||
@@ -8550,11 +8562,20 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
||||
@@ -8555,11 +8567,20 @@ NavigationRequest::GetOriginForURLLoaderFactoryAfterResponseWithDebugInfo() {
|
||||
DetermineInitiatorRelationship(initiator_rfh,
|
||||
frame_tree_node_->current_frame_host()));
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
|
||||
index 74763d4ec5662..3c88b9b9bcb1d 100644
|
||||
index 935484239812b..be94b4eb3f6b2 100644
|
||||
--- chrome/browser/BUILD.gn
|
||||
+++ chrome/browser/BUILD.gn
|
||||
@@ -11,6 +11,7 @@ import("//build/config/compiler/pgo/pgo.gni")
|
||||
|
@@ -141,7 +141,7 @@ index 0ed6e9e434350..5c8bcd5c45ede 100644
|
||||
]
|
||||
}
|
||||
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
|
||||
index fafd84d08e336..a17aad8f37537 100644
|
||||
index fafd84d08e336..0985c4cd9ebf0 100644
|
||||
--- chrome/browser/ui/browser.cc
|
||||
+++ chrome/browser/ui/browser.cc
|
||||
@@ -268,6 +268,25 @@
|
||||
@@ -149,16 +149,16 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
#endif
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#define CALL_CEF_DELEGATE(name, ...) \
|
||||
+ if (cef_browser_delegate_) { \
|
||||
+#define CALL_CEF_DELEGATE(name, ...) \
|
||||
+ if (cef_browser_delegate_) { \
|
||||
+ cef_browser_delegate_->name(__VA_ARGS__); \
|
||||
+ }
|
||||
+#define CALL_CEF_DELEGATE_RETURN(name, ...) \
|
||||
+ if (cef_browser_delegate_) { \
|
||||
+#define CALL_CEF_DELEGATE_RETURN(name, ...) \
|
||||
+ if (cef_browser_delegate_) { \
|
||||
+ return cef_browser_delegate_->name(__VA_ARGS__); \
|
||||
+ }
|
||||
+#define CALL_CEF_DELEGATE_RESULT(name, result, ...) \
|
||||
+ if (cef_browser_delegate_) { \
|
||||
+#define CALL_CEF_DELEGATE_RESULT(name, result, ...) \
|
||||
+ if (cef_browser_delegate_) { \
|
||||
+ result = cef_browser_delegate_->name(__VA_ARGS__); \
|
||||
+ }
|
||||
+#else // !BUILDFLAG(ENABLE_CEF)
|
||||
@@ -203,22 +203,23 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
void Browser::FullscreenTopUIStateChanged() {
|
||||
@@ -1752,6 +1783,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
|
||||
@@ -1752,6 +1783,15 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
|
||||
return content::KeyboardEventProcessingResult::HANDLED;
|
||||
}
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ if (cef_browser_delegate_) {
|
||||
+ auto result = cef_browser_delegate_->PreHandleKeyboardEvent(source, event);
|
||||
+ if (result != content::KeyboardEventProcessingResult::NOT_HANDLED)
|
||||
+ if (result != content::KeyboardEventProcessingResult::NOT_HANDLED) {
|
||||
+ return result;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
return window()->PreHandleKeyboardEvent(event);
|
||||
}
|
||||
|
||||
@@ -1759,8 +1798,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
|
||||
@@ -1759,8 +1799,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
|
||||
const NativeWebKeyboardEvent& event) {
|
||||
DevToolsWindow* devtools_window =
|
||||
DevToolsWindow::GetInstanceForInspectedWebContents(source);
|
||||
@@ -239,7 +240,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
bool Browser::TabsNeedBeforeUnloadFired() const {
|
||||
@@ -1855,9 +1904,14 @@ bool Browser::IsBackForwardCacheSupported(content::WebContents& web_contents) {
|
||||
@@ -1855,9 +1905,14 @@ bool Browser::IsBackForwardCacheSupported(content::WebContents& web_contents) {
|
||||
content::PreloadingEligibility Browser::IsPrerender2Supported(
|
||||
content::WebContents& web_contents,
|
||||
content::PreloadingTriggerType trigger_type) {
|
||||
@@ -254,7 +255,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
bool Browser::ShouldShowStaleContentOnEviction(content::WebContents* source) {
|
||||
@@ -1920,6 +1974,14 @@ WebContents* Browser::OpenURLFromTab(
|
||||
@@ -1920,6 +1975,14 @@ WebContents* Browser::OpenURLFromTab(
|
||||
std::move(navigation_handle_callback));
|
||||
}
|
||||
|
||||
@@ -269,7 +270,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
NavigateParams nav_params(this, params.url, params.transition);
|
||||
nav_params.FillNavigateParamsFromOpenURLParams(params);
|
||||
nav_params.source_contents = source;
|
||||
@@ -2093,6 +2155,8 @@ void Browser::LoadingStateChanged(WebContents* source,
|
||||
@@ -2093,6 +2156,8 @@ void Browser::LoadingStateChanged(WebContents* source,
|
||||
bool should_show_loading_ui) {
|
||||
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
|
||||
UpdateWindowForLoadingStateChanged(source, should_show_loading_ui);
|
||||
@@ -278,7 +279,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
void Browser::CloseContents(WebContents* source) {
|
||||
@@ -2122,6 +2186,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
|
||||
@@ -2122,6 +2187,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
|
||||
}
|
||||
|
||||
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
|
||||
@@ -287,7 +288,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
if (!GetStatusBubble()) {
|
||||
return;
|
||||
}
|
||||
@@ -2131,6 +2197,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
|
||||
@@ -2131,6 +2198,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +306,11 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
void Browser::ContentsMouseEvent(WebContents* source, const ui::Event& event) {
|
||||
const ui::EventType type = event.type();
|
||||
const bool exited = type == ui::EventType::kMouseExited;
|
||||
@@ -2159,6 +2236,19 @@ bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
|
||||
@@ -2156,9 +2234,23 @@ void Browser::ContentsZoomChange(bool zoom_in) {
|
||||
}
|
||||
|
||||
bool Browser::TakeFocus(content::WebContents* source, bool reverse) {
|
||||
+ CALL_CEF_DELEGATE_RETURN(TakeFocus, source, reverse);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -325,7 +330,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
void Browser::BeforeUnloadFired(WebContents* web_contents,
|
||||
bool proceed,
|
||||
bool* proceed_to_fire_unload) {
|
||||
@@ -2271,12 +2361,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
|
||||
@@ -2271,12 +2363,24 @@ void Browser::WebContentsCreated(WebContents* source_contents,
|
||||
// to track `new_contents` after it is added to its TabModel this override can
|
||||
// be removed.
|
||||
CreateSessionServiceTabHelper(new_contents);
|
||||
@@ -350,7 +355,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
// Don't show the page hung dialog when a HTML popup hangs because
|
||||
// the dialog will take the focus and immediately close the popup.
|
||||
RenderWidgetHostView* view = render_widget_host->GetView();
|
||||
@@ -2289,6 +2391,13 @@ void Browser::RendererUnresponsive(
|
||||
@@ -2289,6 +2393,13 @@ void Browser::RendererUnresponsive(
|
||||
void Browser::RendererResponsive(
|
||||
WebContents* source,
|
||||
content::RenderWidgetHost* render_widget_host) {
|
||||
@@ -364,7 +369,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
RenderWidgetHostView* view = render_widget_host->GetView();
|
||||
if (view && !render_widget_host->GetView()->IsHTMLFormPopup()) {
|
||||
TabDialogs::FromWebContents(source)->HideHungRendererDialog(
|
||||
@@ -2298,6 +2407,15 @@ void Browser::RendererResponsive(
|
||||
@@ -2298,6 +2409,15 @@ void Browser::RendererResponsive(
|
||||
|
||||
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
|
||||
WebContents* source) {
|
||||
@@ -380,7 +385,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
return javascript_dialogs::TabModalDialogManager::FromWebContents(source);
|
||||
}
|
||||
|
||||
@@ -2333,6 +2451,11 @@ void Browser::DraggableRegionsChanged(
|
||||
@@ -2333,6 +2453,11 @@ void Browser::DraggableRegionsChanged(
|
||||
if (app_controller_) {
|
||||
app_controller_->DraggableRegionsChanged(regions, contents);
|
||||
}
|
||||
@@ -392,7 +397,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
void Browser::DidFinishNavigation(
|
||||
@@ -2415,11 +2538,15 @@ void Browser::EnterFullscreenModeForTab(
|
||||
@@ -2415,11 +2540,15 @@ void Browser::EnterFullscreenModeForTab(
|
||||
const blink::mojom::FullscreenOptions& options) {
|
||||
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
|
||||
requesting_frame, options.display_id);
|
||||
@@ -408,7 +413,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
|
||||
@@ -2629,6 +2756,15 @@ void Browser::RequestMediaAccessPermission(
|
||||
@@ -2629,6 +2758,16 @@ void Browser::RequestMediaAccessPermission(
|
||||
content::WebContents* web_contents,
|
||||
const content::MediaStreamRequest& request,
|
||||
content::MediaResponseCallback callback) {
|
||||
@@ -416,15 +421,16 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
+ if (cef_browser_delegate_) {
|
||||
+ callback = cef_browser_delegate_->RequestMediaAccessPermissionEx(
|
||||
+ web_contents, request, std::move(callback));
|
||||
+ if (callback.is_null())
|
||||
+ if (callback.is_null()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+#endif
|
||||
+
|
||||
const extensions::Extension* extension =
|
||||
GetExtensionForOrigin(profile_, request.security_origin);
|
||||
MediaCaptureDevicesDispatcher::GetInstance()->ProcessMediaAccessRequest(
|
||||
@@ -3211,9 +3347,10 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
|
||||
@@ -3211,9 +3350,10 @@ void Browser::RemoveScheduledUpdatesFor(WebContents* contents) {
|
||||
// Browser, Getters for UI (private):
|
||||
|
||||
StatusBubble* Browser::GetStatusBubble() {
|
||||
@@ -436,7 +442,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
// We hide the status bar for web apps windows as this matches native
|
||||
@@ -3221,6 +3358,12 @@ StatusBubble* Browser::GetStatusBubble() {
|
||||
@@ -3221,6 +3361,12 @@ StatusBubble* Browser::GetStatusBubble() {
|
||||
// mode, as the minimal browser UI includes the status bar.
|
||||
if (web_app::AppBrowserController::IsWebApp(this) &&
|
||||
!app_controller()->HasMinimalUiButtons()) {
|
||||
@@ -449,7 +455,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -3370,6 +3513,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
|
||||
@@ -3370,6 +3516,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
|
||||
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
|
||||
web_contents_collection_.StopObserving(web_contents);
|
||||
}
|
||||
@@ -458,7 +464,7 @@ index fafd84d08e336..a17aad8f37537 100644
|
||||
}
|
||||
|
||||
void Browser::TabDetachedAtImpl(content::WebContents* contents,
|
||||
@@ -3530,6 +3675,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
|
||||
@@ -3530,6 +3678,14 @@ bool Browser::PictureInPictureBrowserSupportsWindowFeature(
|
||||
|
||||
bool Browser::SupportsWindowFeatureImpl(WindowFeature feature,
|
||||
bool check_can_support) const {
|
||||
|
@@ -136,7 +136,7 @@ index cb51224f9892c..b5a3946999d8f 100644
|
||||
private:
|
||||
// RenderViewContextMenuViewsMac:
|
||||
diff --git chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac_cocoa.mm chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac_cocoa.mm
|
||||
index 2e34cf104fbe6..850489d12a458 100644
|
||||
index 5e266a42d3df6..e57211944d6a6 100644
|
||||
--- chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac_cocoa.mm
|
||||
+++ chrome/browser/ui/cocoa/renderer_context_menu/render_view_context_menu_mac_cocoa.mm
|
||||
@@ -70,6 +70,10 @@ RenderViewContextMenuMacCocoa::~RenderViewContextMenuMacCocoa() {
|
||||
@@ -150,7 +150,7 @@ index 2e34cf104fbe6..850489d12a458 100644
|
||||
views::Widget* widget = views::Widget::GetTopLevelWidgetForNativeView(
|
||||
source_web_contents_->GetNativeView());
|
||||
|
||||
@@ -94,6 +98,10 @@ void RenderViewContextMenuMacCocoa::Show() {
|
||||
@@ -95,6 +99,10 @@ void RenderViewContextMenuMacCocoa::Show() {
|
||||
views::ElementTrackerViews::GetContextForWidget(widget));
|
||||
}
|
||||
|
||||
|
79
patch/patches/chrome_browser_dialogs_jsmodal.patch
Normal file
79
patch/patches/chrome_browser_dialogs_jsmodal.patch
Normal file
@@ -0,0 +1,79 @@
|
||||
diff --git chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc
|
||||
index 39012b26b2fd6..1b6cf3097ba40 100644
|
||||
--- chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc
|
||||
+++ chrome/browser/ui/javascript_dialogs/javascript_tab_modal_dialog_manager_delegate_desktop.cc
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
#include <utility>
|
||||
|
||||
+#include "cef/libcef/features/features.h"
|
||||
#include "chrome/browser/ui/browser.h"
|
||||
#include "chrome/browser/ui/browser_finder.h"
|
||||
#include "chrome/browser/ui/browser_list.h"
|
||||
@@ -28,6 +29,22 @@
|
||||
#include "chrome/browser/safe_browsing/user_interaction_observer.h"
|
||||
#endif
|
||||
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+#include "cef/libcef/browser/chrome/extensions/chrome_extension_util.h"
|
||||
+#endif
|
||||
+
|
||||
+namespace {
|
||||
+
|
||||
+bool IsAlloyContents(content::WebContents* web_contents) {
|
||||
+#if BUILDFLAG(ENABLE_CEF)
|
||||
+ return cef::IsAlloyContents(web_contents, /*primary_only=*/true);
|
||||
+#else
|
||||
+ return false;
|
||||
+#endif
|
||||
+}
|
||||
+
|
||||
+} // namespace
|
||||
+
|
||||
JavaScriptTabModalDialogManagerDelegateDesktop::
|
||||
JavaScriptTabModalDialogManagerDelegateDesktop(
|
||||
content::WebContents* web_contents)
|
||||
@@ -77,6 +94,9 @@ void JavaScriptTabModalDialogManagerDelegateDesktop::SetTabNeedsAttention(
|
||||
bool JavaScriptTabModalDialogManagerDelegateDesktop::IsWebContentsForemost() {
|
||||
Browser* browser = BrowserList::GetInstance()->GetLastActive();
|
||||
if (!browser) {
|
||||
+ if (IsAlloyContents(web_contents_)) {
|
||||
+ return true;
|
||||
+ }
|
||||
// It's rare, but there are crashes from where sites are trying to show
|
||||
// dialogs in the split second of time between when their Browser is gone
|
||||
// and they're gone. In that case, bail. https://crbug.com/1142806
|
||||
@@ -92,7 +112,11 @@ bool JavaScriptTabModalDialogManagerDelegateDesktop::IsApp() {
|
||||
}
|
||||
|
||||
bool JavaScriptTabModalDialogManagerDelegateDesktop::CanShowModalUI() {
|
||||
- tabs::TabInterface* tab = tabs::TabInterface::GetFromContents(web_contents_);
|
||||
+ tabs::TabInterface* tab =
|
||||
+ tabs::TabInterface::MaybeGetFromContents(web_contents_);
|
||||
+ if (!tab && IsAlloyContents(web_contents_)) {
|
||||
+ return true;
|
||||
+ }
|
||||
return tab && tab->CanShowModalUI();
|
||||
}
|
||||
|
||||
diff --git chrome/browser/ui/views/javascript_tab_modal_dialog_view_views.cc chrome/browser/ui/views/javascript_tab_modal_dialog_view_views.cc
|
||||
index 3c56e658d05c4..980caca1469bd 100644
|
||||
--- chrome/browser/ui/views/javascript_tab_modal_dialog_view_views.cc
|
||||
+++ chrome/browser/ui/views/javascript_tab_modal_dialog_view_views.cc
|
||||
@@ -79,10 +79,13 @@ JavaScriptTabModalDialogViewViews::JavaScriptTabModalDialogViewViews(
|
||||
default_prompt_text_(default_prompt_text),
|
||||
dialog_callback_(std::move(dialog_callback)),
|
||||
dialog_force_closed_callback_(std::move(dialog_force_closed_callback)) {
|
||||
+ // Will be nullptr with CEF Alloy style browsers.
|
||||
tabs::TabInterface* tab =
|
||||
- tabs::TabInterface::GetFromContents(parent_web_contents);
|
||||
- CHECK(tab && tab->CanShowModalUI());
|
||||
- scoped_tab_modal_ui_ = tab->ShowModalUI();
|
||||
+ tabs::TabInterface::MaybeGetFromContents(parent_web_contents);
|
||||
+ if (tab) {
|
||||
+ CHECK(tab->CanShowModalUI());
|
||||
+ scoped_tab_modal_ui_ = tab->ShowModalUI();
|
||||
+ }
|
||||
|
||||
SetModalType(ui::mojom::ModalType::kChild);
|
||||
SetDefaultButton(static_cast<int>(ui::mojom::DialogButton::kOk));
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/download/chrome_download_manager_delegate.cc chrome/browser/download/chrome_download_manager_delegate.cc
|
||||
index cfcae9fc073be..b8c140692facc 100644
|
||||
index f960decad09fb..b1e88137ff284 100644
|
||||
--- chrome/browser/download/chrome_download_manager_delegate.cc
|
||||
+++ chrome/browser/download/chrome_download_manager_delegate.cc
|
||||
@@ -30,6 +30,7 @@
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git chrome/browser/safe_browsing/BUILD.gn chrome/browser/safe_browsing/BUILD.gn
|
||||
index 2fccae1ba5b02..470b8d8b3fae3 100644
|
||||
index 9d712eab8c753..33807ed8f35bc 100644
|
||||
--- chrome/browser/safe_browsing/BUILD.gn
|
||||
+++ chrome/browser/safe_browsing/BUILD.gn
|
||||
@@ -38,6 +38,7 @@ static_library("safe_browsing") {
|
||||
|
@@ -433,7 +433,7 @@ index e26e3625c99c8..c0d4a95607e37 100644
|
||||
+#endif
|
||||
}
|
||||
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
|
||||
index c9d3bbcf2a0b1..2dd6a7ecf6a84 100644
|
||||
index 2e672ca49c04c..a3acfecc15898 100644
|
||||
--- chrome/browser/chrome_content_browser_client.cc
|
||||
+++ chrome/browser/chrome_content_browser_client.cc
|
||||
@@ -47,6 +47,7 @@
|
||||
@@ -529,7 +529,7 @@ index c9d3bbcf2a0b1..2dd6a7ecf6a84 100644
|
||||
base::BindOnce(&ChromeContentBrowserClient::OnKeepaliveTimerFired,
|
||||
weak_factory_.GetWeakPtr(),
|
||||
diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h
|
||||
index 2b5748cd55d4c..c80ed07d3b623 100644
|
||||
index 6642110b906e1..691ab69fe0757 100644
|
||||
--- chrome/browser/chrome_content_browser_client.h
|
||||
+++ chrome/browser/chrome_content_browser_client.h
|
||||
@@ -159,6 +159,8 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
|
||||
@@ -550,7 +550,7 @@ index 2b5748cd55d4c..c80ed07d3b623 100644
|
||||
content::BrowserContext* context,
|
||||
bool in_memory,
|
||||
const base::FilePath& relative_partition_path,
|
||||
@@ -1343,7 +1345,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
|
||||
@@ -1345,7 +1347,7 @@ class ChromeContentBrowserClient : public content::ContentBrowserClient {
|
||||
|
||||
#if !BUILDFLAG(IS_ANDROID)
|
||||
uint64_t num_keepalive_requests_ = 0;
|
||||
|
@@ -397,7 +397,7 @@ index 3d8a15049d4d2..66c4789581fe1 100644
|
||||
// regenerated.
|
||||
bool RegenerateFrameOnThemeChange(BrowserThemeChangeType theme_change_type);
|
||||
diff --git chrome/browser/ui/views/frame/browser_view.cc chrome/browser/ui/views/frame/browser_view.cc
|
||||
index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
index 3ee5546ba8f42..5d4dfff68db3d 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_view.cc
|
||||
@@ -356,10 +356,6 @@ using web_modal::WebContentsModalDialogHost;
|
||||
@@ -411,7 +411,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
#if BUILDFLAG(IS_CHROMEOS)
|
||||
// UMA histograms that record animation smoothness for tab loading animation.
|
||||
constexpr char kTabLoadingSmoothnessHistogramName[] =
|
||||
@@ -770,6 +766,14 @@ class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {
|
||||
@@ -769,6 +765,14 @@ class BrowserViewLayoutDelegateImpl : public BrowserViewLayoutDelegate {
|
||||
return browser_view_->frame()->GetTopInset() - browser_view_->y();
|
||||
}
|
||||
|
||||
@@ -426,7 +426,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
bool IsToolbarVisible() const override {
|
||||
return browser_view_->IsToolbarVisible();
|
||||
}
|
||||
@@ -921,11 +925,21 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
|
||||
@@ -920,11 +924,21 @@ class BrowserView::AccessibilityModeObserver : public ui::AXModeObserver {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// BrowserView, public:
|
||||
|
||||
@@ -449,7 +449,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
SetShowIcon(::ShouldShowWindowIcon(
|
||||
browser_.get(), AppUsesWindowControlsOverlay(), AppUsesTabbed()));
|
||||
|
||||
@@ -1067,8 +1081,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
@@ -1066,8 +1080,15 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
watermark_view_));
|
||||
#endif
|
||||
|
||||
@@ -467,7 +467,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
|
||||
contents_separator_ =
|
||||
top_container_->AddChildView(std::make_unique<ContentsSeparator>());
|
||||
@@ -1146,7 +1167,9 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
@@ -1145,7 +1166,9 @@ BrowserView::BrowserView(std::unique_ptr<Browser> browser)
|
||||
}
|
||||
|
||||
BrowserView::~BrowserView() {
|
||||
@@ -477,7 +477,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
|
||||
// Remove the layout manager to avoid dangling. This needs to be earlier than
|
||||
// other cleanups that destroy views referenced in the layout manager.
|
||||
@@ -1158,7 +1181,9 @@ BrowserView::~BrowserView() {
|
||||
@@ -1157,7 +1180,9 @@ BrowserView::~BrowserView() {
|
||||
|
||||
// All the tabs should have been destroyed already. If we were closed by the
|
||||
// OS with some tabs than the NativeBrowserFrame should have destroyed them.
|
||||
@@ -487,7 +487,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
|
||||
// Stop the animation timer explicitly here to avoid running it in a nested
|
||||
// message loop, which may run by Browser destructor.
|
||||
@@ -1167,17 +1192,18 @@ BrowserView::~BrowserView() {
|
||||
@@ -1166,17 +1191,18 @@ BrowserView::~BrowserView() {
|
||||
// Immersive mode may need to reparent views before they are removed/deleted.
|
||||
immersive_mode_controller_.reset();
|
||||
|
||||
@@ -510,7 +510,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
|
||||
// These are raw pointers to child views, so they need to be set to null
|
||||
// before `RemoveAllChildViews()` is called to avoid dangling.
|
||||
@@ -1816,6 +1842,28 @@ gfx::Point BrowserView::GetThemeOffsetFromBrowserView() const {
|
||||
@@ -1815,6 +1841,28 @@ gfx::Point BrowserView::GetThemeOffsetFromBrowserView() const {
|
||||
ThemeProperties::kFrameHeightAboveTabs - browser_view_origin.y());
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
// static:
|
||||
BrowserView::DevToolsDockedPlacement BrowserView::GetDevToolsDockedPlacement(
|
||||
const gfx::Rect& contents_webview_bounds,
|
||||
@@ -2242,7 +2290,13 @@ void BrowserView::OnExclusiveAccessUserInput() {
|
||||
@@ -2241,7 +2289,13 @@ void BrowserView::OnExclusiveAccessUserInput() {
|
||||
|
||||
bool BrowserView::ShouldHideUIForFullscreen() const {
|
||||
// Immersive mode needs UI for the slide-down top panel.
|
||||
@@ -554,7 +554,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3448,13 +3502,18 @@ views::View* BrowserView::GetTopContainer() {
|
||||
@@ -3447,13 +3501,18 @@ views::View* BrowserView::GetTopContainer() {
|
||||
|
||||
DownloadBubbleUIController* BrowserView::GetDownloadBubbleUIController() {
|
||||
if (base::FeatureList::IsEnabled(features::kPinnableDownloadsButton)) {
|
||||
@@ -574,7 +574,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
if (auto* download_button = toolbar_button_provider_->GetDownloadButton()) {
|
||||
return static_cast<DownloadToolbarButtonView*>(download_button)
|
||||
->bubble_controller();
|
||||
@@ -4103,7 +4162,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
|
||||
@@ -4102,7 +4161,8 @@ void BrowserView::ReparentTopContainerForEndOfImmersive() {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
top_container()->DestroyLayer();
|
||||
AddChildViewAt(top_container(), 0);
|
||||
EnsureFocusOrder();
|
||||
@@ -4633,11 +4693,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
|
||||
@@ -4632,11 +4692,38 @@ void BrowserView::GetAccessiblePanes(std::vector<views::View*>* panes) {
|
||||
bool BrowserView::ShouldDescendIntoChildForEventHandling(
|
||||
gfx::NativeView child,
|
||||
const gfx::Point& location) {
|
||||
@@ -625,7 +625,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
// Draggable regions are defined relative to the web contents.
|
||||
gfx::Point point_in_contents_web_view_coords(location);
|
||||
views::View::ConvertPointToTarget(GetWidget()->GetRootView(),
|
||||
@@ -4646,7 +4733,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
|
||||
@@ -4645,7 +4732,7 @@ bool BrowserView::ShouldDescendIntoChildForEventHandling(
|
||||
|
||||
// Draggable regions should be ignored for clicks into any browser view's
|
||||
// owned widgets, for example alerts, permission prompts or find bar.
|
||||
@@ -634,7 +634,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
point_in_contents_web_view_coords.x(),
|
||||
point_in_contents_web_view_coords.y()) ||
|
||||
WidgetOwnedByAnchorContainsPoint(point_in_contents_web_view_coords);
|
||||
@@ -4760,8 +4847,10 @@ void BrowserView::Layout(PassKey) {
|
||||
@@ -4759,8 +4846,10 @@ void BrowserView::Layout(PassKey) {
|
||||
|
||||
// TODO(jamescook): Why was this in the middle of layout code?
|
||||
toolbar_->location_bar()->omnibox_view()->SetFocusBehavior(
|
||||
@@ -647,7 +647,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
|
||||
// Some of the situations when the BrowserView is laid out are:
|
||||
// - Enter/exit immersive fullscreen mode.
|
||||
@@ -4828,6 +4917,11 @@ void BrowserView::AddedToWidget() {
|
||||
@@ -4827,6 +4916,11 @@ void BrowserView::AddedToWidget() {
|
||||
SetThemeProfileForWindow(GetNativeWindow(), browser_->profile());
|
||||
#endif
|
||||
|
||||
@@ -659,7 +659,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
toolbar_->Init();
|
||||
|
||||
// TODO(pbos): Investigate whether the side panels should be creatable when
|
||||
@@ -4870,12 +4964,6 @@ void BrowserView::AddedToWidget() {
|
||||
@@ -4869,12 +4963,6 @@ void BrowserView::AddedToWidget() {
|
||||
|
||||
EnsureFocusOrder();
|
||||
|
||||
@@ -672,7 +672,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
if (download::IsDownloadBubbleEnabled() &&
|
||||
base::FeatureList::IsEnabled(features::kPinnableDownloadsButton)) {
|
||||
browser_->GetFeatures().download_toolbar_ui_controller()->Init();
|
||||
@@ -4887,7 +4975,9 @@ void BrowserView::AddedToWidget() {
|
||||
@@ -4886,7 +4974,9 @@ void BrowserView::AddedToWidget() {
|
||||
}
|
||||
|
||||
frame_->OnBrowserViewInitViewsComplete();
|
||||
@@ -683,7 +683,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
using_native_frame_ = frame_->ShouldUseNativeFrame();
|
||||
|
||||
MaybeInitializeWebUITabStrip();
|
||||
@@ -5298,7 +5388,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen, const int64_t display_id) {
|
||||
@@ -5290,7 +5380,8 @@ void BrowserView::ProcessFullscreen(bool fullscreen, const int64_t display_id) {
|
||||
// Undo our anti-jankiness hacks and force a re-layout.
|
||||
in_process_fullscreen_ = false;
|
||||
ToolbarSizeChanged(false);
|
||||
@@ -693,7 +693,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
}
|
||||
|
||||
void BrowserView::RequestFullscreen(bool fullscreen, int64_t display_id) {
|
||||
@@ -5802,6 +5893,8 @@ Profile* BrowserView::GetProfile() {
|
||||
@@ -5794,6 +5885,8 @@ Profile* BrowserView::GetProfile() {
|
||||
}
|
||||
|
||||
void BrowserView::UpdateUIForTabFullscreen() {
|
||||
@@ -702,7 +702,7 @@ index 1b68a93c6d849..4aefc07ba8b02 100644
|
||||
frame()->GetFrameView()->UpdateFullscreenTopUI();
|
||||
}
|
||||
|
||||
@@ -5831,6 +5924,8 @@ bool BrowserView::CanUserEnterFullscreen() const {
|
||||
@@ -5823,6 +5916,8 @@ bool BrowserView::CanUserEnterFullscreen() const {
|
||||
}
|
||||
|
||||
bool BrowserView::CanUserExitFullscreen() const {
|
||||
@@ -753,10 +753,10 @@ index 621d3abcfbd83..13bc942b778ce 100644
|
||||
// Do not friend BrowserViewLayout. Use the BrowserViewLayoutDelegate
|
||||
// interface to keep these two classes decoupled and testable.
|
||||
diff --git chrome/browser/ui/views/frame/browser_view_layout.cc chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
index 6ebae3a0e19fe..f9e2913b8b5bf 100644
|
||||
--- chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
+++ chrome/browser/ui/views/frame/browser_view_layout.cc
|
||||
@@ -52,6 +52,10 @@
|
||||
@@ -53,6 +53,10 @@
|
||||
#include "ui/views/window/client_view.h"
|
||||
#include "ui/views/window/hit_test_utils.h"
|
||||
|
||||
@@ -767,7 +767,7 @@ index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
using views::View;
|
||||
using web_modal::ModalDialogHostObserver;
|
||||
using web_modal::WebContentsModalDialogHost;
|
||||
@@ -102,6 +106,10 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
@@ -122,6 +126,10 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
observer_list_.Notify(&ModalDialogHostObserver::OnHostDestroying);
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
void NotifyPositionRequiresUpdate() {
|
||||
observer_list_.Notify(&ModalDialogHostObserver::OnPositionRequiresUpdate);
|
||||
}
|
||||
@@ -111,7 +119,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
@@ -131,7 +139,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
views::View* view = browser_view_layout_->contents_container_;
|
||||
gfx::Rect rect = view->ConvertRectToWidget(view->GetLocalBounds());
|
||||
const int middle_x = rect.x() + rect.width() / 2;
|
||||
@@ -787,7 +787,7 @@ index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
return gfx::Point(middle_x - size.width() / 2, top);
|
||||
}
|
||||
|
||||
@@ -134,7 +142,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
@@ -154,7 +162,7 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
// universally.
|
||||
views::View* view = browser_view_layout_->contents_container_;
|
||||
gfx::Rect content_area = view->ConvertRectToWidget(view->GetLocalBounds());
|
||||
@@ -796,7 +796,7 @@ index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
return gfx::Size(content_area.width(), content_area.bottom() - top);
|
||||
}
|
||||
|
||||
@@ -163,6 +171,13 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
@@ -183,6 +191,13 @@ class BrowserViewLayout::WebContentsModalDialogHostViews
|
||||
return host_widget ? host_widget->GetNativeView() : nullptr;
|
||||
}
|
||||
|
||||
@@ -810,7 +810,7 @@ index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
// Add/remove observer.
|
||||
void AddObserver(ModalDialogHostObserver* observer) override {
|
||||
observer_list_.AddObserver(observer);
|
||||
@@ -486,6 +501,8 @@ void BrowserViewLayout::Layout(views::View* browser_view) {
|
||||
@@ -506,6 +521,8 @@ void BrowserViewLayout::Layout(views::View* browser_view) {
|
||||
exclusive_access_bubble->RepositionIfVisible();
|
||||
}
|
||||
|
||||
@@ -819,7 +819,7 @@ index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
// Adjust any hosted dialogs if the browser's dialog hosting bounds changed.
|
||||
const gfx::Rect dialog_bounds(dialog_host_->GetDialogPosition(gfx::Size()),
|
||||
dialog_host_->GetMaximumDialogSize());
|
||||
@@ -499,6 +516,7 @@ void BrowserViewLayout::Layout(views::View* browser_view) {
|
||||
@@ -519,6 +536,7 @@ void BrowserViewLayout::Layout(views::View* browser_view) {
|
||||
latest_dialog_bounds_in_screen_ = dialog_bounds_in_screen;
|
||||
dialog_host_->NotifyPositionRequiresUpdate();
|
||||
}
|
||||
@@ -827,7 +827,7 @@ index 39f9345a8bf6a..ecbd2553d7c5b 100644
|
||||
}
|
||||
|
||||
gfx::Size BrowserViewLayout::GetPreferredSize(
|
||||
@@ -635,6 +653,13 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
||||
@@ -655,6 +673,13 @@ int BrowserViewLayout::LayoutWebUITabStrip(int top) {
|
||||
|
||||
int BrowserViewLayout::LayoutToolbar(int top) {
|
||||
TRACE_EVENT0("ui", "BrowserViewLayout::LayoutToolbar");
|
||||
@@ -1059,7 +1059,7 @@ index 98d97b84906bd..d63bab08e8098 100644
|
||||
}
|
||||
|
||||
diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
index 0d912a7cbf371..4b0f539bc9916 100644
|
||||
index fd5dcdf1f352f..44c30ba50ef38 100644
|
||||
--- chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
+++ chrome/browser/ui/views/toolbar/toolbar_view.cc
|
||||
@@ -185,7 +185,7 @@ class TabstripLikeBackground : public views::Background {
|
||||
@@ -1127,7 +1127,7 @@ index 0d912a7cbf371..4b0f539bc9916 100644
|
||||
!base::FeatureList::IsEnabled(features::kPinnableDownloadsButton)) {
|
||||
download_button =
|
||||
std::make_unique<DownloadToolbarButtonView>(browser_view_);
|
||||
@@ -368,7 +384,8 @@ void ToolbarView::Init() {
|
||||
@@ -373,7 +389,8 @@ void ToolbarView::Init() {
|
||||
}
|
||||
std::unique_ptr<media_router::CastToolbarButton> cast;
|
||||
if (!base::FeatureList::IsEnabled(features::kPinnedCastButton)) {
|
||||
@@ -1137,7 +1137,7 @@ index 0d912a7cbf371..4b0f539bc9916 100644
|
||||
cast = media_router::CastToolbarButton::Create(browser_);
|
||||
}
|
||||
}
|
||||
@@ -382,7 +399,8 @@ void ToolbarView::Init() {
|
||||
@@ -387,7 +404,8 @@ void ToolbarView::Init() {
|
||||
|
||||
std::unique_ptr<send_tab_to_self::SendTabToSelfToolbarIconView>
|
||||
send_tab_to_self_button;
|
||||
@@ -1147,7 +1147,7 @@ index 0d912a7cbf371..4b0f539bc9916 100644
|
||||
send_tab_to_self_button =
|
||||
std::make_unique<send_tab_to_self::SendTabToSelfToolbarIconView>(
|
||||
browser_view_);
|
||||
@@ -840,7 +858,8 @@ void ToolbarView::Layout(PassKey) {
|
||||
@@ -845,7 +863,8 @@ void ToolbarView::Layout(PassKey) {
|
||||
|
||||
if (display_mode_ == DisplayMode::NORMAL) {
|
||||
LayoutCommon();
|
||||
|
@@ -47,7 +47,7 @@ index 8e47cbb36a8cb..5165aea10332e 100644
|
||||
return std::make_pair(
|
||||
/*is_cacheable=*/false,
|
||||
diff --git content/public/browser/content_browser_client.cc content/public/browser/content_browser_client.cc
|
||||
index eacc673508fde..86a9600c75188 100644
|
||||
index 79490d0d3d622..537ac2d9763e6 100644
|
||||
--- content/public/browser/content_browser_client.cc
|
||||
+++ content/public/browser/content_browser_client.cc
|
||||
@@ -1166,7 +1166,7 @@ ContentBrowserClient::CreateURLLoaderHandlerForServiceWorkerNavigationPreload(
|
||||
@@ -68,7 +68,7 @@ index eacc673508fde..86a9600c75188 100644
|
||||
|
||||
std::vector<base::FilePath>
|
||||
diff --git content/public/browser/content_browser_client.h content/public/browser/content_browser_client.h
|
||||
index 9746621c4fa96..ef3fa93b6b917 100644
|
||||
index f0ac298846f7e..75ee3b0e6df86 100644
|
||||
--- content/public/browser/content_browser_client.h
|
||||
+++ content/public/browser/content_browser_client.h
|
||||
@@ -1360,6 +1360,12 @@ class CONTENT_EXPORT ContentBrowserClient {
|
||||
|
@@ -78,7 +78,7 @@ index bd41166938952..fba7843d79796 100644
|
||||
|
||||
visual_studio_version_logs = [ "windows_sdk_version=${windows_sdk_version}" ]
|
||||
diff --git chrome/chrome_paks.gni chrome/chrome_paks.gni
|
||||
index 8f146e28971a7..42d1674c280de 100644
|
||||
index 98745f8487d18..826c7e305dfbe 100644
|
||||
--- chrome/chrome_paks.gni
|
||||
+++ chrome/chrome_paks.gni
|
||||
@@ -6,6 +6,7 @@ import("//ash/ambient/resources/resources.gni")
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git tools/gritsettings/resource_ids.spec tools/gritsettings/resource_ids.spec
|
||||
index b7c03fa573ff1..712412b50d4c1 100644
|
||||
index 2cd6ca756a745..8db95cf5ad955 100644
|
||||
--- tools/gritsettings/resource_ids.spec
|
||||
+++ tools/gritsettings/resource_ids.spec
|
||||
@@ -1476,11 +1476,18 @@
|
||||
@@ -1472,11 +1472,18 @@
|
||||
"<(SHARED_INTERMEDIATE_DIR)/third_party/blink/public/strings/permission_element_generated_strings.grd": {
|
||||
"META": {"sizes": {"messages": [2000],}},
|
||||
"messages": [10080],
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git ui/gtk/gtk_compat.cc ui/gtk/gtk_compat.cc
|
||||
index d93d9b94c7ba4..905583f1aa7ce 100644
|
||||
index a4f93deaa7c42..de236923186cc 100644
|
||||
--- ui/gtk/gtk_compat.cc
|
||||
+++ ui/gtk/gtk_compat.cc
|
||||
@@ -127,7 +127,7 @@ bool LoadGtkImpl() {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
diff --git ui/gtk/gtk_ui.cc ui/gtk/gtk_ui.cc
|
||||
index 4ce6508343bdf..7e161072d063f 100644
|
||||
index 24a5a2c1228e1..7cd1fb1aab76c 100644
|
||||
--- ui/gtk/gtk_ui.cc
|
||||
+++ ui/gtk/gtk_ui.cc
|
||||
@@ -31,6 +31,7 @@
|
||||
|
@@ -10,10 +10,10 @@ index aeb79b46f5d21..bd57e874c1240 100644
|
||||
+// This load will not send any cookies. For CEF usage.
|
||||
+LOAD_FLAG(DO_NOT_SEND_COOKIES, 1 << 20)
|
||||
diff --git net/url_request/url_request_http_job.cc net/url_request/url_request_http_job.cc
|
||||
index ae87ba4982d55..5b11c4d0043a4 100644
|
||||
index 301c46fc7b832..b9272d9985a9f 100644
|
||||
--- net/url_request/url_request_http_job.cc
|
||||
+++ net/url_request/url_request_http_job.cc
|
||||
@@ -2080,7 +2080,8 @@ bool URLRequestHttpJob::ShouldAddCookieHeader() const {
|
||||
@@ -2085,7 +2085,8 @@ bool URLRequestHttpJob::ShouldAddCookieHeader() const {
|
||||
// Read cookies whenever allow_credentials() is true, even if the PrivacyMode
|
||||
// is being overridden by NetworkDelegate and will eventually block them, as
|
||||
// blocked cookies still need to be logged in that case.
|
||||
@@ -24,10 +24,10 @@ index ae87ba4982d55..5b11c4d0043a4 100644
|
||||
|
||||
bool URLRequestHttpJob::ShouldRecordPartitionedCookieUsage() const {
|
||||
diff --git services/network/public/cpp/resource_request.cc services/network/public/cpp/resource_request.cc
|
||||
index babcf42e01be0..0938c85246f01 100644
|
||||
index 3783559dc1ea3..5b5b26cb6fda2 100644
|
||||
--- services/network/public/cpp/resource_request.cc
|
||||
+++ services/network/public/cpp/resource_request.cc
|
||||
@@ -353,7 +353,8 @@ bool ResourceRequest::EqualsForTesting(const ResourceRequest& request) const {
|
||||
@@ -354,7 +354,8 @@ bool ResourceRequest::EqualsForTesting(const ResourceRequest& request) const {
|
||||
}
|
||||
|
||||
bool ResourceRequest::SendsCookies() const {
|
||||
|
@@ -56,10 +56,10 @@ index f1030a744809c..c222a209949e6 100644
|
||||
return nullptr;
|
||||
}
|
||||
diff --git content/browser/renderer_host/render_widget_host_impl.cc content/browser/renderer_host/render_widget_host_impl.cc
|
||||
index f4475e34d3d6c..ad06b50a46a9d 100644
|
||||
index 13120da83057f..a7562af5b868d 100644
|
||||
--- content/browser/renderer_host/render_widget_host_impl.cc
|
||||
+++ content/browser/renderer_host/render_widget_host_impl.cc
|
||||
@@ -3733,6 +3733,11 @@ void RenderWidgetHostImpl::StopFling() {
|
||||
@@ -3741,6 +3741,11 @@ void RenderWidgetHostImpl::StopFling() {
|
||||
GetRenderInputRouter()->StopFling();
|
||||
}
|
||||
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git content/browser/renderer_host/render_frame_host_impl.cc content/browser/renderer_host/render_frame_host_impl.cc
|
||||
index 3db42c2bf2740..c83a8a0b8492e 100644
|
||||
index a5287d9c28938..e634fb46bb619 100644
|
||||
--- content/browser/renderer_host/render_frame_host_impl.cc
|
||||
+++ content/browser/renderer_host/render_frame_host_impl.cc
|
||||
@@ -9627,6 +9627,16 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
@@ -9628,6 +9628,16 @@ void RenderFrameHostImpl::CreateNewWindow(
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ index 3db42c2bf2740..c83a8a0b8492e 100644
|
||||
// Otherwise, consume user activation before we proceed. In particular, it is
|
||||
// important to do this before we return from the |opener_suppressed| case
|
||||
// below.
|
||||
@@ -12017,6 +12027,7 @@ void RenderFrameHostImpl::CommitNavigation(
|
||||
@@ -12018,6 +12028,7 @@ void RenderFrameHostImpl::CommitNavigation(
|
||||
auto browser_calc_origin_to_commit =
|
||||
navigation_request->GetOriginToCommitWithDebugInfo();
|
||||
if (!process_lock.is_error_page() && !is_mhtml_subframe &&
|
||||
|
@@ -80,10 +80,10 @@ index 95f73bcb9fb40..e17a93f69c089 100644
|
||||
|
||||
void CookieManager::SetForceKeepSessionState() {
|
||||
diff --git services/network/network_context.cc services/network/network_context.cc
|
||||
index ca2df1e67d756..d2e963efdf1d8 100644
|
||||
index 85e8de6a7ce8e..30da6c19d6ef5 100644
|
||||
--- services/network/network_context.cc
|
||||
+++ services/network/network_context.cc
|
||||
@@ -2785,22 +2785,26 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
@@ -2815,22 +2815,26 @@ URLRequestContextOwner NetworkContext::MakeURLRequestContext(
|
||||
pref_service.get(), network_service_->network_quality_estimator());
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ index ca2df1e67d756..d2e963efdf1d8 100644
|
||||
base::FilePath transport_security_persister_file_name;
|
||||
if (GetFullDataFilePath(params_->file_paths,
|
||||
diff --git services/network/public/mojom/network_context.mojom services/network/public/mojom/network_context.mojom
|
||||
index be45c88ba8571..536e92b4e9497 100644
|
||||
index 46204bc820cf8..e96ab8e3674ba 100644
|
||||
--- services/network/public/mojom/network_context.mojom
|
||||
+++ services/network/public/mojom/network_context.mojom
|
||||
@@ -360,6 +360,9 @@ struct NetworkContextParams {
|
||||
|
@@ -164,7 +164,7 @@ index 8efaccff40e09..e420e2f4e80ec 100644
|
||||
LabelButtonImageContainer* image_container() {
|
||||
return image_container_.get();
|
||||
diff --git ui/views/controls/label.cc ui/views/controls/label.cc
|
||||
index af3ef923d50ce..263a178888e18 100644
|
||||
index e2bdc42003fa3..fb060e6a6cc5f 100644
|
||||
--- ui/views/controls/label.cc
|
||||
+++ ui/views/controls/label.cc
|
||||
@@ -56,12 +56,29 @@ enum LabelPropertyKey {
|
||||
@@ -654,7 +654,7 @@ index f5b0936aac647..20f476c9abd93 100644
|
||||
std::optional<std::string> show_menu_host_duration_histogram) override;
|
||||
void Cancel() override;
|
||||
diff --git ui/views/controls/menu/menu_runner_impl_cocoa.mm ui/views/controls/menu/menu_runner_impl_cocoa.mm
|
||||
index 05322e627acab..a866a76c50372 100644
|
||||
index e1e3f0d4c54dd..f8afecca2016b 100644
|
||||
--- ui/views/controls/menu/menu_runner_impl_cocoa.mm
|
||||
+++ ui/views/controls/menu/menu_runner_impl_cocoa.mm
|
||||
@@ -72,6 +72,7 @@ void MenuRunnerImplCocoa::RunMenuAt(
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git content/browser/web_contents/web_contents_impl.cc content/browser/web_contents/web_contents_impl.cc
|
||||
index b45b3210c9564..76b6c52347b73 100644
|
||||
index 97d4479d29833..5d7f605e8d841 100644
|
||||
--- content/browser/web_contents/web_contents_impl.cc
|
||||
+++ content/browser/web_contents/web_contents_impl.cc
|
||||
@@ -3853,6 +3853,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3861,6 +3861,12 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
params.main_frame_name, GetOpener(), primary_main_frame_policy,
|
||||
base::UnguessableToken::Create());
|
||||
|
||||
@@ -15,7 +15,7 @@ index b45b3210c9564..76b6c52347b73 100644
|
||||
std::unique_ptr<WebContentsViewDelegate> delegate =
|
||||
GetContentClient()->browser()->GetWebContentsViewDelegate(this);
|
||||
|
||||
@@ -3863,6 +3869,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
@@ -3871,6 +3877,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params,
|
||||
view_ = CreateWebContentsView(this, std::move(delegate),
|
||||
&render_view_host_delegate_view_);
|
||||
}
|
||||
@@ -23,7 +23,7 @@ index b45b3210c9564..76b6c52347b73 100644
|
||||
CHECK(render_view_host_delegate_view_);
|
||||
CHECK(view_.get());
|
||||
|
||||
@@ -4073,6 +4080,9 @@ void WebContentsImpl::RenderWidgetCreated(
|
||||
@@ -4081,6 +4088,9 @@ void WebContentsImpl::RenderWidgetCreated(
|
||||
"render_widget_host", render_widget_host);
|
||||
CHECK(!created_widgets_.contains(render_widget_host->GetFrameSinkId()));
|
||||
created_widgets_[render_widget_host->GetFrameSinkId()] = render_widget_host;
|
||||
@@ -33,7 +33,7 @@ index b45b3210c9564..76b6c52347b73 100644
|
||||
}
|
||||
|
||||
void WebContentsImpl::RenderWidgetDeleted(
|
||||
@@ -4992,6 +5002,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
@@ -5000,6 +5010,15 @@ FrameTree* WebContentsImpl::CreateNewWindow(
|
||||
create_params.picture_in_picture_options = *(params.pip_options);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ index b45b3210c9564..76b6c52347b73 100644
|
||||
// Check whether there is an available prerendered page for this navigation if
|
||||
// this is not for guest. If it exists, take WebContents pre-created for
|
||||
// hosting the prerendered page instead of creating new WebContents.
|
||||
@@ -9660,6 +9679,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
|
||||
@@ -9695,6 +9714,9 @@ void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node,
|
||||
}
|
||||
|
||||
CloseListenerManager::DidChangeFocusedFrame(this);
|
||||
|
@@ -1074,28 +1074,6 @@ void ClientHandler::OnLoadingStateChange(CefRefPtr<CefBrowser> browser,
|
||||
NotifyLoadingState(isLoading, canGoBack, canGoForward);
|
||||
}
|
||||
|
||||
void ClientHandler::OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) {
|
||||
CEF_REQUIRE_UI_THREAD();
|
||||
|
||||
// Don't display an error for downloaded files.
|
||||
if (errorCode == ERR_ABORTED) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't display an error for external protocols that we allow the OS to
|
||||
// handle. See OnProtocolExecution().
|
||||
if (errorCode == ERR_UNKNOWN_URL_SCHEME) {
|
||||
std::string urlStr = frame->GetURL();
|
||||
if (urlStr.find("spotify:") == 0) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool ClientHandler::OnRequestMediaAccessPermission(
|
||||
CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
|
@@ -240,11 +240,6 @@ class ClientHandler : public BaseClientHandler,
|
||||
bool isLoading,
|
||||
bool canGoBack,
|
||||
bool canGoForward) override;
|
||||
void OnLoadError(CefRefPtr<CefBrowser> browser,
|
||||
CefRefPtr<CefFrame> frame,
|
||||
ErrorCode errorCode,
|
||||
const CefString& errorText,
|
||||
const CefString& failedUrl) override;
|
||||
|
||||
// CefPermissionHandler methods
|
||||
bool OnRequestMediaAccessPermission(
|
||||
|
@@ -48,6 +48,7 @@ void TerminationSignalHandler(int signatl) {
|
||||
MainContext::Get()->GetRootWindowManager()->CloseAllWindows(true);
|
||||
}
|
||||
|
||||
NO_STACK_PROTECTOR
|
||||
int RunMain(int argc, char* argv[]) {
|
||||
// Create a copy of |argv| on Linux because Chromium mangles the value
|
||||
// internally (see issue #620).
|
||||
@@ -158,6 +159,7 @@ int RunMain(int argc, char* argv[]) {
|
||||
} // namespace client
|
||||
|
||||
// Program entry point function.
|
||||
NO_STACK_PROTECTOR
|
||||
int main(int argc, char* argv[]) {
|
||||
return client::RunMain(argc, argv);
|
||||
}
|
||||
|
@@ -31,6 +31,7 @@ int XIOErrorHandlerImpl(Display* display) {
|
||||
#endif // defined(CEF_X11)
|
||||
|
||||
// Entry point function for all processes.
|
||||
NO_STACK_PROTECTOR
|
||||
int main(int argc, char* argv[]) {
|
||||
// Provide CEF with command-line arguments.
|
||||
CefMainArgs main_args(argc, argv);
|
||||
|
@@ -134,6 +134,7 @@ class ScopedPlatformSetup final {
|
||||
|
||||
} // namespace
|
||||
|
||||
NO_STACK_PROTECTOR
|
||||
int main(int argc, char* argv[]) {
|
||||
int exit_code;
|
||||
|
||||
|
@@ -522,9 +522,9 @@ def dict_to_str(dict):
|
||||
# Attribute keys allowed in CEF metadata comments.
|
||||
COMMON_ATTRIB_KEYS = ('added', 'removed')
|
||||
CLASS_ATTRIB_KEYS = COMMON_ATTRIB_KEYS + ('no_debugct_check', 'source')
|
||||
FUNCTION_ATTRIB_KEYS = COMMON_ATTRIB_KEYS + ('api_hash_check', 'capi_name',
|
||||
'count_func', 'default_retval',
|
||||
'index_param', 'optional_param')
|
||||
FUNCTION_ATTRIB_KEYS = COMMON_ATTRIB_KEYS + (
|
||||
'api_hash_check', 'capi_name', 'count_func', 'default_retval',
|
||||
'index_param', 'no_stack_protector', 'optional_param')
|
||||
|
||||
# regex for matching comment-formatted attributes
|
||||
_cre_attrib = r'/\*--cef\(([A-Za-z0-9_ ,=:\n]{0,})\)--\*/'
|
||||
|
@@ -3,6 +3,6 @@ LICENSING
|
||||
|
||||
The CEF project is BSD licensed. Please read the LICENSE.txt file included with
|
||||
this binary distribution for licensing terms and conditions. Other software
|
||||
included in this distribution is provided under other licenses. Please visit
|
||||
"about:credits" in a CEF-based application for complete Chromium and third-party
|
||||
licensing information.
|
||||
included in this distribution is provided under other licenses. Please see the
|
||||
CREDITS.html file or visit "about:credits" in a CEF-based application for
|
||||
complete Chromium and third-party licensing information.
|
||||
|
@@ -7,7 +7,7 @@ from subprocess import Popen, PIPE
|
||||
import sys
|
||||
|
||||
|
||||
def exec_cmd(cmd, path, input_string=None):
|
||||
def exec_cmd(cmd, path, input_string=None, output_file=None):
|
||||
""" Execute the specified command and return the result. """
|
||||
out = ''
|
||||
err = ''
|
||||
@@ -18,7 +18,7 @@ def exec_cmd(cmd, path, input_string=None):
|
||||
process = Popen(
|
||||
parts,
|
||||
cwd=path,
|
||||
stdout=PIPE,
|
||||
stdout=PIPE if output_file is None else output_file,
|
||||
stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
out, err = process.communicate()
|
||||
@@ -28,10 +28,14 @@ def exec_cmd(cmd, path, input_string=None):
|
||||
parts,
|
||||
cwd=path,
|
||||
stdin=PIPE,
|
||||
stdout=PIPE,
|
||||
stdout=PIPE if output_file is None else output_file,
|
||||
stderr=PIPE,
|
||||
shell=(sys.platform == 'win32'))
|
||||
out, err = process.communicate(input=input_string)
|
||||
ret = process.returncode
|
||||
|
||||
return {'out': out.decode('utf-8'), 'err': err.decode('utf-8'), 'ret': ret}
|
||||
return {
|
||||
'out': out.decode('utf-8') if output_file is None else None,
|
||||
'err': err.decode('utf-8'),
|
||||
'ret': ret
|
||||
}
|
||||
|
@@ -38,7 +38,7 @@ def write_file(path, data, overwrite=True, quiet=True):
|
||||
return False
|
||||
|
||||
if not quiet:
|
||||
print('Writing file %s' % path)
|
||||
print('Writing %s file.' % path)
|
||||
|
||||
try:
|
||||
with open(path, 'w', encoding='utf-8', newline='\n') as f:
|
||||
|
@@ -10,6 +10,7 @@ from gclient_util import *
|
||||
from gn_args import GetAllPlatformConfigs, GetConfigFileContents
|
||||
import issue_1999
|
||||
import os
|
||||
from setup_vscode import GetPreferredOutputDirectory, UpdateCompileCommandsJSON
|
||||
import sys
|
||||
|
||||
# The CEF directory is the parent directory of _this_ script.
|
||||
@@ -26,7 +27,7 @@ elif sys.platform.startswith('linux'):
|
||||
platform = 'linux'
|
||||
else:
|
||||
print('Unknown operating system platform')
|
||||
sys.exit()
|
||||
sys.exit(1)
|
||||
|
||||
print("\nGenerating CEF translated files...")
|
||||
cmd = [sys.executable, 'tools/version_manager.py', '-u', '--fast-check']
|
||||
@@ -134,6 +135,10 @@ if platform == 'windows':
|
||||
gn_args['windows_sdk_version'] = os.environ['SDK_VERSION']
|
||||
|
||||
configs = GetAllPlatformConfigs(gn_args)
|
||||
|
||||
# Returns the preferred output directory for VSCode, or None.
|
||||
preferred_dir = GetPreferredOutputDirectory(configs.keys())
|
||||
|
||||
for dir, config in configs.items():
|
||||
# Create out directories and write the args.gn file.
|
||||
out_path = os.path.join(src_dir, 'out', dir)
|
||||
@@ -149,3 +154,7 @@ for dir, config in configs.items():
|
||||
RunAction(src_dir, cmd)
|
||||
if platform == 'windows':
|
||||
issue_1999.apply(out_path)
|
||||
|
||||
if dir == preferred_dir and not UpdateCompileCommandsJSON(
|
||||
src_dir, out_path, create=False):
|
||||
sys.exit(1)
|
||||
|
@@ -9,10 +9,13 @@ import functools
|
||||
|
||||
|
||||
def make_cpptoc_impl_proto(name, func, parts):
|
||||
proto = ''
|
||||
if func.has_attrib('no_stack_protector'):
|
||||
proto += 'NO_STACK_PROTECTOR '
|
||||
if isinstance(func, obj_function_virtual):
|
||||
proto = parts['retval'] + ' CEF_CALLBACK'
|
||||
proto += parts['retval'] + ' CEF_CALLBACK'
|
||||
else:
|
||||
proto = 'CEF_EXPORT ' + parts['retval']
|
||||
proto += 'CEF_EXPORT ' + parts['retval']
|
||||
|
||||
proto += ' ' + name + '(' + ', '.join(parts['args']) + ')'
|
||||
return proto
|
||||
|
@@ -11,6 +11,8 @@ def make_ctocpp_impl_proto(clsname, name, func, parts):
|
||||
const = ''
|
||||
|
||||
proto = 'NO_SANITIZE("cfi-icall") '
|
||||
if func.has_attrib('no_stack_protector'):
|
||||
proto += 'NO_STACK_PROTECTOR '
|
||||
if clsname is None:
|
||||
proto += 'CEF_GLOBAL ' + parts['retval'] + ' '
|
||||
else:
|
||||
|
@@ -913,6 +913,16 @@ out_dir = os.path.join(src_dir, 'out')
|
||||
build_dir_debug = os.path.join(out_dir, 'Debug' + build_dir_suffix)
|
||||
build_dir_release = os.path.join(out_dir, 'Release' + build_dir_suffix)
|
||||
|
||||
# Transfer the about_credits.html file.
|
||||
# Debug and Release build should be the same so grab whichever exists.
|
||||
rel_path = os.path.join('gen', 'components', 'resources', 'about_credits.html')
|
||||
src_path = os.path.join(build_dir_release, rel_path)
|
||||
if not os.path.exists(src_path):
|
||||
src_path = os.path.join(build_dir_debug, rel_path)
|
||||
if not os.path.exists(src_path):
|
||||
raise Exception('Missing generated resources file: %s' % rel_path)
|
||||
copy_file(src_path, os.path.join(output_dir, 'CREDITS.html'), options.quiet)
|
||||
|
||||
if mode == 'standard' or mode == 'minimal':
|
||||
# create the include directory
|
||||
include_dir = os.path.join(output_dir, 'include')
|
||||
|
292
tools/setup_vscode.py
Normal file
292
tools/setup_vscode.py
Normal file
@@ -0,0 +1,292 @@
|
||||
# Copyright (c) 2025 The Chromium Embedded Framework Authors. All rights
|
||||
# reserved. Use of this source code is governed by a BSD-style license that
|
||||
# can be found in the LICENSE file.
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
from exec_util import exec_cmd
|
||||
from file_util import backup_file, copy_file, make_dir, read_file, write_file
|
||||
import os
|
||||
import platform as python_platform
|
||||
import sys
|
||||
|
||||
COMPILE_COMMANDS_JSON = 'compile_commands.json'
|
||||
LLDBINIT = '.lldbinit'
|
||||
|
||||
|
||||
def UpdateCompileCommandsJSON(src_dir, out_dir, create):
|
||||
out_path = os.path.join(src_dir, COMPILE_COMMANDS_JSON)
|
||||
if not create and not os.path.isfile(out_path):
|
||||
return True
|
||||
|
||||
print(f'Writing {COMPILE_COMMANDS_JSON} for clangd...')
|
||||
with open(out_path, 'w') as f:
|
||||
result = exec_cmd(
|
||||
sys.executable +
|
||||
f' tools/clang/scripts/generate_compdb.py -p {out_dir}',
|
||||
src_dir,
|
||||
output_file=f)
|
||||
if result['err']:
|
||||
print('ERROR: generate_compdb.py failed: %s' % result['err'])
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def GetPreferredOutputDirectory(all_dirs):
|
||||
if sys.platform == 'win32':
|
||||
# Windows machines report 'ARM64' or 'AMD64'.
|
||||
machine = 'arm64' if python_platform.machine() == 'ARM64' else 'x64'
|
||||
elif sys.platform == 'darwin':
|
||||
# Mac machines report 'arm64' or 'x86_64'.
|
||||
machine = 'arm64' if python_platform.machine() == 'arm64' else 'x64'
|
||||
elif sys.platform.startswith('linux'):
|
||||
# Linux machines report 'aarch64', 'armv7l', 'x86_64', 'i386', etc.
|
||||
machine = 'arm64' if python_platform.machine() == 'aarch64' else 'x64'
|
||||
|
||||
# Return the preferred directory that matches the host architecture.
|
||||
for dir in (f'Debug_GN_{machine}', f'Release_GN_{machine}'):
|
||||
if dir in all_dirs:
|
||||
return dir
|
||||
|
||||
return None
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
from optparse import OptionParser
|
||||
|
||||
desc = """
|
||||
This utility sets up Visual Studio Code (VSCode) integration for CEF.
|
||||
"""
|
||||
|
||||
epilog = """
|
||||
This utility sets up Visual Studio Code (VSCode) integration for an existing
|
||||
CEF/Chromium development environment. See
|
||||
https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart.md for
|
||||
prerequisite environment setup instructions.
|
||||
|
||||
The VSCode application and recommended extensions should be installed manually
|
||||
upon completion of this setup. Instructions for this will be provided.
|
||||
|
||||
This setup is an automation and customization of the Chromium setup documented
|
||||
at https://chromium.googlesource.com/chromium/src/+/main/docs/vscode.md. After
|
||||
completion of this setup the VSCode configuration can be further customized by
|
||||
modifying JSON files in the src/.vscode directory (either directly or via the
|
||||
VSCode interface).
|
||||
|
||||
This setup includes configuration of clangd for improved C/C++ IntelliSense.
|
||||
This functionality depends on a src/compile_commands.json file that will
|
||||
be created by this utility and then regenerated each time cef_create_projects
|
||||
is called in the future. Delete this json file manually if you do not wish to
|
||||
utilize clangd with VSCode.
|
||||
"""
|
||||
|
||||
class CustomParser(OptionParser):
|
||||
|
||||
def format_epilog(self, formatter):
|
||||
return self.epilog
|
||||
|
||||
parser = CustomParser(description=desc, epilog=epilog + '\n')
|
||||
parser.add_option(
|
||||
'-v',
|
||||
'--verbose',
|
||||
action='store_true',
|
||||
dest='verbose',
|
||||
default=False,
|
||||
help='output detailed status information')
|
||||
parser.add_option(
|
||||
'--headless',
|
||||
action='store_true',
|
||||
dest='headless',
|
||||
default=False,
|
||||
help='run without requiring user interaction')
|
||||
parser.add_option(
|
||||
'--force-update',
|
||||
action='store_true',
|
||||
dest='force_update',
|
||||
default=False,
|
||||
help='force update all JSON configuration files')
|
||||
(options, args) = parser.parse_args()
|
||||
|
||||
print(epilog)
|
||||
|
||||
if not options.headless:
|
||||
input("Press Enter to proceed with setup...")
|
||||
|
||||
quiet = not options.verbose
|
||||
|
||||
script_dir = os.path.dirname(__file__)
|
||||
cef_dir = os.path.abspath(os.path.join(script_dir, os.pardir))
|
||||
src_dir = os.path.abspath(os.path.join(cef_dir, os.pardir))
|
||||
chromium_dir = os.path.abspath(os.path.join(src_dir, os.pardir))
|
||||
in_dir = os.path.join(cef_dir, 'tools', 'vscode')
|
||||
|
||||
print('Running setup for VSCode environment...\n')
|
||||
|
||||
# Determine the platform and architecture.
|
||||
# Chromium development only supports ARM64 and x64 host systems. All other
|
||||
# configurations will be cross-compiled.
|
||||
if sys.platform == 'win32':
|
||||
platform = 'windows'
|
||||
# Windows machines report 'ARM64' or 'AMD64'.
|
||||
machine = 'arm64' if python_platform.machine() == 'ARM64' else 'x64'
|
||||
sampleapp = 'cefclient.exe'
|
||||
testsapp = 'ceftests.exe'
|
||||
elif sys.platform == 'darwin':
|
||||
platform = 'mac'
|
||||
# Mac machines report 'arm64' or 'x86_64'.
|
||||
machine = 'arm64' if python_platform.machine() == 'arm64' else 'x64'
|
||||
sampleapp = 'cefclient.app/Contents/MacOS/cefclient'
|
||||
testsapp = 'ceftests.app/Contents/MacOS/ceftests'
|
||||
elif sys.platform.startswith('linux'):
|
||||
platform = 'linux'
|
||||
# Linux machines report 'aarch64', 'armv7l', 'x86_64', 'i386', etc.
|
||||
machine = 'arm64' if python_platform.machine() == 'aarch64' else 'x64'
|
||||
sampleapp = 'cefclient'
|
||||
testsapp = 'ceftests'
|
||||
else:
|
||||
print('ERROR: Unknown operating system platform.')
|
||||
sys.exit(1)
|
||||
|
||||
debug_out_dir = os.path.join(src_dir, 'out', 'Debug_GN_' + machine)
|
||||
debug_out_dir_exists = os.path.isdir(debug_out_dir)
|
||||
release_out_dir = os.path.join(src_dir, 'out', 'Release_GN_' + machine)
|
||||
release_out_dir_exists = os.path.isdir(release_out_dir)
|
||||
|
||||
if not debug_out_dir_exists and not release_out_dir_exists:
|
||||
print(
|
||||
f'ERROR: Output directories matching your host architecture ({machine}) do not exist.\n'
|
||||
'Check your GN_OUT_CONFIGS environment variable and re-run cef_create_projects before proceeding.'
|
||||
)
|
||||
sys.exit(1)
|
||||
|
||||
out_dir = debug_out_dir if debug_out_dir_exists else release_out_dir
|
||||
|
||||
print(
|
||||
f'Configuring VSCode project files for your host architecture ({machine})...\n'
|
||||
)
|
||||
|
||||
variables = {
|
||||
'ARCH': machine,
|
||||
'DEFAULT': 'Debug' if debug_out_dir_exists else 'Release',
|
||||
'DEBUGGER': 'cppvsdbg' if platform == 'windows' else 'cppdbg',
|
||||
'EXEEXT': '.exe' if platform == 'windows' else '',
|
||||
'SAMPLEAPP': sampleapp,
|
||||
'TESTSAPP': testsapp,
|
||||
}
|
||||
|
||||
vscode_dir = os.path.join(src_dir, '.vscode')
|
||||
if not os.path.isdir(vscode_dir):
|
||||
make_dir(vscode_dir, quiet)
|
||||
|
||||
change_ct = 0
|
||||
|
||||
# Update JSON files if necessary.
|
||||
for json_name in ('cpp.code-snippets', 'extensions.json', 'keybindings.json',
|
||||
'settings.json', 'launch.json', 'tasks.json'):
|
||||
out_path = os.path.join(vscode_dir, json_name)
|
||||
if os.path.isfile(out_path):
|
||||
if not options.force_update:
|
||||
print(f'Skipping existing file {json_name}')
|
||||
continue
|
||||
else:
|
||||
print(f'Backing up existing file {json_name}')
|
||||
backup_file(out_path)
|
||||
|
||||
in_path = os.path.join(in_dir, json_name)
|
||||
if os.path.isfile(in_path):
|
||||
# Copying a CEF file as-is.
|
||||
copy_file(in_path, out_path, quiet)
|
||||
change_ct += 1
|
||||
continue
|
||||
|
||||
in_path += '.in'
|
||||
if os.path.isfile(in_path):
|
||||
# Copying a CEF file with variable substitution.
|
||||
content = read_file(in_path)
|
||||
for name, val in variables.items():
|
||||
content = content.replace('{{' + name + '}}', val)
|
||||
write_file(out_path, content, quiet=quiet)
|
||||
change_ct += 1
|
||||
continue
|
||||
|
||||
in_path = os.path.join(src_dir, 'tools', 'vscode', json_name)
|
||||
if os.path.isfile(in_path):
|
||||
# Copying a Chromium file as-is.
|
||||
copy_file(in_path, out_path, quiet)
|
||||
change_ct += 1
|
||||
continue
|
||||
|
||||
print(f'ERROR: Required input file {json_name} does not exist.')
|
||||
sys.exit(1)
|
||||
|
||||
gclient_path = os.path.join(chromium_dir, '.gclient')
|
||||
if not os.path.isfile(gclient_path):
|
||||
print(f'ERROR: Required input file {gclient_path} does not exist.')
|
||||
sys.exit(1)
|
||||
|
||||
# Setup for clangd.
|
||||
# https://chromium.googlesource.com/chromium/src/+/main/docs/clangd.md
|
||||
content = read_file(gclient_path)
|
||||
if content.find('checkout_clangd') < 0:
|
||||
insert = "'custom_vars': {"
|
||||
content = content.replace(insert, insert + "'checkout_clangd': True, ")
|
||||
write_file(gclient_path, content, quiet=quiet)
|
||||
change_ct += 1
|
||||
|
||||
print('Downloading clangd...')
|
||||
result = exec_cmd('gclient sync --with_branch_heads --nohooks', src_dir)
|
||||
if len(result['err']) > 0:
|
||||
print('ERROR: gclient sync failed: %s' % result['err'])
|
||||
sys.exit(1)
|
||||
|
||||
if not os.path.isfile(os.path.join(src_dir, COMPILE_COMMANDS_JSON)):
|
||||
if UpdateCompileCommandsJSON(src_dir, out_dir, create=True):
|
||||
change_ct += 1
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
||||
if platform == 'mac':
|
||||
# Setup for lldb.
|
||||
# https://chromium.googlesource.com/chromium/src/+/main/docs/lldbinit.md
|
||||
lldbinit_path = os.path.join(src_dir, LLDBINIT)
|
||||
if os.path.isfile(lldbinit_path):
|
||||
if not options.force_update:
|
||||
print(f'Skipping existing file {LLDBINIT}')
|
||||
else:
|
||||
print(f'Backing up existing file {LLDBINIT}')
|
||||
backup_file(lldbinit_path)
|
||||
|
||||
if not os.path.isfile(lldbinit_path):
|
||||
content = "# So that lldbinit.py takes precedence.\n" \
|
||||
f"script sys.path[:0] = ['{src_dir}/tools/lldb']\n" \
|
||||
"script import lldbinit"
|
||||
write_file(lldbinit_path, content, quiet=quiet)
|
||||
change_ct += 1
|
||||
|
||||
if change_ct == 0:
|
||||
print('No work performed.')
|
||||
else:
|
||||
print(f'Updated {change_ct} files.')
|
||||
|
||||
missing_dirs = []
|
||||
if not debug_out_dir_exists:
|
||||
missing_dirs.append('Debug')
|
||||
if not release_out_dir_exists:
|
||||
missing_dirs.append('Release')
|
||||
|
||||
for dir in missing_dirs:
|
||||
print(
|
||||
f'\nWARNING: A {dir} output directory matching your host architecture ({machine}) does\n'
|
||||
f'not exist. You will not be able to build or run {dir} builds with VSCode.'
|
||||
)
|
||||
|
||||
print(
|
||||
'\nFIRST TIME USAGE INSTRUCTIONS\n\n'
|
||||
'1. Install VSCode (including command-line integration) by following the instructions at'
|
||||
'\n https://code.visualstudio.com/docs/setup/setup-overview'
|
||||
'\n\n2. Launch VSCode with the following console commands:\n\n'
|
||||
f' $ cd {src_dir}\n'
|
||||
' $ code .\n'
|
||||
'\n3. Install recommended VSCode extensions when prompted or by following the instructions at'
|
||||
'\n https://chromium.googlesource.com/chromium/src/+/main/docs/vscode.md#Install-Recommended-Extensions\n'
|
||||
)
|
122
tools/vscode/launch.json.in
Normal file
122
tools/vscode/launch.json.in
Normal file
@@ -0,0 +1,122 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "CEF Debug",
|
||||
"type": "{{DEBUGGER}}", // "cppdbg" for GDB/LLDB, "cppvsdbg" for Windows Visual Studio debugger
|
||||
"request": "launch",
|
||||
"program": "${config:cef.outputDirDebug}/${config:cef.launchSampleApp}",
|
||||
"args": [], // Optional command line args
|
||||
"preLaunchTask": "1-build_cef_debug",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${config:cef.outputDirDebug}/",
|
||||
"environment": [],
|
||||
"console": false,
|
||||
"linux": {
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty printing for gdb",
|
||||
"text": "-enable-pretty-printing"
|
||||
},
|
||||
{
|
||||
"description": "Load Chromium gdb configuration",
|
||||
"text": "-interpreter-exec console \"source -v ${workspaceFolder}/tools/gdb/gdbinit\""
|
||||
},
|
||||
{
|
||||
"description": "Load Blink gdb configuration",
|
||||
"text": "-interpreter-exec console \"python import sys; sys.path.insert(0, '${workspaceFolder}/third_party/blink/tools/gdb'); import blink\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"osx": {
|
||||
"MIMode": "lldb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Load lldbinit file",
|
||||
"text": "command source ${workspaceFolder}/.lldbinit",
|
||||
"ignoreFailures": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "CEF Release",
|
||||
"type": "{{DEBUGGER}}", // "cppdbg" for GDB/LLDB, "cppvsdbg" for Windows Visual Studio debugger
|
||||
"request": "launch",
|
||||
"program": "${config:cef.outputDirRelease}/${config:cef.launchSampleApp}",
|
||||
"args": [], // Optional command line args
|
||||
"preLaunchTask": "2-build_cef_release",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${config:cef.outputDirRelease}/",
|
||||
"environment": [],
|
||||
"console": false,
|
||||
"linux": {
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty printing for gdb",
|
||||
"text": "-enable-pretty-printing"
|
||||
},
|
||||
{
|
||||
"description": "Load Chromium gdb configuration",
|
||||
"text": "-interpreter-exec console \"source -v ${workspaceFolder}/tools/gdb/gdbinit\""
|
||||
},
|
||||
{
|
||||
"description": "Load Blink gdb configuration",
|
||||
"text": "-interpreter-exec console \"python import sys; sys.path.insert(0, '${workspaceFolder}/third_party/blink/tools/gdb'); import blink\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"osx": {
|
||||
"MIMode": "lldb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Load lldbinit file",
|
||||
"text": "command source ${workspaceFolder}/.lldbinit",
|
||||
"ignoreFailures": false
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "Custom Tests Debug",
|
||||
"type": "{{DEBUGGER}}", // "cppdbg" for GDB/LLDB, "cppvsdbg" for Windows Visual Studio debugger
|
||||
"request": "launch",
|
||||
"program": "${config:cef.outputDirDebug}/${config:cef.launchTestsApp}",
|
||||
"args": [
|
||||
"--use-views",
|
||||
"--gtest_filter=*"
|
||||
],
|
||||
"preLaunchTask": "5-build_tests_debug",
|
||||
"stopAtEntry": false,
|
||||
"cwd": "${config:cef.outputDirDebug}/",
|
||||
"environment": [],
|
||||
"console": true,
|
||||
"linux": {
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty printing for gdb",
|
||||
"text": "-enable-pretty-printing"
|
||||
},
|
||||
{
|
||||
"description": "Load Chromium gdb configuration",
|
||||
"text": "-interpreter-exec console \"source -v ${workspaceFolder}/tools/gdb/gdbinit\""
|
||||
},
|
||||
{
|
||||
"description": "Load Blink gdb configuration",
|
||||
"text": "-interpreter-exec console \"python import sys; sys.path.insert(0, '${workspaceFolder}/third_party/blink/tools/gdb'); import blink\""
|
||||
}
|
||||
]
|
||||
},
|
||||
"osx": {
|
||||
"MIMode": "lldb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Load lldbinit file",
|
||||
"text": "command source ${workspaceFolder}/.lldbinit",
|
||||
"ignoreFailures": false
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
99
tools/vscode/settings.json.in
Normal file
99
tools/vscode/settings.json.in
Normal file
@@ -0,0 +1,99 @@
|
||||
{
|
||||
// Suggested vscode default settings for simplifying initial setup. These
|
||||
// settings are hoped to be convenient and helpful for those beginning to use
|
||||
// vscode with Chrome. Please modify and change as necessary.
|
||||
// All settings are optional, but some more "optional" settings at the end
|
||||
// are disabled by default. Feel free to enable them.
|
||||
// Default tab size of 2, for consistency with internal codebase.
|
||||
"editor.tabSize": 2,
|
||||
// Do not figure out tab size from opening a file.
|
||||
"editor.detectIndentation": false,
|
||||
// Add a line at 80 characters.
|
||||
"editor.rulers": [
|
||||
80
|
||||
],
|
||||
// Except for Java where we add a line at 100 characters per that style guide
|
||||
// and the tab width should be 4 spaces.
|
||||
// The chrome java style guide:
|
||||
// https://chromium.googlesource.com/chromium/src/+/main/styleguide/java/java.md
|
||||
// does not override this and defers to the android style guide:
|
||||
// https://source.android.com/docs/setup/contribute/code-style
|
||||
"[java]": {
|
||||
"editor.rulers": [
|
||||
100
|
||||
],
|
||||
"editor.tabSize": 4
|
||||
},
|
||||
// Forces LF instead of "auto" which uses CRLF on Windows.
|
||||
"files.eol": "\n",
|
||||
// Trim tailing whitespace on save.
|
||||
"files.trimTrailingWhitespace": true,
|
||||
// Insert trimmed final new line.
|
||||
"files.insertFinalNewline": true,
|
||||
"files.trimFinalNewlines": true,
|
||||
"files.associations": {
|
||||
// Adds xml syntax highlighting for grd files.
|
||||
"*.grd": "xml"
|
||||
},
|
||||
"files.exclude": {
|
||||
// Ignore build output folders.
|
||||
"out*/**": true
|
||||
},
|
||||
"files.watcherExclude": {
|
||||
// Don't watch out*/ and third_party/ for changes to fix an issue
|
||||
// where vscode doesn't notice that files have changed.
|
||||
// https://github.com/Microsoft/vscode/issues/3998
|
||||
// There is currently another issue that requires a leading **/ for
|
||||
// watcherExlude. Beware that this pattern might affect other out* folders
|
||||
// like src/cc/output/.
|
||||
"**/out*/**": true,
|
||||
"**/third_party/**": true
|
||||
},
|
||||
// C++ clang format settings. |workspaceFolder| is assumed to be Chromium's
|
||||
// src/ directory.
|
||||
"C_Cpp.clang_format_path": "${workspaceFolder}/third_party/depot_tools/clang-format",
|
||||
"C_Cpp.clang_format_sortIncludes": true,
|
||||
// Avoid conflicts with vscode-clangd extension.
|
||||
"C_Cpp.intelliSenseEngine": "disabled",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.formatOnSaveMode": "modifications",
|
||||
// Don't format HTML files automatically on save, as VSCode's default
|
||||
// formatter doesn't deal well with Chromium Polymer files.
|
||||
"[html]": {
|
||||
"editor.formatOnSave": false
|
||||
},
|
||||
// Disable automatic task detection to speed up opening the task menu.
|
||||
"task.autoDetect": "off",
|
||||
// Used by launch.json and tasks.json for integration with CEF tests and builds.
|
||||
"cef.outputDirDebug": "${workspaceFolder}/out/Debug_GN_{{ARCH}}",
|
||||
"cef.outputDirDebugRelative": "out/Debug_GN_{{ARCH}}",
|
||||
"cef.outputDirRelease": "${workspaceFolder}/out/Release_GN_{{ARCH}}",
|
||||
"cef.outputDirReleaseRelative": "out/Release_GN_{{ARCH}}",
|
||||
// Used by tasks.json for discovery of generated files.
|
||||
"cef.outputDirDefault": "${workspaceFolder}/out/{{DEFAULT}}_GN_{{ARCH}}",
|
||||
// Used by launch.json for launching apps.
|
||||
"cef.launchSampleApp": "{{SAMPLEAPP}}",
|
||||
"cef.launchTestsApp": "{{TESTSAPP}}",
|
||||
// Path installed by Chromium.
|
||||
"clangd.path": "${workspaceFolder}/third_party/llvm-build/Release+Asserts/bin/clangd{{EXEEXT}}",
|
||||
// Optional: Wider author column for annotator extension.
|
||||
// https://marketplace.visualstudio.com/items?itemName=ryu1kn.annotator
|
||||
// "annotator.annotationColumnWidth": "24em",
|
||||
// Optional: Highlight current line at the left of the editor.
|
||||
// "editor.renderLineHighlight": "gutter",
|
||||
// Optional: Don't automatically add closing brackets. It gets in the way.
|
||||
// "editor.autoClosingBrackets": "never",
|
||||
// Optional: Enable a tiny 30k feet view of your doc.
|
||||
// "editor.minimap.enabled": true,
|
||||
// "editor.minimap.maxColumn": 80,
|
||||
// "editor.minimap.renderCharacters": false,
|
||||
// Optional: Don't continuously fetch remote changes.
|
||||
"git.autofetch": false
|
||||
// Optional: Do not open files in 'preview' mode. Opening a new file in can
|
||||
// replace an existing one in preview mode, which can be confusing.
|
||||
//"workbench.editor.enablePreview": false,
|
||||
// Optional: Same for files opened from quick open (Ctrl+P).
|
||||
//"workbench.editor.enablePreviewFromQuickOpen": false,
|
||||
// Optional: Enable Python type checking.
|
||||
//"python.analysis.typeCheckingMode": "basic"
|
||||
}
|
193
tools/vscode/tasks.json
Normal file
193
tools/vscode/tasks.json
Normal file
@@ -0,0 +1,193 @@
|
||||
{
|
||||
"version": "2.0.0",
|
||||
"runner": "terminal",
|
||||
// The default problem matcher matches build output, which is useful for most tasks.
|
||||
"problemMatcher": [
|
||||
// Matches output from clang.
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": ["relative", "${config:cef.outputDirDefault}"],
|
||||
"pattern": {
|
||||
"regexp": "^(gen/.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
|
||||
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": ["relative", "${workspaceFolder}"],
|
||||
"pattern": {
|
||||
"regexp": "^../../(.*):(\\d+):(\\d+):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
|
||||
"file": 1, "line": 2, "column": 3, "severity": 4, "message": 5
|
||||
}
|
||||
},
|
||||
// Matches output from clang-cl / msvc.
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${config:cef.outputDirDefault}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^(gen/.*)\\((\\d+),(\\d+)\\):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": [
|
||||
"relative",
|
||||
"${workspaceFolder}"
|
||||
],
|
||||
"pattern": {
|
||||
"regexp": "^../../(.*)\\((\\d+),(\\d+)\\):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": ["relative", "${config:cef.outputDirDefault}"],
|
||||
"pattern": {
|
||||
"regexp": "^(gen/.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
|
||||
"file": 1, "severity": 3, "message": 4
|
||||
}
|
||||
},
|
||||
{
|
||||
"owner": "cpp",
|
||||
"fileLocation": ["relative", "${workspaceFolder}"],
|
||||
"pattern": {
|
||||
"regexp": "^../../(.*?):(.*):\\s+(warning|\\w*\\s?error):\\s+(.*)$",
|
||||
"file": 1, "severity": 3, "message": 4
|
||||
}
|
||||
}
|
||||
],
|
||||
"options": {
|
||||
// It's important to set the CWD to the output directory so that file paths
|
||||
// are linked correctly in the terminal output.
|
||||
"cwd": "${config:cef.outputDirDefault}",
|
||||
"env": {
|
||||
// If depot_tools aren't already available in the PATH provided to vscode,
|
||||
// you can configure it in the next line.
|
||||
// "PATH": "<DEPOT_TOOLS_LOCATION>:${env:PATH}"
|
||||
// Alternatively, if you have configured depot_tools for ChromiumIDE, you
|
||||
// can just uncomment the following line:
|
||||
// "PATH": "${config:chromiumide.paths.depotTools}:${env:PATH}"
|
||||
}
|
||||
},
|
||||
|
||||
"inputs": [
|
||||
{
|
||||
"type": "pickString",
|
||||
"id": "cefOutputDir",
|
||||
"description": "CEF output directory:",
|
||||
// Configure this to point to all the output directories you use (as a
|
||||
// relative path from ${workspaceFolder}).
|
||||
"options": [
|
||||
"${config:cef.outputDirDebugRelative}",
|
||||
"${config:cef.outputDirReleaseRelative}"
|
||||
]
|
||||
}
|
||||
],
|
||||
"tasks": [
|
||||
// * If you want to be prompted for the output directory each
|
||||
// time you run a command, replace
|
||||
// ${config:cef.outputDir[Debug|Release]Relative}
|
||||
// with
|
||||
// ${input:cefOutputDir}
|
||||
//
|
||||
// * If you want to have different tasks for different output directories,
|
||||
// just create duplicate tasks and hard-code the output directory used.
|
||||
{
|
||||
"label": "1-build_cef_debug",
|
||||
"type": "shell",
|
||||
"command": "autoninja",
|
||||
"args": [
|
||||
"-C",
|
||||
"${config:cef.outputDirDebugRelative}",
|
||||
"cef"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "2-build_cef_release",
|
||||
"type": "shell",
|
||||
"command": "autoninja",
|
||||
"args": [
|
||||
"-C",
|
||||
"${config:cef.outputDirReleaseRelative}",
|
||||
"cef"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
},
|
||||
"group": {
|
||||
"kind": "build"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "3-build_current_file_debug",
|
||||
"type": "shell",
|
||||
"command": "compile_single_file",
|
||||
"args": [
|
||||
"--build-dir=${config:cef.outputDirDebugRelative}",
|
||||
"--file-path=${file}"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "4-build_current_file_release",
|
||||
"type": "shell",
|
||||
"command": "compile_single_file",
|
||||
"args": [
|
||||
"--build-dir=${config:cef.outputDirReleaseRelative}",
|
||||
"--file-path=${file}"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "5-build_tests_debug",
|
||||
"type": "shell",
|
||||
"command": "autoninja",
|
||||
"args": [
|
||||
"-C",
|
||||
"${config:cef.outputDirDebugRelative}",
|
||||
"ceftests",
|
||||
"libcef_static_unittests"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "6-build_tests_release",
|
||||
"type": "shell",
|
||||
"command": "autoninja",
|
||||
"args": [
|
||||
"-C",
|
||||
"${config:cef.outputDirReleaseRelative}",
|
||||
"ceftests",
|
||||
"libcef_static_unittests"
|
||||
],
|
||||
"options": {
|
||||
"cwd": "${workspaceFolder}"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
Reference in New Issue
Block a user