mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Update source files for bracket style
This commit is contained in:
@@ -140,8 +140,9 @@ void CefBrowserPlatformDelegateChrome::set_chrome_browser(Browser* browser) {
|
||||
}
|
||||
|
||||
gfx::NativeWindow CefBrowserPlatformDelegateChrome::GetNativeWindow() const {
|
||||
if (chrome_browser_ && chrome_browser_->window())
|
||||
if (chrome_browser_ && chrome_browser_->window()) {
|
||||
return chrome_browser_->window()->GetNativeWindow();
|
||||
}
|
||||
NOTREACHED();
|
||||
return gfx::NativeWindow();
|
||||
}
|
||||
|
@@ -234,8 +234,9 @@ void ChromeBrowserDelegate::EnterFullscreenModeForTab(
|
||||
const blink::mojom::FullscreenOptions& options) {
|
||||
auto web_contents =
|
||||
content::WebContents::FromRenderFrameHost(requesting_frame);
|
||||
if (!web_contents)
|
||||
if (!web_contents) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (auto delegate = GetDelegateForWebContents(web_contents)) {
|
||||
delegate->EnterFullscreenModeForTab(requesting_frame, options);
|
||||
@@ -334,8 +335,9 @@ CefBrowserContentsDelegate* ChromeBrowserDelegate::GetDelegateForWebContents(
|
||||
content::WebContents* web_contents) {
|
||||
auto browser_host =
|
||||
ChromeBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
if (browser_host)
|
||||
if (browser_host) {
|
||||
return browser_host->contents_delegate();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -134,11 +134,13 @@ void ChromeBrowserHostImpl::OnSetFocus(cef_focus_source_t source) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (contents_delegate_->OnSetFocus(source))
|
||||
if (contents_delegate_->OnSetFocus(source)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SetFocus(true);
|
||||
}
|
||||
|
||||
if (browser_) {
|
||||
const int tab_index = GetCurrentTabIndex();
|
||||
@@ -164,8 +166,9 @@ CefWindowHandle ChromeBrowserHostImpl::GetWindowHandle() {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
// Always return the most up-to-date window handle for a views-hosted
|
||||
// browser since it may change if the view is re-parented.
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
return platform_delegate_->GetHostWindowHandle();
|
||||
}
|
||||
}
|
||||
return host_window_handle_;
|
||||
}
|
||||
@@ -337,8 +340,9 @@ bool ChromeBrowserHostImpl::Navigate(const content::OpenURLParams& params) {
|
||||
|
||||
if (browser_) {
|
||||
GURL gurl = params.url;
|
||||
if (!url_util::FixupGURL(gurl))
|
||||
if (!url_util::FixupGURL(gurl)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// This is generally equivalent to calling Browser::OpenURL, except:
|
||||
// 1. It doesn't trigger a call to CefRequestHandler::OnOpenURLFromTab, and
|
||||
@@ -354,8 +358,9 @@ bool ChromeBrowserHostImpl::Navigate(const content::OpenURLParams& params) {
|
||||
nav_params.source_contents = GetWebContents();
|
||||
|
||||
nav_params.tabstrip_add_types = AddTabTypes::ADD_NONE;
|
||||
if (params.user_gesture)
|
||||
if (params.user_gesture) {
|
||||
nav_params.window_action = NavigateParams::SHOW_WINDOW;
|
||||
}
|
||||
::Navigate(&nav_params);
|
||||
return true;
|
||||
}
|
||||
@@ -498,8 +503,9 @@ void ChromeBrowserHostImpl::SetBrowser(Browser* browser) {
|
||||
browser_ = browser;
|
||||
static_cast<CefBrowserPlatformDelegateChrome*>(platform_delegate_.get())
|
||||
->set_chrome_browser(browser);
|
||||
if (browser_)
|
||||
if (browser_) {
|
||||
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
|
||||
}
|
||||
}
|
||||
|
||||
void ChromeBrowserHostImpl::WindowDestroyed() {
|
||||
|
@@ -18,8 +18,9 @@ ChromeBrowserMainExtraPartsCef::~ChromeBrowserMainExtraPartsCef() = default;
|
||||
|
||||
void ChromeBrowserMainExtraPartsCef::PostProfileInit(Profile* profile,
|
||||
bool is_initial_profile) {
|
||||
if (!is_initial_profile)
|
||||
if (!is_initial_profile) {
|
||||
return;
|
||||
}
|
||||
|
||||
CefRequestContextSettings settings;
|
||||
CefContext::Get()->PopulateGlobalRequestContextSettings(&settings);
|
||||
|
@@ -58,8 +58,9 @@ void HandleExternalProtocolHelper(
|
||||
// May return nullptr if frame has been deleted or a cross-document navigation
|
||||
// has committed in the same RenderFrameHost.
|
||||
auto initiator_rfh = initiator_document.AsRenderFrameHostIfValid();
|
||||
if (!initiator_rfh)
|
||||
if (!initiator_rfh) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Match the logic of the original call in
|
||||
// NavigationURLLoaderImpl::PrepareForNonInterceptedRequest.
|
||||
@@ -253,8 +254,9 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
|
||||
// For example, the User Manager profile created via
|
||||
// profiles::CreateSystemProfileForUserManager.
|
||||
auto profile = Profile::FromBrowserContext(browser_context);
|
||||
if (!CefBrowserContext::FromProfile(profile))
|
||||
if (!CefBrowserContext::FromProfile(profile)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto request_handler = net_service::CreateInterceptedRequestHandler(
|
||||
browser_context, frame, render_process_id,
|
||||
|
@@ -40,8 +40,9 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
|
||||
bool IsCommandIdSupported(int command_id) override {
|
||||
// Always claim support for the reserved user ID range.
|
||||
if (command_id >= MENU_ID_USER_FIRST && command_id <= MENU_ID_USER_LAST)
|
||||
if (command_id >= MENU_ID_USER_FIRST && command_id <= MENU_ID_USER_LAST) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Also claim support in specific cases where an ItemInfo exists.
|
||||
return GetItemInfo(command_id) != nullptr;
|
||||
@@ -104,25 +105,29 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
|
||||
void SetChecked(int command_id, bool checked) override {
|
||||
// No-op if already at the default state.
|
||||
if (!checked && !GetItemInfo(command_id))
|
||||
if (!checked && !GetItemInfo(command_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* info = GetOrCreateItemInfo(command_id);
|
||||
info->checked = checked;
|
||||
if (!checked)
|
||||
if (!checked) {
|
||||
MaybeDeleteItemInfo(command_id, info);
|
||||
}
|
||||
}
|
||||
|
||||
void SetAccelerator(int command_id,
|
||||
absl::optional<ui::Accelerator> accel) override {
|
||||
// No-op if already at the default state.
|
||||
if (!accel && !GetItemInfo(command_id))
|
||||
if (!accel && !GetItemInfo(command_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto* info = GetOrCreateItemInfo(command_id);
|
||||
info->accel = accel;
|
||||
if (!accel)
|
||||
if (!accel) {
|
||||
MaybeDeleteItemInfo(command_id, info);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -142,8 +147,9 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
|
||||
}
|
||||
|
||||
ItemInfo* GetOrCreateItemInfo(int command_id) {
|
||||
if (auto info = GetItemInfo(command_id))
|
||||
if (auto info = GetItemInfo(command_id)) {
|
||||
return info;
|
||||
}
|
||||
|
||||
auto result = iteminfomap_.insert(std::make_pair(command_id, ItemInfo()));
|
||||
return &result.first->second;
|
||||
|
@@ -32,8 +32,9 @@ class PopupWindowDelegate : public CefWindowDelegate {
|
||||
|
||||
bool CanClose(CefRefPtr<CefWindow> window) override {
|
||||
CefRefPtr<CefBrowser> browser = browser_view_->GetBrowser();
|
||||
if (browser)
|
||||
if (browser) {
|
||||
return browser->GetHost()->TryCloseBrowser();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -49,8 +50,9 @@ CefBrowserPlatformDelegateChromeViews::CefBrowserPlatformDelegateChromeViews(
|
||||
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate,
|
||||
CefRefPtr<CefBrowserViewImpl> browser_view)
|
||||
: CefBrowserPlatformDelegateChrome(std::move(native_delegate)) {
|
||||
if (browser_view)
|
||||
if (browser_view) {
|
||||
SetBrowserView(browser_view);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::SetBrowserView(
|
||||
@@ -74,13 +76,15 @@ void CefBrowserPlatformDelegateChromeViews::BrowserCreated(
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserCreated() {
|
||||
if (browser_view_->delegate())
|
||||
if (browser_view_->delegate()) {
|
||||
browser_view_->delegate()->OnBrowserCreated(browser_view_, browser_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::NotifyBrowserDestroyed() {
|
||||
if (browser_view_->delegate())
|
||||
if (browser_view_->delegate()) {
|
||||
browser_view_->delegate()->OnBrowserDestroyed(browser_view_, browser_);
|
||||
}
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::BrowserDestroyed(
|
||||
@@ -91,8 +95,9 @@ void CefBrowserPlatformDelegateChromeViews::BrowserDestroyed(
|
||||
|
||||
void CefBrowserPlatformDelegateChromeViews::CloseHostWindow() {
|
||||
views::Widget* widget = GetWindowWidget();
|
||||
if (widget && !widget->IsClosed())
|
||||
if (widget && !widget->IsClosed()) {
|
||||
widget->Close();
|
||||
}
|
||||
}
|
||||
|
||||
CefWindowHandle CefBrowserPlatformDelegateChromeViews::GetHostWindowHandle()
|
||||
@@ -101,8 +106,9 @@ CefWindowHandle CefBrowserPlatformDelegateChromeViews::GetHostWindowHandle()
|
||||
}
|
||||
|
||||
views::Widget* CefBrowserPlatformDelegateChromeViews::GetWindowWidget() const {
|
||||
if (browser_view_->root_view())
|
||||
if (browser_view_->root_view()) {
|
||||
return browser_view_->root_view()->GetWidget();
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@@ -53,8 +53,9 @@ void ChromeBrowserView::ViewHierarchyChanged(
|
||||
// this View to a CefWindow with FillLayout and then calling
|
||||
// CefWindow::Show() without first resizing the CefWindow.
|
||||
size = details.parent->GetPreferredSize();
|
||||
if (!size.IsEmpty())
|
||||
if (!size.IsEmpty()) {
|
||||
SetSize(size);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -47,8 +47,9 @@ class ChildWindowDelegate : public CefWindowDelegate {
|
||||
|
||||
CefRect GetInitialBounds(CefRefPtr<CefWindow> window) override {
|
||||
CefRect initial_bounds(window_info_.bounds);
|
||||
if (initial_bounds.IsEmpty())
|
||||
if (initial_bounds.IsEmpty()) {
|
||||
return CefRect(0, 0, 800, 600);
|
||||
}
|
||||
return initial_bounds;
|
||||
}
|
||||
|
||||
@@ -174,15 +175,18 @@ CefRefPtr<CefBrowserHostBase> MaybeCreateChildBrowser(
|
||||
const CefBrowserCreateParams& create_params) {
|
||||
// If the BrowserView already exists it means that we're dealing with a popup
|
||||
// and we'll instead create the Window in OnPopupBrowserViewCreated.
|
||||
if (create_params.browser_view)
|
||||
if (create_params.browser_view) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (!create_params.window_info)
|
||||
if (!create_params.window_info) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const auto parent_handle = GetParentHandle(*create_params.window_info);
|
||||
if (parent_handle == gfx::kNullAcceleratedWidget)
|
||||
if (parent_handle == gfx::kNullAcceleratedWidget) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Create the BrowserView.
|
||||
auto browser_view = CefBrowserViewImpl::Create(
|
||||
|
Reference in New Issue
Block a user