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:
@@ -80,22 +80,25 @@ class CefVisitedLinkListener : public visitedlink::VisitedLinkWriter::Listener {
|
||||
void NewTable(base::ReadOnlySharedMemoryRegion* table_region) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
for (; it != listener_map_.end(); ++it) {
|
||||
it->second->NewTable(table_region);
|
||||
}
|
||||
}
|
||||
|
||||
void Add(visitedlink::VisitedLinkCommon::Fingerprint fingerprint) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
for (; it != listener_map_.end(); ++it) {
|
||||
it->second->Add(fingerprint);
|
||||
}
|
||||
}
|
||||
|
||||
void Reset(bool invalidate_hashes) override {
|
||||
CEF_REQUIRE_UIT();
|
||||
ListenerMap::iterator it = listener_map_.begin();
|
||||
for (; it != listener_map_.end(); ++it)
|
||||
for (; it != listener_map_.end(); ++it) {
|
||||
it->second->Reset(invalidate_hashes);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -161,8 +164,9 @@ void AlloyBrowserContext::Initialize() {
|
||||
|
||||
// Initialize visited links management.
|
||||
base::FilePath visited_link_path;
|
||||
if (!cache_path_.empty())
|
||||
if (!cache_path_.empty()) {
|
||||
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
|
||||
}
|
||||
visitedlink_listener_ = new CefVisitedLinkListener;
|
||||
visitedlink_master_.reset(new visitedlink::VisitedLinkWriter(
|
||||
visitedlink_listener_, this, !visited_link_path.empty(), false,
|
||||
@@ -181,8 +185,9 @@ void AlloyBrowserContext::Initialize() {
|
||||
user_prefs::UserPrefs::Set(this, pref_service);
|
||||
key_->SetPrefs(pref_service);
|
||||
|
||||
if (extensions_enabled)
|
||||
if (extensions_enabled) {
|
||||
extension_system_->Init();
|
||||
}
|
||||
|
||||
ChromePluginServiceFilter::GetInstance()->RegisterProfile(this);
|
||||
|
||||
@@ -227,8 +232,9 @@ void AlloyBrowserContext::Shutdown() {
|
||||
|
||||
// Delete the download manager delegate here because otherwise we'll crash
|
||||
// when it's accessed from the content::BrowserContext destructor.
|
||||
if (download_manager_delegate_)
|
||||
if (download_manager_delegate_) {
|
||||
download_manager_delegate_.reset(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserContext::RemoveCefRequestContext(
|
||||
@@ -249,8 +255,9 @@ void AlloyBrowserContext::LoadExtension(
|
||||
CefRefPtr<CefExtensionHandler> handler,
|
||||
CefRefPtr<CefRequestContext> loader_context) {
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
if (handler)
|
||||
if (handler) {
|
||||
handler->OnExtensionLoadFailed(ERR_ABORTED);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -267,23 +274,26 @@ void AlloyBrowserContext::LoadExtension(
|
||||
}
|
||||
|
||||
bool AlloyBrowserContext::GetExtensions(std::vector<CefString>& extension_ids) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
extensions::CefExtensionSystem::ExtensionMap extension_map =
|
||||
extension_system()->GetExtensions();
|
||||
extensions::CefExtensionSystem::ExtensionMap::const_iterator it =
|
||||
extension_map.begin();
|
||||
for (; it != extension_map.end(); ++it)
|
||||
for (; it != extension_map.end(); ++it) {
|
||||
extension_ids.push_back(it->second->GetIdentifier());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
CefRefPtr<CefExtension> AlloyBrowserContext::GetExtension(
|
||||
const CefString& extension_id) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return extension_system()->GetExtension(extension_id);
|
||||
}
|
||||
@@ -295,8 +305,9 @@ bool AlloyBrowserContext::UnloadExtension(const CefString& extension_id) {
|
||||
|
||||
bool AlloyBrowserContext::IsPrintPreviewSupported() const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (!extensions::PrintPreviewEnabled())
|
||||
if (!extensions::PrintPreviewEnabled()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !GetPrefs()->GetBoolean(prefs::kPrintPreviewDisabled);
|
||||
}
|
||||
@@ -334,8 +345,9 @@ base::FilePath AlloyBrowserContext::GetPath() const {
|
||||
std::unique_ptr<content::ZoomLevelDelegate>
|
||||
AlloyBrowserContext::CreateZoomLevelDelegate(
|
||||
const base::FilePath& partition_path) {
|
||||
if (cache_path_.empty())
|
||||
if (cache_path_.empty()) {
|
||||
return std::unique_ptr<content::ZoomLevelDelegate>();
|
||||
}
|
||||
|
||||
return base::WrapUnique(new ChromeZoomLevelPrefs(
|
||||
GetPrefs(), cache_path_, partition_path,
|
||||
@@ -352,8 +364,9 @@ AlloyBrowserContext::GetDownloadManagerDelegate() {
|
||||
}
|
||||
|
||||
content::BrowserPluginGuestManager* AlloyBrowserContext::GetGuestManager() {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return nullptr;
|
||||
}
|
||||
return guest_view::GuestViewManager::FromBrowserContext(this);
|
||||
}
|
||||
|
||||
@@ -376,8 +389,9 @@ AlloyBrowserContext::GetStorageNotificationService() {
|
||||
}
|
||||
|
||||
content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() {
|
||||
if (!ssl_host_state_delegate_)
|
||||
if (!ssl_host_state_delegate_) {
|
||||
ssl_host_state_delegate_.reset(new CefSSLHostStateDelegate());
|
||||
}
|
||||
return ssl_host_state_delegate_.get();
|
||||
}
|
||||
|
||||
|
@@ -130,8 +130,9 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::Create(
|
||||
static_cast<AlloyBrowserHostImpl*>(create_params.devtools_opener.get()),
|
||||
is_devtools_popup, request_context_impl, std::move(platform_delegate),
|
||||
cef_extension);
|
||||
if (!browser)
|
||||
if (!browser) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
GURL url = url_util::MakeGURL(create_params.url, /*fixup=*/true);
|
||||
|
||||
@@ -173,8 +174,9 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
if (opener) {
|
||||
if (!opener->platform_delegate_) {
|
||||
// The opener window is being destroyed. Cancel the popup.
|
||||
if (own_web_contents)
|
||||
if (own_web_contents) {
|
||||
delete web_contents;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -193,8 +195,9 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
|
||||
std::move(platform_delegate), extension);
|
||||
browser->InitializeBrowser();
|
||||
|
||||
if (!browser->CreateHostWindow())
|
||||
if (!browser->CreateHostWindow()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Notify that the browser has been created. These must be delivered in the
|
||||
// expected order.
|
||||
@@ -316,8 +319,9 @@ CefWindowHandle AlloyBrowserHostImpl::GetWindowHandle() {
|
||||
if (is_views_hosted_ && 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_;
|
||||
}
|
||||
@@ -333,16 +337,18 @@ double AlloyBrowserHostImpl::GetZoomLevel() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (web_contents())
|
||||
if (web_contents()) {
|
||||
return content::HostZoomMap::GetZoomLevel(web_contents());
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetZoomLevel(double zoomLevel) {
|
||||
if (CEF_CURRENTLY_ON_UIT()) {
|
||||
if (web_contents())
|
||||
if (web_contents()) {
|
||||
content::HostZoomMap::SetZoomLevel(web_contents(), zoomLevel);
|
||||
}
|
||||
} else {
|
||||
CEF_POST_TASK(CEF_UIT, base::BindOnce(&AlloyBrowserHostImpl::SetZoomLevel,
|
||||
this, zoomLevel));
|
||||
@@ -372,8 +378,9 @@ void AlloyBrowserHostImpl::StopFinding(bool clearSelection) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->StopFinding(clearSelection);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
@@ -387,8 +394,9 @@ void AlloyBrowserHostImpl::ShowDevTools(const CefWindowInfo& windowInfo,
|
||||
return;
|
||||
}
|
||||
|
||||
if (!EnsureDevToolsManager())
|
||||
if (!EnsureDevToolsManager()) {
|
||||
return;
|
||||
}
|
||||
devtools_manager_->ShowDevTools(windowInfo, client, settings,
|
||||
inspect_element_at);
|
||||
}
|
||||
@@ -400,8 +408,9 @@ void AlloyBrowserHostImpl::CloseDevTools() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!devtools_manager_)
|
||||
if (!devtools_manager_) {
|
||||
return;
|
||||
}
|
||||
devtools_manager_->CloseDevTools();
|
||||
}
|
||||
|
||||
@@ -411,8 +420,9 @@ bool AlloyBrowserHostImpl::HasDevTools() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!devtools_manager_)
|
||||
if (!devtools_manager_) {
|
||||
return false;
|
||||
}
|
||||
return devtools_manager_->HasDevTools();
|
||||
}
|
||||
|
||||
@@ -464,8 +474,9 @@ void AlloyBrowserHostImpl::WasResized() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->WasResized();
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::WasHidden(bool hidden) {
|
||||
@@ -480,8 +491,9 @@ void AlloyBrowserHostImpl::WasHidden(bool hidden) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->WasHidden(hidden);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::NotifyScreenInfoChanged() {
|
||||
@@ -497,8 +509,9 @@ void AlloyBrowserHostImpl::NotifyScreenInfoChanged() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->NotifyScreenInfoChanged();
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
@@ -513,8 +526,9 @@ void AlloyBrowserHostImpl::Invalidate(PaintElementType type) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->Invalidate(type);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SendExternalBeginFrame() {
|
||||
@@ -530,8 +544,9 @@ void AlloyBrowserHostImpl::SendExternalBeginFrame() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SendExternalBeginFrame();
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) {
|
||||
@@ -546,8 +561,9 @@ void AlloyBrowserHostImpl::SendTouchEvent(const CefTouchEvent& event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SendTouchEvent(event);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SendCaptureLostEvent() {
|
||||
@@ -558,8 +574,9 @@ void AlloyBrowserHostImpl::SendCaptureLostEvent() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SendCaptureLostEvent();
|
||||
}
|
||||
}
|
||||
|
||||
int AlloyBrowserHostImpl::GetWindowlessFrameRate() {
|
||||
@@ -582,8 +599,9 @@ void AlloyBrowserHostImpl::SetWindowlessFrameRate(int frame_rate) {
|
||||
|
||||
settings_.windowless_frame_rate = frame_rate;
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SetWindowlessFrameRate(frame_rate);
|
||||
}
|
||||
}
|
||||
|
||||
// AlloyBrowserHostImpl public methods.
|
||||
@@ -635,10 +653,12 @@ void AlloyBrowserHostImpl::DestroyBrowser() {
|
||||
OnBeforeClose();
|
||||
|
||||
// Destroy any platform constructs first.
|
||||
if (javascript_dialog_manager_.get())
|
||||
if (javascript_dialog_manager_.get()) {
|
||||
javascript_dialog_manager_->Destroy();
|
||||
if (menu_manager_.get())
|
||||
}
|
||||
if (menu_manager_.get()) {
|
||||
menu_manager_->Destroy();
|
||||
}
|
||||
|
||||
// Notify any observers that may have state associated with this browser.
|
||||
OnBrowserDestroyed();
|
||||
@@ -670,8 +690,9 @@ void AlloyBrowserHostImpl::DestroyBrowser() {
|
||||
|
||||
void AlloyBrowserHostImpl::CancelContextMenu() {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (menu_manager_)
|
||||
if (menu_manager_) {
|
||||
menu_manager_->CancelContextMenu();
|
||||
}
|
||||
}
|
||||
|
||||
bool AlloyBrowserHostImpl::MaybeAllowNavigation(
|
||||
@@ -710,11 +731,13 @@ void AlloyBrowserHostImpl::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);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::EnterFullscreenModeForTab(
|
||||
@@ -842,8 +865,9 @@ void AlloyBrowserHostImpl::ImeCancelComposition() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->ImeCancelComposition();
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::DragTargetDragEnter(
|
||||
@@ -905,8 +929,9 @@ void AlloyBrowserHostImpl::DragTargetDragLeave() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->DragTargetDragLeave();
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
|
||||
@@ -921,8 +946,9 @@ void AlloyBrowserHostImpl::DragTargetDrop(const CefMouseEvent& event) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->DragTargetDrop(event);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::DragSourceSystemDragEnded() {
|
||||
@@ -938,8 +964,9 @@ void AlloyBrowserHostImpl::DragSourceSystemDragEnded() {
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->DragSourceSystemDragEnded();
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::DragSourceEndedAt(
|
||||
@@ -958,8 +985,9 @@ void AlloyBrowserHostImpl::DragSourceEndedAt(
|
||||
return;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->DragSourceEndedAt(x, y, op);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
@@ -968,8 +996,9 @@ void AlloyBrowserHostImpl::SetAudioMuted(bool mute) {
|
||||
this, mute));
|
||||
return;
|
||||
}
|
||||
if (!web_contents())
|
||||
if (!web_contents()) {
|
||||
return;
|
||||
}
|
||||
web_contents()->SetAudioMuted(mute);
|
||||
}
|
||||
|
||||
@@ -978,8 +1007,9 @@ bool AlloyBrowserHostImpl::IsAudioMuted() {
|
||||
NOTREACHED() << "called on invalid thread";
|
||||
return false;
|
||||
}
|
||||
if (!web_contents())
|
||||
if (!web_contents()) {
|
||||
return false;
|
||||
}
|
||||
return web_contents()->IsAudioMuted();
|
||||
}
|
||||
|
||||
@@ -1028,8 +1058,9 @@ void AlloyBrowserHostImpl::LoadingStateChanged(content::WebContents* source,
|
||||
void AlloyBrowserHostImpl::CloseContents(content::WebContents* source) {
|
||||
CEF_REQUIRE_UIT();
|
||||
|
||||
if (destruction_state_ == DESTRUCTION_STATE_COMPLETED)
|
||||
if (destruction_state_ == DESTRUCTION_STATE_COMPLETED) {
|
||||
return;
|
||||
}
|
||||
|
||||
bool close_browser = true;
|
||||
|
||||
@@ -1043,8 +1074,9 @@ void AlloyBrowserHostImpl::CloseContents(content::WebContents* source) {
|
||||
}
|
||||
|
||||
if (close_browser) {
|
||||
if (destruction_state_ != DESTRUCTION_STATE_ACCEPTED)
|
||||
if (destruction_state_ != DESTRUCTION_STATE_ACCEPTED) {
|
||||
destruction_state_ = DESTRUCTION_STATE_ACCEPTED;
|
||||
}
|
||||
|
||||
if (!IsWindowless() && !window_destroyed_) {
|
||||
// A window exists so try to close it using the platform method. Will
|
||||
@@ -1101,8 +1133,9 @@ bool AlloyBrowserHostImpl::TakeFocus(content::WebContents* source,
|
||||
bool reverse) {
|
||||
if (client_.get()) {
|
||||
CefRefPtr<CefFocusHandler> handler = client_->GetFocusHandler();
|
||||
if (handler.get())
|
||||
if (handler.get()) {
|
||||
handler->OnTakeFocus(this, !reverse);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -1125,14 +1158,17 @@ bool AlloyBrowserHostImpl::HandleKeyboardEvent(
|
||||
content::WebContents* source,
|
||||
const content::NativeWebKeyboardEvent& event) {
|
||||
// Check to see if event should be ignored.
|
||||
if (event.skip_in_browser)
|
||||
if (event.skip_in_browser) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (contents_delegate_->HandleKeyboardEvent(source, event))
|
||||
if (contents_delegate_->HandleKeyboardEvent(source, event)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
return platform_delegate_->HandleKeyboardEvent(event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1146,8 +1182,9 @@ bool AlloyBrowserHostImpl::CanDragEnter(content::WebContents* source,
|
||||
const content::DropData& data,
|
||||
blink::DragOperationsMask mask) {
|
||||
CefRefPtr<CefDragHandler> handler;
|
||||
if (client_)
|
||||
if (client_) {
|
||||
handler = client_->GetDragHandler();
|
||||
}
|
||||
if (handler) {
|
||||
CefRefPtr<CefDragDataImpl> drag_data(new CefDragDataImpl(data));
|
||||
drag_data->SetReadOnly(true);
|
||||
@@ -1200,8 +1237,9 @@ void AlloyBrowserHostImpl::WebContentsCreated(
|
||||
|
||||
CefRefPtr<AlloyBrowserHostImpl> opener =
|
||||
GetBrowserForContents(source_contents);
|
||||
if (!opener)
|
||||
if (!opener) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Popups must share the same RequestContext as the parent.
|
||||
CefRefPtr<CefRequestContextImpl> request_context = opener->request_context();
|
||||
@@ -1251,8 +1289,9 @@ void AlloyBrowserHostImpl::UpdatePreferredSize(content::WebContents* source,
|
||||
const gfx::Size& pref_size) {
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
|
||||
CEF_REQUIRE_UIT();
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->SizeTo(pref_size.width(), pref_size.height());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1336,13 +1375,15 @@ void AlloyBrowserHostImpl::DidFinishNavigation(
|
||||
|
||||
void AlloyBrowserHostImpl::OnAudioStateChanged(bool audible) {
|
||||
if (audible) {
|
||||
if (recently_audible_timer_)
|
||||
if (recently_audible_timer_) {
|
||||
recently_audible_timer_->Stop();
|
||||
}
|
||||
|
||||
StartAudioCapturer();
|
||||
} else if (audio_capturer_) {
|
||||
if (!recently_audible_timer_)
|
||||
if (!recently_audible_timer_) {
|
||||
recently_audible_timer_ = std::make_unique<base::OneShotTimer>();
|
||||
}
|
||||
|
||||
// If you have a media playing that has a short quiet moment, web_contents
|
||||
// will immediately switch to non-audible state. We don't want to stop
|
||||
@@ -1363,8 +1404,9 @@ void AlloyBrowserHostImpl::AccessibilityEventReceived(
|
||||
const content::AXEventNotificationDetails& content_event_bundle) {
|
||||
// Only needed in windowless mode.
|
||||
if (IsWindowless()) {
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
if (!web_contents() || !platform_delegate_) {
|
||||
return;
|
||||
}
|
||||
|
||||
platform_delegate_->AccessibilityEventReceived(content_event_bundle);
|
||||
}
|
||||
@@ -1374,8 +1416,9 @@ void AlloyBrowserHostImpl::AccessibilityLocationChangesReceived(
|
||||
const std::vector<content::AXLocationChangeNotificationDetails>& locData) {
|
||||
// Only needed in windowless mode.
|
||||
if (IsWindowless()) {
|
||||
if (!web_contents() || !platform_delegate_)
|
||||
if (!web_contents() || !platform_delegate_) {
|
||||
return;
|
||||
}
|
||||
|
||||
platform_delegate_->AccessibilityLocationChangesReceived(locData);
|
||||
}
|
||||
@@ -1384,25 +1427,29 @@ void AlloyBrowserHostImpl::AccessibilityLocationChangesReceived(
|
||||
void AlloyBrowserHostImpl::WebContentsDestroyed() {
|
||||
auto wc = web_contents();
|
||||
content::WebContentsObserver::Observe(nullptr);
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->WebContentsDestroyed(wc);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyBrowserHostImpl::StartAudioCapturer() {
|
||||
if (!client_.get() || audio_capturer_)
|
||||
if (!client_.get() || audio_capturer_) {
|
||||
return;
|
||||
}
|
||||
|
||||
CefRefPtr<CefAudioHandler> audio_handler = client_->GetAudioHandler();
|
||||
if (!audio_handler.get())
|
||||
if (!audio_handler.get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CefAudioParameters params;
|
||||
params.channel_layout = CEF_CHANNEL_LAYOUT_STEREO;
|
||||
params.sample_rate = media::AudioParameters::kAudioCDSampleRate;
|
||||
params.frames_per_buffer = 1024;
|
||||
|
||||
if (!audio_handler->GetAudioParameters(this, params))
|
||||
if (!audio_handler->GetAudioParameters(this, params)) {
|
||||
return;
|
||||
}
|
||||
|
||||
audio_capturer_.reset(new CefAudioCapturer(params, this, audio_handler));
|
||||
}
|
||||
@@ -1447,18 +1494,21 @@ bool AlloyBrowserHostImpl::CreateHostWindow() {
|
||||
// |host_window_handle_| will not change after initial host creation for
|
||||
// non-views-hosted browsers.
|
||||
bool success = true;
|
||||
if (!IsWindowless())
|
||||
if (!IsWindowless()) {
|
||||
success = platform_delegate_->CreateHostWindow();
|
||||
if (success && !is_views_hosted_)
|
||||
}
|
||||
if (success && !is_views_hosted_) {
|
||||
host_window_handle_ = platform_delegate_->GetHostWindowHandle();
|
||||
}
|
||||
return success;
|
||||
}
|
||||
|
||||
gfx::Point AlloyBrowserHostImpl::GetScreenPoint(const gfx::Point& view,
|
||||
bool want_dip_coords) const {
|
||||
CEF_REQUIRE_UIT();
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
return platform_delegate_->GetScreenPoint(view, want_dip_coords);
|
||||
}
|
||||
return gfx::Point();
|
||||
}
|
||||
|
||||
@@ -1477,6 +1527,7 @@ void AlloyBrowserHostImpl::StartDragging(
|
||||
|
||||
void AlloyBrowserHostImpl::UpdateDragCursor(
|
||||
ui::mojom::DragOperation operation) {
|
||||
if (platform_delegate_)
|
||||
if (platform_delegate_) {
|
||||
platform_delegate_->UpdateDragCursor(operation);
|
||||
}
|
||||
}
|
||||
|
@@ -122,13 +122,15 @@ class LinuxUiGetterImpl : public ui::LinuxUiGetter {
|
||||
ui::LinuxUi* GetLinuxUI() {
|
||||
// We can't use GtkUi in combination with multi-threaded-message-loop because
|
||||
// Chromium's GTK implementation doesn't use GDK threads.
|
||||
if (!!CefContext::Get()->settings().multi_threaded_message_loop)
|
||||
if (!!CefContext::Get()->settings().multi_threaded_message_loop) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// If the ozone backend hasn't provided a LinuxUiDelegate, don't try to create
|
||||
// a LinuxUi instance as this may result in a crash in toolkit initialization.
|
||||
if (!ui::LinuxUiDelegate::GetInstance())
|
||||
if (!ui::LinuxUiDelegate::GetInstance()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return ui::GetDefaultLinuxUi();
|
||||
}
|
||||
@@ -176,10 +178,11 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
|
||||
#endif // BUILDFLAG(IS_LINUX)
|
||||
|
||||
#if BUILDFLAG(IS_MAC)
|
||||
if (base::FeatureList::IsEnabled(features::kViewsJSAppModalDialog))
|
||||
if (base::FeatureList::IsEnabled(features::kViewsJSAppModalDialog)) {
|
||||
InstallChromeJavaScriptAppModalDialogViewFactory();
|
||||
else
|
||||
} else {
|
||||
InstallChromeJavaScriptAppModalDialogViewCocoaFactory();
|
||||
}
|
||||
#else
|
||||
InstallChromeJavaScriptAppModalDialogViewFactory();
|
||||
#endif
|
||||
|
@@ -185,13 +185,15 @@ class CefSelectClientCertificateCallbackImpl
|
||||
~CefSelectClientCertificateCallbackImpl() {
|
||||
// If Select has not been called, call it with NULL to continue without any
|
||||
// client certificate.
|
||||
if (delegate_)
|
||||
if (delegate_) {
|
||||
DoSelect(nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void Select(CefRefPtr<CefX509Certificate> cert) override {
|
||||
if (delegate_)
|
||||
if (delegate_) {
|
||||
DoSelect(cert);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -246,8 +248,9 @@ class CefSelectClientCertificateCallbackImpl
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
int GetCrashSignalFD() {
|
||||
if (!crash_reporting::Enabled())
|
||||
if (!crash_reporting::Enabled()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int fd;
|
||||
pid_t pid;
|
||||
@@ -262,8 +265,9 @@ void BindPluginInfoHost(
|
||||
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
|
||||
content::RenderProcessHost* host =
|
||||
content::RenderProcessHost::FromID(render_process_id);
|
||||
if (!host)
|
||||
if (!host) {
|
||||
return;
|
||||
}
|
||||
|
||||
Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext());
|
||||
mojo::MakeSelfOwnedAssociatedReceiver(
|
||||
@@ -300,12 +304,14 @@ base::FilePath GetRootCachePath() {
|
||||
const extensions::Extension* GetEnabledExtensionFromSiteURL(
|
||||
content::BrowserContext* context,
|
||||
const GURL& site_url) {
|
||||
if (!site_url.SchemeIs(extensions::kExtensionScheme))
|
||||
if (!site_url.SchemeIs(extensions::kExtensionScheme)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto registry = extensions::ExtensionRegistry::Get(context);
|
||||
if (!registry)
|
||||
if (!registry) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return registry->enabled_extensions().GetByID(site_url.host());
|
||||
}
|
||||
@@ -394,11 +400,13 @@ bool AlloyContentBrowserClient::ShouldTreatURLSchemeAsFirstPartyWhenTopLevel(
|
||||
// with SameSite cookies on accounts.google.com, which are used for logging
|
||||
// into Cloud Print from chrome://print, for displaying a list of available
|
||||
// accounts on the NTP (chrome://new-tab-page), etc.
|
||||
if (is_embedded_origin_secure && scheme == content::kChromeUIScheme)
|
||||
if (is_embedded_origin_secure && scheme == content::kChromeUIScheme) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (extensions::ExtensionsEnabled())
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
return scheme == extensions::kExtensionScheme;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -456,21 +464,24 @@ bool AlloyContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests(
|
||||
}
|
||||
|
||||
bool AlloyContentBrowserClient::IsHandledURL(const GURL& url) {
|
||||
if (!url.is_valid())
|
||||
if (!url.is_valid()) {
|
||||
return false;
|
||||
}
|
||||
const std::string& scheme = url.scheme();
|
||||
DCHECK_EQ(scheme, base::ToLowerASCII(scheme));
|
||||
|
||||
if (scheme::IsInternalHandledScheme(scheme))
|
||||
if (scheme::IsInternalHandledScheme(scheme)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return CefAppManager::Get()->HasCustomScheme(scheme);
|
||||
}
|
||||
|
||||
void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||
content::SiteInstance* site_instance) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
CHECK(site_instance->HasProcess());
|
||||
|
||||
@@ -484,8 +495,9 @@ void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||
// since it isn't treated as a hosted app.
|
||||
const auto extension =
|
||||
GetEnabledExtensionFromSiteURL(context, site_instance->GetSiteURL());
|
||||
if (!extension)
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
extensions::ProcessMap::Get(context)->Insert(
|
||||
extension->id(), site_instance->GetProcess()->GetID(),
|
||||
@@ -494,21 +506,25 @@ void AlloyContentBrowserClient::SiteInstanceGotProcess(
|
||||
|
||||
void AlloyContentBrowserClient::SiteInstanceDeleting(
|
||||
content::SiteInstance* site_instance) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!site_instance->HasProcess())
|
||||
if (!site_instance->HasProcess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto context = site_instance->GetBrowserContext();
|
||||
auto registry = extensions::ExtensionRegistry::Get(context);
|
||||
if (!registry)
|
||||
if (!registry) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto extension = registry->enabled_extensions().GetExtensionOrAppByURL(
|
||||
site_instance->GetSiteURL());
|
||||
if (!extension)
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
extensions::ProcessMap::Get(context)->Remove(
|
||||
extension->id(), site_instance->GetProcess()->GetID(),
|
||||
@@ -619,8 +635,9 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
|
||||
// Force use of the sub-process executable path for the zygote process.
|
||||
const base::FilePath& subprocess_path =
|
||||
browser_cmd->GetSwitchValuePath(switches::kBrowserSubprocessPath);
|
||||
if (!subprocess_path.empty())
|
||||
if (!subprocess_path.empty()) {
|
||||
command_line->SetProgram(subprocess_path);
|
||||
}
|
||||
}
|
||||
|
||||
// Propagate the following switches to the zygote command line (along with
|
||||
@@ -666,8 +683,9 @@ AlloyContentBrowserClient::GetSystemSharedURLLoaderFactory() {
|
||||
content::BrowserThread::CurrentlyOn(content::BrowserThread::UI) ||
|
||||
!content::BrowserThread::IsThreadInitialized(content::BrowserThread::UI));
|
||||
|
||||
if (!SystemNetworkContextManager::GetInstance())
|
||||
if (!SystemNetworkContextManager::GetInstance()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return SystemNetworkContextManager::GetInstance()
|
||||
->GetSharedURLLoaderFactory();
|
||||
@@ -688,8 +706,9 @@ content::SpeechRecognitionManagerDelegate*
|
||||
AlloyContentBrowserClient::CreateSpeechRecognitionManagerDelegate() {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
if (command_line->HasSwitch(switches::kEnableSpeechInput))
|
||||
if (command_line->HasSwitch(switches::kEnableSpeechInput)) {
|
||||
return new CefSpeechRecognitionManagerDelegate();
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -732,8 +751,9 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
|
||||
AlloyBrowserHostImpl::GetBrowserForContents(web_contents);
|
||||
if (browser.get()) {
|
||||
CefRefPtr<CefClient> client = browser->GetClient();
|
||||
if (client.get())
|
||||
if (client.get()) {
|
||||
handler = client->GetRequestHandler();
|
||||
}
|
||||
}
|
||||
|
||||
if (!handler.get()) {
|
||||
@@ -865,13 +885,15 @@ AlloyContentBrowserClient::CreateThrottlesForNavigation(
|
||||
if (extensions::ExtensionsEnabled()) {
|
||||
auto pdf_iframe_throttle =
|
||||
PDFIFrameNavigationThrottle::MaybeCreateThrottleFor(navigation_handle);
|
||||
if (pdf_iframe_throttle)
|
||||
if (pdf_iframe_throttle) {
|
||||
throttles.push_back(std::move(pdf_iframe_throttle));
|
||||
}
|
||||
|
||||
auto pdf_throttle = pdf::PdfNavigationThrottle::MaybeCreateThrottleFor(
|
||||
navigation_handle, std::make_unique<ChromePdfStreamDelegate>());
|
||||
if (pdf_throttle)
|
||||
if (pdf_throttle) {
|
||||
throttles.push_back(std::move(pdf_throttle));
|
||||
}
|
||||
}
|
||||
|
||||
throttle::CreateThrottlesForNavigation(navigation_handle, throttles);
|
||||
@@ -915,8 +937,9 @@ AlloyContentBrowserClient::WillCreateURLLoaderRequestInterceptors(
|
||||
auto pdf_interceptor =
|
||||
pdf::PdfURLLoaderRequestInterceptor::MaybeCreateInterceptor(
|
||||
frame_tree_node_id, std::make_unique<ChromePdfStreamDelegate>());
|
||||
if (pdf_interceptor)
|
||||
if (pdf_interceptor) {
|
||||
interceptors.push_back(std::move(pdf_interceptor));
|
||||
}
|
||||
}
|
||||
|
||||
return interceptors;
|
||||
@@ -995,8 +1018,9 @@ void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
|
||||
int frame_tree_node_id,
|
||||
ukm::SourceIdObj ukm_source_id,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromFrameTreeNodeId(frame_tree_node_id);
|
||||
@@ -1012,20 +1036,23 @@ void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
int render_frame_id,
|
||||
const absl::optional<url::Origin>& request_initiator_origin,
|
||||
NonNetworkURLLoaderFactoryMap* factories) {
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto factory = extensions::CreateExtensionURLLoaderFactory(render_process_id,
|
||||
render_frame_id);
|
||||
if (factory)
|
||||
if (factory) {
|
||||
factories->emplace(extensions::kExtensionScheme, std::move(factory));
|
||||
}
|
||||
|
||||
content::RenderFrameHost* frame_host =
|
||||
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(frame_host);
|
||||
if (!web_contents)
|
||||
if (!web_contents) {
|
||||
return;
|
||||
}
|
||||
|
||||
extensions::CefExtensionWebContentsObserver* web_observer =
|
||||
extensions::CefExtensionWebContentsObserver::FromWebContents(
|
||||
@@ -1033,13 +1060,15 @@ void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
|
||||
|
||||
// There is nothing to do if no CefExtensionWebContentsObserver is attached
|
||||
// to the |web_contents|.
|
||||
if (!web_observer)
|
||||
if (!web_observer) {
|
||||
return;
|
||||
}
|
||||
|
||||
const extensions::Extension* extension =
|
||||
web_observer->GetExtensionFromFrame(frame_host, false);
|
||||
if (!extension)
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<std::string> allowed_webui_hosts;
|
||||
// Support for chrome:// scheme if appropriate.
|
||||
@@ -1222,25 +1251,29 @@ void AlloyContentBrowserClient::RegisterBrowserInterfaceBindersForFrame(
|
||||
map->Add<network_hints::mojom::NetworkHintsHandler>(
|
||||
base::BindRepeating(&BindNetworkHintsHandler));
|
||||
|
||||
if (!extensions::ExtensionsEnabled())
|
||||
if (!extensions::ExtensionsEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::WebContents* web_contents =
|
||||
content::WebContents::FromRenderFrameHost(render_frame_host);
|
||||
if (!web_contents)
|
||||
if (!web_contents) {
|
||||
return;
|
||||
}
|
||||
|
||||
const GURL& site = render_frame_host->GetSiteInstance()->GetSiteURL();
|
||||
if (!site.SchemeIs(extensions::kExtensionScheme))
|
||||
if (!site.SchemeIs(extensions::kExtensionScheme)) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::BrowserContext* browser_context =
|
||||
render_frame_host->GetProcess()->GetBrowserContext();
|
||||
auto* extension = extensions::ExtensionRegistry::Get(browser_context)
|
||||
->enabled_extensions()
|
||||
.GetByID(site.host());
|
||||
if (!extension)
|
||||
if (!extension) {
|
||||
return;
|
||||
}
|
||||
extensions::ExtensionsBrowserClient::Get()
|
||||
->RegisterBrowserInterfaceBindersForFrame(map, render_frame_host,
|
||||
extension);
|
||||
@@ -1306,8 +1339,9 @@ AlloyContentBrowserClient::GetPluginMimeTypesWithExternalHandlers(
|
||||
content::BrowserContext* browser_context) {
|
||||
base::flat_set<std::string> mime_types;
|
||||
auto map = PluginUtils::GetMimeTypeToExtensionIdMap(browser_context);
|
||||
for (const auto& pair : map)
|
||||
for (const auto& pair : map) {
|
||||
mime_types.insert(pair.first);
|
||||
}
|
||||
mime_types.insert(pdf::kInternalPluginMimeType);
|
||||
return mime_types;
|
||||
}
|
||||
@@ -1372,8 +1406,9 @@ const extensions::Extension* AlloyContentBrowserClient::GetExtension(
|
||||
content::SiteInstance* site_instance) {
|
||||
extensions::ExtensionRegistry* registry =
|
||||
extensions::ExtensionRegistry::Get(site_instance->GetBrowserContext());
|
||||
if (!registry)
|
||||
if (!registry) {
|
||||
return nullptr;
|
||||
}
|
||||
return registry->enabled_extensions().GetExtensionOrAppByURL(
|
||||
site_instance->GetSiteURL());
|
||||
}
|
||||
|
@@ -161,8 +161,9 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
|
||||
CefBrowserPlatformDelegate::BrowserCreated(browser);
|
||||
|
||||
// Only register WebContents delegate/observers if we're the primary delegate.
|
||||
if (!primary_)
|
||||
if (!primary_) {
|
||||
return;
|
||||
}
|
||||
|
||||
DCHECK(!web_contents_->GetDelegate());
|
||||
web_contents_->SetDelegate(static_cast<AlloyBrowserHostImpl*>(browser));
|
||||
@@ -243,22 +244,26 @@ CefBrowserPlatformDelegateAlloy::GetWebContentsModalDialogHost() const {
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::SendCaptureLostEvent() {
|
||||
if (!web_contents_)
|
||||
if (!web_contents_) {
|
||||
return;
|
||||
}
|
||||
content::RenderViewHost* host = web_contents_->GetRenderViewHost();
|
||||
if (!host)
|
||||
if (!host) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::RenderWidgetHostImpl* widget =
|
||||
content::RenderWidgetHostImpl::From(host->GetWidget());
|
||||
if (widget)
|
||||
if (widget) {
|
||||
widget->LostCapture();
|
||||
}
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_WIN) || (BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC))
|
||||
void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
|
||||
if (!web_contents_)
|
||||
if (!web_contents_) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Dismiss any existing popups.
|
||||
web_contents_->ClearFocusedElement();
|
||||
@@ -268,15 +273,17 @@ void CefBrowserPlatformDelegateAlloy::NotifyMoveOrResizeStarted() {
|
||||
bool CefBrowserPlatformDelegateAlloy::PreHandleGestureEvent(
|
||||
content::WebContents* source,
|
||||
const blink::WebGestureEvent& event) {
|
||||
if (extension_host_)
|
||||
if (extension_host_) {
|
||||
return extension_host_->PreHandleGestureEvent(source, event);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CefBrowserPlatformDelegateAlloy::IsNeverComposited(
|
||||
content::WebContents* web_contents) {
|
||||
if (extension_host_)
|
||||
if (extension_host_) {
|
||||
return extension_host_->IsNeverComposited(web_contents);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -284,8 +291,9 @@ void CefBrowserPlatformDelegateAlloy::SetAutoResizeEnabled(
|
||||
bool enabled,
|
||||
const CefSize& min_size,
|
||||
const CefSize& max_size) {
|
||||
if (enabled == auto_resize_enabled_)
|
||||
if (enabled == auto_resize_enabled_) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto_resize_enabled_ = enabled;
|
||||
if (enabled) {
|
||||
@@ -315,14 +323,16 @@ void CefBrowserPlatformDelegateAlloy::SetAccessibilityState(
|
||||
// Do nothing if state is set to default. It'll be disabled by default and
|
||||
// controlled by the commmand-line flags "force-renderer-accessibility" and
|
||||
// "disable-renderer-accessibility".
|
||||
if (accessibility_state == STATE_DEFAULT)
|
||||
if (accessibility_state == STATE_DEFAULT) {
|
||||
return;
|
||||
}
|
||||
|
||||
content::WebContentsImpl* web_contents_impl =
|
||||
static_cast<content::WebContentsImpl*>(web_contents_);
|
||||
|
||||
if (!web_contents_impl)
|
||||
if (!web_contents_impl) {
|
||||
return;
|
||||
}
|
||||
|
||||
ui::AXMode accMode;
|
||||
// In windowless mode set accessibility to TreeOnly mode. Else native
|
||||
@@ -337,8 +347,9 @@ bool CefBrowserPlatformDelegateAlloy::IsPrintPreviewSupported() const {
|
||||
REQUIRE_ALLOY_RUNTIME();
|
||||
|
||||
// Print preview is not currently supported with OSR.
|
||||
if (IsWindowless())
|
||||
if (IsWindowless()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto cef_browser_context =
|
||||
CefBrowserContext::FromBrowserContext(web_contents_->GetBrowserContext());
|
||||
@@ -349,8 +360,9 @@ void CefBrowserPlatformDelegateAlloy::Find(const CefString& searchText,
|
||||
bool forward,
|
||||
bool matchCase,
|
||||
bool findNext) {
|
||||
if (!web_contents_)
|
||||
if (!web_contents_) {
|
||||
return;
|
||||
}
|
||||
|
||||
find_in_page::FindTabHelper::FromWebContents(web_contents_)
|
||||
->StartFinding(searchText.ToString16(), forward, matchCase, findNext,
|
||||
@@ -358,8 +370,9 @@ void CefBrowserPlatformDelegateAlloy::Find(const CefString& searchText,
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::StopFinding(bool clearSelection) {
|
||||
if (!web_contents_)
|
||||
if (!web_contents_) {
|
||||
return;
|
||||
}
|
||||
|
||||
last_search_result_ = find_in_page::FindNotificationDetails();
|
||||
find_in_page::FindTabHelper::FromWebContents(web_contents_)
|
||||
@@ -373,8 +386,9 @@ bool CefBrowserPlatformDelegateAlloy::HandleFindReply(
|
||||
const gfx::Rect& selection_rect,
|
||||
int active_match_ordinal,
|
||||
bool final_update) {
|
||||
if (!web_contents_)
|
||||
if (!web_contents_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto find_in_page =
|
||||
find_in_page::FindTabHelper::FromWebContents(web_contents_);
|
||||
@@ -407,8 +421,9 @@ void CefBrowserPlatformDelegateAlloy::SetOwnedWebContents(
|
||||
}
|
||||
|
||||
void CefBrowserPlatformDelegateAlloy::DestroyExtensionHost() {
|
||||
if (!extension_host_)
|
||||
if (!extension_host_) {
|
||||
return;
|
||||
}
|
||||
if (extension_host_->extension_host_type() ==
|
||||
extensions::mojom::ViewType::kExtensionBackgroundPage) {
|
||||
DCHECK(is_background_host_);
|
||||
|
@@ -114,8 +114,9 @@ void ChromeBrowserProcessAlloy::CleanupOnUIThread() {
|
||||
// Release any references to |local_state_|.
|
||||
auto profile = browser_context->AsProfile();
|
||||
PrefWatcher* pref_watcher = PrefWatcher::Get(profile);
|
||||
if (pref_watcher)
|
||||
if (pref_watcher) {
|
||||
pref_watcher->Shutdown();
|
||||
}
|
||||
|
||||
// Unregister observers for |background_printing_manager_|.
|
||||
if (background_printing_manager_) {
|
||||
@@ -345,8 +346,9 @@ void ChromeBrowserProcessAlloy::StartAutoupdateTimer() {}
|
||||
|
||||
component_updater::ComponentUpdateService*
|
||||
ChromeBrowserProcessAlloy::component_updater() {
|
||||
if (component_updater_)
|
||||
if (component_updater_) {
|
||||
return component_updater_.get();
|
||||
}
|
||||
|
||||
if (!content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
|
||||
return nullptr;
|
||||
|
@@ -61,8 +61,9 @@ const Profile::OTRProfileID& ChromeProfileAlloy::GetOTRProfileID() const {
|
||||
}
|
||||
|
||||
variations::VariationsClient* ChromeProfileAlloy::GetVariationsClient() {
|
||||
if (!variations_client_)
|
||||
if (!variations_client_) {
|
||||
variations_client_ = std::make_unique<CefVariationsClient>(this);
|
||||
}
|
||||
return variations_client_.get();
|
||||
}
|
||||
|
||||
|
@@ -51,8 +51,9 @@ Profile* ChromeProfileManagerAlloy::GetProfile(
|
||||
}
|
||||
|
||||
bool ChromeProfileManagerAlloy::IsValidProfile(const void* profile) {
|
||||
if (!profile)
|
||||
if (!profile) {
|
||||
return false;
|
||||
}
|
||||
return !!CefBrowserContext::FromBrowserContext(
|
||||
static_cast<const content::BrowserContext*>(profile));
|
||||
}
|
||||
|
@@ -81,8 +81,9 @@ gfx::Size AlloyWebContentsDialogHelper::GetMaximumDialogSize() {
|
||||
|
||||
void AlloyWebContentsDialogHelper::AddObserver(
|
||||
web_modal::ModalDialogHostObserver* observer) {
|
||||
if (observer && !observer_list_.HasObserver(observer))
|
||||
if (observer && !observer_list_.HasObserver(observer)) {
|
||||
observer_list_.AddObserver(observer);
|
||||
}
|
||||
}
|
||||
|
||||
void AlloyWebContentsDialogHelper::RemoveObserver(
|
||||
@@ -91,6 +92,7 @@ void AlloyWebContentsDialogHelper::RemoveObserver(
|
||||
}
|
||||
|
||||
void AlloyWebContentsDialogHelper::OnBoundsChanged() {
|
||||
for (auto& observer : observer_list_)
|
||||
for (auto& observer : observer_list_) {
|
||||
observer.OnPositionRequiresUpdate();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user