libcef: Format with clang-tidy (see #3632)

This commit is contained in:
Marshall Greenblatt
2024-01-20 17:48:57 -05:00
parent 4ea1b6f293
commit a02d2ab3e6
158 changed files with 639 additions and 686 deletions

View File

@ -5,6 +5,7 @@
#include "libcef/browser/alloy/alloy_browser_context.h" #include "libcef/browser/alloy/alloy_browser_context.h"
#include <map> #include <map>
#include <memory>
#include <utility> #include <utility>
#include "libcef/browser/download_manager_delegate.h" #include "libcef/browser/download_manager_delegate.h"
@ -167,15 +168,15 @@ void AlloyBrowserContext::Initialize() {
visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links")); visited_link_path = cache_path_.Append(FILE_PATH_LITERAL("Visited Links"));
} }
visitedlink_listener_ = new CefVisitedLinkListener; visitedlink_listener_ = new CefVisitedLinkListener;
visitedlink_master_.reset(new visitedlink::VisitedLinkWriter( visitedlink_master_ = std::make_unique<visitedlink::VisitedLinkWriter>(
visitedlink_listener_, this, !visited_link_path.empty(), false, visitedlink_listener_, this, !visited_link_path.empty(), false,
visited_link_path, 0)); visited_link_path, 0);
visitedlink_listener_->CreateListenerForContext(this); visitedlink_listener_->CreateListenerForContext(this);
visitedlink_master_->Init(); visitedlink_master_->Init();
// Initialize proxy configuration tracker. // Initialize proxy configuration tracker.
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl( pref_proxy_config_tracker_ = std::make_unique<PrefProxyConfigTrackerImpl>(
GetPrefs(), content::GetIOThreadTaskRunner({}))); GetPrefs(), content::GetIOThreadTaskRunner({}));
// Spell checking support and possibly other subsystems retrieve the // Spell checking support and possibly other subsystems retrieve the
// PrefService associated with a BrowserContext via UserPrefs::Get(). // PrefService associated with a BrowserContext via UserPrefs::Get().
@ -355,8 +356,8 @@ AlloyBrowserContext::CreateZoomLevelDelegate(
content::DownloadManagerDelegate* content::DownloadManagerDelegate*
AlloyBrowserContext::GetDownloadManagerDelegate() { AlloyBrowserContext::GetDownloadManagerDelegate() {
if (!download_manager_delegate_) { if (!download_manager_delegate_) {
download_manager_delegate_.reset( download_manager_delegate_ =
new CefDownloadManagerDelegate(GetDownloadManager())); std::make_unique<CefDownloadManagerDelegate>(GetDownloadManager());
} }
return download_manager_delegate_.get(); return download_manager_delegate_.get();
} }
@ -388,7 +389,7 @@ AlloyBrowserContext::GetStorageNotificationService() {
content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() { content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() {
if (!ssl_host_state_delegate_) { if (!ssl_host_state_delegate_) {
ssl_host_state_delegate_.reset(new CefSSLHostStateDelegate()); ssl_host_state_delegate_ = std::make_unique<CefSSLHostStateDelegate>();
} }
return ssl_host_state_delegate_.get(); return ssl_host_state_delegate_.get();
} }
@ -475,7 +476,7 @@ void AlloyBrowserContext::RebuildTable(
DownloadPrefs* AlloyBrowserContext::GetDownloadPrefs() { DownloadPrefs* AlloyBrowserContext::GetDownloadPrefs() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!download_prefs_) { if (!download_prefs_) {
download_prefs_.reset(new DownloadPrefs(this)); download_prefs_ = std::make_unique<DownloadPrefs>(this);
} }
return download_prefs_.get(); return download_prefs_.get();
} }

View File

@ -5,6 +5,7 @@
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
@ -233,7 +234,7 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::GetBrowserForGlobalId(
// AlloyBrowserHostImpl methods. // AlloyBrowserHostImpl methods.
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
AlloyBrowserHostImpl::~AlloyBrowserHostImpl() {} AlloyBrowserHostImpl::~AlloyBrowserHostImpl() = default;
void AlloyBrowserHostImpl::CloseBrowser(bool force_close) { void AlloyBrowserHostImpl::CloseBrowser(bool force_close) {
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
@ -1206,13 +1207,14 @@ void AlloyBrowserHostImpl::WebContentsCreated(
CefRefPtr<AlloyBrowserHostImpl> browser = CefRefPtr<AlloyBrowserHostImpl> browser =
CreateInternal(settings, client, new_contents, /*own_web_contents=*/false, CreateInternal(settings, client, new_contents, /*own_web_contents=*/false,
info, opener, /*is_devtools_popup=*/false, request_context, info, opener, /*is_devtools_popup=*/false, request_context,
std::move(platform_delegate), /*cef_extension=*/nullptr); std::move(platform_delegate), /*extension=*/nullptr);
} }
content::JavaScriptDialogManager* content::JavaScriptDialogManager*
AlloyBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) { AlloyBrowserHostImpl::GetJavaScriptDialogManager(content::WebContents* source) {
if (!javascript_dialog_manager_) { if (!javascript_dialog_manager_) {
javascript_dialog_manager_.reset(new CefJavaScriptDialogManager(this)); javascript_dialog_manager_ =
std::make_unique<CefJavaScriptDialogManager>(this);
} }
return javascript_dialog_manager_.get(); return javascript_dialog_manager_.get();
} }
@ -1230,8 +1232,8 @@ bool AlloyBrowserHostImpl::ShowContextMenu(
const content::ContextMenuParams& params) { const content::ContextMenuParams& params) {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!menu_manager_.get() && platform_delegate_) { if (!menu_manager_.get() && platform_delegate_) {
menu_manager_.reset( menu_manager_ = std::make_unique<CefMenuManager>(
new CefMenuManager(this, platform_delegate_->CreateMenuRunner())); this, platform_delegate_->CreateMenuRunner());
} }
return menu_manager_->CreateContextMenu(params); return menu_manager_->CreateContextMenu(params);
} }
@ -1402,7 +1404,8 @@ void AlloyBrowserHostImpl::StartAudioCapturer() {
return; return;
} }
audio_capturer_.reset(new CefAudioCapturer(params, this, audio_handler)); audio_capturer_ =
std::make_unique<CefAudioCapturer>(params, this, audio_handler);
} }
// AlloyBrowserHostImpl private methods. // AlloyBrowserHostImpl private methods.

View File

@ -6,6 +6,7 @@
#include <stdint.h> #include <stdint.h>
#include <memory>
#include <string> #include <string>
#include "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h" #include "libcef/browser/alloy/dialogs/alloy_constrained_window_views_client.h"
@ -206,7 +207,7 @@ void AlloyBrowserMainParts::ToolkitInitialized() {
#if defined(USE_AURA) #if defined(USE_AURA)
CHECK(aura::Env::GetInstance()); CHECK(aura::Env::GetInstance());
wm_state_.reset(new wm::WMState); wm_state_ = std::make_unique<wm::WMState>();
#endif // defined(USE_AURA) #endif // defined(USE_AURA)
#if BUILDFLAG(IS_MAC) #if BUILDFLAG(IS_MAC)

View File

@ -196,7 +196,7 @@ class CefSelectClientCertificateCallbackImpl
CefSelectClientCertificateCallbackImpl& operator=( CefSelectClientCertificateCallbackImpl& operator=(
const CefSelectClientCertificateCallbackImpl&) = delete; const CefSelectClientCertificateCallbackImpl&) = delete;
~CefSelectClientCertificateCallbackImpl() { ~CefSelectClientCertificateCallbackImpl() override {
// If Select has not been called, call it with NULL to continue without any // If Select has not been called, call it with NULL to continue without any
// client certificate. // client certificate.
if (delegate_) { if (delegate_) {
@ -792,9 +792,8 @@ base::OnceClosure AlloyContentBrowserClient::SelectClientCertificate(
} }
CefRequestHandler::X509CertificateList certs; CefRequestHandler::X509CertificateList certs;
for (net::ClientCertIdentityList::iterator iter = client_certs.begin(); for (auto& client_cert : client_certs) {
iter != client_certs.end(); iter++) { certs.push_back(new CefX509CertificateImpl(std::move(client_cert)));
certs.push_back(new CefX509CertificateImpl(std::move(*iter)));
} }
CefRefPtr<CefSelectClientCertificateCallbackImpl> callbackImpl( CefRefPtr<CefSelectClientCertificateCallbackImpl> callbackImpl(

View File

@ -4,6 +4,8 @@
#include "libcef/browser/alloy/browser_platform_delegate_alloy.h" #include "libcef/browser/alloy/browser_platform_delegate_alloy.h"
#include <memory>
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h" #include "libcef/browser/alloy/dialogs/alloy_javascript_dialog_manager_delegate.h"
#include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/extensions/browser_extensions_util.h"
@ -173,8 +175,8 @@ void CefBrowserPlatformDelegateAlloy::BrowserCreated(
CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(web_contents_)); CreateAlloyJavaScriptTabModalDialogManagerDelegateDesktop(web_contents_));
// Used for print preview and JavaScript dialogs. // Used for print preview and JavaScript dialogs.
web_contents_dialog_helper_.reset( web_contents_dialog_helper_ =
new AlloyWebContentsDialogHelper(web_contents_, this)); std::make_unique<AlloyWebContentsDialogHelper>(web_contents_, this);
} }
void CefBrowserPlatformDelegateAlloy::CreateExtensionHost( void CefBrowserPlatformDelegateAlloy::CreateExtensionHost(

View File

@ -5,6 +5,8 @@
#include "libcef/browser/alloy/chrome_browser_process_alloy.h" #include "libcef/browser/alloy/chrome_browser_process_alloy.h"
#include <memory>
#include "libcef/browser/alloy/chrome_profile_manager_alloy.h" #include "libcef/browser/alloy/chrome_profile_manager_alloy.h"
#include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
@ -37,11 +39,7 @@
#include "services/network/public/cpp/network_switches.h" #include "services/network/public/cpp/network_switches.h"
#include "services/network/public/cpp/shared_url_loader_factory.h" #include "services/network/public/cpp/shared_url_loader_factory.h"
ChromeBrowserProcessAlloy::ChromeBrowserProcessAlloy() ChromeBrowserProcessAlloy::ChromeBrowserProcessAlloy() : locale_("en-US") {}
: initialized_(false),
context_initialized_(false),
shutdown_(false),
locale_("en-US") {}
ChromeBrowserProcessAlloy::~ChromeBrowserProcessAlloy() { ChromeBrowserProcessAlloy::~ChromeBrowserProcessAlloy() {
DCHECK((!initialized_ && !context_initialized_) || shutdown_); DCHECK((!initialized_ && !context_initialized_) || shutdown_);
@ -64,10 +62,10 @@ void ChromeBrowserProcessAlloy::Initialize() {
if (extensions::ExtensionsEnabled()) { if (extensions::ExtensionsEnabled()) {
// Initialize extension global objects before creating the global // Initialize extension global objects before creating the global
// BrowserContext. // BrowserContext.
extensions_client_.reset(new extensions::CefExtensionsClient()); extensions_client_ = std::make_unique<extensions::CefExtensionsClient>();
extensions::ExtensionsClient::Set(extensions_client_.get()); extensions::ExtensionsClient::Set(extensions_client_.get());
extensions_browser_client_.reset( extensions_browser_client_ =
new extensions::CefExtensionsBrowserClient); std::make_unique<extensions::CefExtensionsBrowserClient>();
extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get()); extensions::ExtensionsBrowserClient::Set(extensions_browser_client_.get());
} }
@ -84,8 +82,8 @@ void ChromeBrowserProcessAlloy::OnContextInitialized() {
DCHECK(!shutdown_); DCHECK(!shutdown_);
// Must be created after the NotificationService. // Must be created after the NotificationService.
print_job_manager_.reset(new printing::PrintJobManager()); print_job_manager_ = std::make_unique<printing::PrintJobManager>();
profile_manager_.reset(new ChromeProfileManagerAlloy()); profile_manager_ = std::make_unique<ChromeProfileManagerAlloy>();
event_router_forwarder_ = new extensions::EventRouterForwarder(); event_router_forwarder_ = new extensions::EventRouterForwarder();
context_initialized_ = true; context_initialized_ = true;
} }
@ -282,8 +280,8 @@ ChromeBrowserProcessAlloy::print_preview_dialog_controller() {
printing::BackgroundPrintingManager* printing::BackgroundPrintingManager*
ChromeBrowserProcessAlloy::background_printing_manager() { ChromeBrowserProcessAlloy::background_printing_manager() {
if (!background_printing_manager_.get()) { if (!background_printing_manager_.get()) {
background_printing_manager_.reset( background_printing_manager_ =
new printing::BackgroundPrintingManager()); std::make_unique<printing::BackgroundPrintingManager>();
} }
return background_printing_manager_.get(); return background_printing_manager_.get();
} }

View File

@ -113,9 +113,9 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
UsbSystemTrayIcon* usb_system_tray_icon() override; UsbSystemTrayIcon* usb_system_tray_icon() override;
private: private:
bool initialized_; bool initialized_ = false;
bool context_initialized_; bool context_initialized_ = false;
bool shutdown_; bool shutdown_ = false;
std::unique_ptr<extensions::ExtensionsClient> extensions_client_; std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
std::unique_ptr<extensions::ExtensionsBrowserClient> std::unique_ptr<extensions::ExtensionsBrowserClient>

View File

@ -41,7 +41,7 @@ ChromeProfileAlloy::ChromeProfileAlloy() {
this, profile_metrics::BrowserProfileType::kRegular); this, profile_metrics::BrowserProfileType::kRegular);
} }
ChromeProfileAlloy::~ChromeProfileAlloy() {} ChromeProfileAlloy::~ChromeProfileAlloy() = default;
bool ChromeProfileAlloy::IsOffTheRecord() { bool ChromeProfileAlloy::IsOffTheRecord() {
return false; return false;

View File

@ -32,7 +32,7 @@ CefBrowserContext* GetActiveBrowserContext() {
ChromeProfileManagerAlloy::ChromeProfileManagerAlloy() ChromeProfileManagerAlloy::ChromeProfileManagerAlloy()
: ProfileManager(base::FilePath()) {} : ProfileManager(base::FilePath()) {}
ChromeProfileManagerAlloy::~ChromeProfileManagerAlloy() {} ChromeProfileManagerAlloy::~ChromeProfileManagerAlloy() = default;
Profile* ChromeProfileManagerAlloy::GetProfile( Profile* ChromeProfileManagerAlloy::GetProfile(
const base::FilePath& profile_dir) { const base::FilePath& profile_dir) {

View File

@ -39,7 +39,7 @@ class StreamCreatedCallbackAdapter final
StreamCreatedCallbackAdapter& operator=(const StreamCreatedCallbackAdapter&) = StreamCreatedCallbackAdapter& operator=(const StreamCreatedCallbackAdapter&) =
delete; delete;
~StreamCreatedCallbackAdapter() override {} ~StreamCreatedCallbackAdapter() override = default;
// blink::mojom::RendererAudioInputStreamFactoryClient implementation. // blink::mojom::RendererAudioInputStreamFactoryClient implementation.
void StreamCreated( void StreamCreated(

View File

@ -63,7 +63,7 @@ class CefBrowserContentsDelegate : public content::WebContentsDelegate,
virtual void OnWebContentsDestroyed(content::WebContents* web_contents) = 0; virtual void OnWebContentsDestroyed(content::WebContents* web_contents) = 0;
protected: protected:
~Observer() override {} ~Observer() override = default;
}; };
explicit CefBrowserContentsDelegate( explicit CefBrowserContentsDelegate(

View File

@ -5,6 +5,7 @@
#include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context.h"
#include <map> #include <map>
#include <memory>
#include <utility> #include <utility>
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
@ -36,7 +37,7 @@ class ImplManager {
public: public:
using Vector = std::vector<CefBrowserContext*>; using Vector = std::vector<CefBrowserContext*>;
ImplManager() {} ImplManager() = default;
ImplManager(const ImplManager&) = delete; ImplManager(const ImplManager&) = delete;
ImplManager& operator=(const ImplManager&) = delete; ImplManager& operator=(const ImplManager&) = delete;
@ -423,7 +424,8 @@ network::mojom::NetworkContext* CefBrowserContext::GetNetworkContext() {
CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() { CefMediaRouterManager* CefBrowserContext::GetMediaRouterManager() {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!media_router_manager_) { if (!media_router_manager_) {
media_router_manager_.reset(new CefMediaRouterManager(AsBrowserContext())); media_router_manager_ =
std::make_unique<CefMediaRouterManager>(AsBrowserContext());
} }
return media_router_manager_.get(); return media_router_manager_.get();
} }

View File

@ -61,7 +61,7 @@ class WebContentsUserDataAdapter : public base::SupportsUserData::Data {
} }
private: private:
WebContentsUserDataAdapter(CefRefPtr<CefBrowserHostBase> browser) explicit WebContentsUserDataAdapter(CefRefPtr<CefBrowserHostBase> browser)
: browser_(browser) { : browser_(browser) {
auto web_contents = browser->GetWebContents(); auto web_contents = browser->GetWebContents();
DCHECK(web_contents); DCHECK(web_contents);

View File

@ -28,7 +28,7 @@ class Extension;
// Parameters that are passed to the runtime-specific Create methods. // Parameters that are passed to the runtime-specific Create methods.
struct CefBrowserCreateParams { struct CefBrowserCreateParams {
CefBrowserCreateParams() {} CefBrowserCreateParams() = default;
// Copy constructor used with the chrome runtime only. // Copy constructor used with the chrome runtime only.
CefBrowserCreateParams(const CefBrowserCreateParams& that) { CefBrowserCreateParams(const CefBrowserCreateParams& that) {
@ -127,7 +127,7 @@ class CefBrowserHostBase : public CefBrowserHost,
virtual void OnBrowserDestroyed(CefBrowserHostBase* browser) = 0; virtual void OnBrowserDestroyed(CefBrowserHostBase* browser) = 0;
protected: protected:
virtual ~Observer() {} ~Observer() override = default;
}; };
// Create a new CefBrowserHost instance of the current runtime type with // Create a new CefBrowserHost instance of the current runtime type with

View File

@ -4,6 +4,8 @@
#include "libcef/browser/browser_info.h" #include "libcef/browser/browser_info.h"
#include <memory>
#include "libcef/browser/browser_host_base.h" #include "libcef/browser/browser_host_base.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/frame_util.h" #include "libcef/common/frame_util.h"
@ -542,7 +544,8 @@ CefBrowserInfo::NotificationStateLock::NotificationStateLock(
} }
// Take the browser info state lock. // Take the browser info state lock.
browser_info_lock_scope_.reset(new base::AutoLock(browser_info_->lock_)); browser_info_lock_scope_ =
std::make_unique<base::AutoLock>(browser_info_->lock_);
} }
CefBrowserInfo::NotificationStateLock::~NotificationStateLock() { CefBrowserInfo::NotificationStateLock::~NotificationStateLock() {

View File

@ -32,7 +32,7 @@ class CefAllowCertificateErrorCallbackImpl : public CefCallback {
CefAllowCertificateErrorCallbackImpl& operator=( CefAllowCertificateErrorCallbackImpl& operator=(
const CefAllowCertificateErrorCallbackImpl&) = delete; const CefAllowCertificateErrorCallbackImpl&) = delete;
~CefAllowCertificateErrorCallbackImpl() { ~CefAllowCertificateErrorCallbackImpl() override {
if (!callback_.is_null()) { if (!callback_.is_null()) {
// The callback is still pending. Cancel it now. // The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {

View File

@ -30,7 +30,7 @@ class BrowserDelegate : public content::WebContentsDelegate {
// instances. // instances.
class CreateParams : public base::RefCounted<CreateParams> { class CreateParams : public base::RefCounted<CreateParams> {
public: public:
virtual ~CreateParams() {} virtual ~CreateParams() = default;
}; };
// Called from the Browser constructor to create a new delegate. // Called from the Browser constructor to create a new delegate.
@ -39,7 +39,7 @@ class BrowserDelegate : public content::WebContentsDelegate {
scoped_refptr<CreateParams> cef_params, scoped_refptr<CreateParams> cef_params,
const Browser* opener); const Browser* opener);
~BrowserDelegate() override {} ~BrowserDelegate() override = default;
// Optionally override Browser creation in // Optionally override Browser creation in
// DevToolsWindow::CreateDevToolsBrowser. The returned Browser, if any, will // DevToolsWindow::CreateDevToolsBrowser. The returned Browser, if any, will

View File

@ -4,6 +4,8 @@
#include "libcef/browser/chrome/chrome_browser_context.h" #include "libcef/browser/chrome/chrome_browser_context.h"
#include <memory>
#include "libcef/browser/prefs/browser_prefs.h" #include "libcef/browser/prefs/browser_prefs.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
@ -144,8 +146,8 @@ void ChromeBrowserContext::ProfileCreated(Profile::CreateStatus status,
// exists. // exists.
profile_ = profile; profile_ = profile;
profile_->AddObserver(this); profile_->AddObserver(this);
profile_keep_alive_.reset(new ScopedProfileKeepAlive( profile_keep_alive_ = std::make_unique<ScopedProfileKeepAlive>(
profile_, ProfileKeepAliveOrigin::kAppWindow)); profile_, ProfileKeepAliveOrigin::kAppWindow);
} }
if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) { if (status == Profile::CreateStatus::CREATE_STATUS_INITIALIZED) {

View File

@ -27,7 +27,7 @@ class ChromeBrowserHostImpl : public CefBrowserHostBase {
// possibly shared by multiple Browser instances. // possibly shared by multiple Browser instances.
class DelegateCreateParams : public cef::BrowserDelegate::CreateParams { class DelegateCreateParams : public cef::BrowserDelegate::CreateParams {
public: public:
DelegateCreateParams(const CefBrowserCreateParams& create_params) explicit DelegateCreateParams(const CefBrowserCreateParams& create_params)
: create_params_(create_params) {} : create_params_(create_params) {}
CefBrowserCreateParams create_params_; CefBrowserCreateParams create_params_;

View File

@ -132,7 +132,7 @@ class CefContextMenuObserver : public RenderViewContextMenuObserver,
private: private:
struct ItemInfo { struct ItemInfo {
ItemInfo() {} ItemInfo() = default;
bool checked = false; bool checked = false;
absl::optional<ui::Accelerator> accel; absl::optional<ui::Accelerator> accel;

View File

@ -91,7 +91,7 @@ class BrowserView;
// CefWindowView::CreateWidget() when the Chrome runtime is enabled. // CefWindowView::CreateWidget() when the Chrome runtime is enabled.
class ChromeBrowserFrame : public BrowserFrame { class ChromeBrowserFrame : public BrowserFrame {
public: public:
ChromeBrowserFrame() {} ChromeBrowserFrame() = default;
ChromeBrowserFrame(const ChromeBrowserFrame&) = delete; ChromeBrowserFrame(const ChromeBrowserFrame&) = delete;
ChromeBrowserFrame& operator=(const ChromeBrowserFrame&) = delete; ChromeBrowserFrame& operator=(const ChromeBrowserFrame&) = delete;

View File

@ -4,6 +4,8 @@
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include <memory>
#include "libcef/browser/browser_info_manager.h" #include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/request_context_impl.h" #include "libcef/browser/request_context_impl.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
@ -426,10 +428,9 @@ void CefSetOSModalLoop(bool osModalLoop) {
// CefContext // CefContext
CefContext::CefContext() CefContext::CefContext() = default;
: initialized_(false), shutting_down_(false), init_thread_id_(0) {}
CefContext::~CefContext() {} CefContext::~CefContext() = default;
// static // static
CefContext* CefContext::Get() { CefContext* CefContext::Get() {
@ -472,10 +473,10 @@ bool CefContext::Initialize(const CefMainArgs& args,
NormalizePathAndSet(settings_.resources_dir_path, "resources_dir_path"); NormalizePathAndSet(settings_.resources_dir_path, "resources_dir_path");
NormalizePathAndSet(settings_.locales_dir_path, "locales_dir_path"); NormalizePathAndSet(settings_.locales_dir_path, "locales_dir_path");
browser_info_manager_.reset(new CefBrowserInfoManager); browser_info_manager_ = std::make_unique<CefBrowserInfoManager>();
main_runner_.reset(new CefMainRunner(settings_.multi_threaded_message_loop, main_runner_ = std::make_unique<CefMainRunner>(
settings_.external_message_pump)); settings_.multi_threaded_message_loop, settings_.external_message_pump);
if (!main_runner_->Initialize( if (!main_runner_->Initialize(
&settings_, application, args, windows_sandbox_info, &initialized_, &settings_, application, args, windows_sandbox_info, &initialized_,
base::BindOnce(&CefContext::OnContextInitialized, base::BindOnce(&CefContext::OnContextInitialized,
@ -543,7 +544,7 @@ CefTraceSubscriber* CefContext::GetTraceSubscriber() {
return nullptr; return nullptr;
} }
if (!trace_subscriber_.get()) { if (!trace_subscriber_.get()) {
trace_subscriber_.reset(new CefTraceSubscriber()); trace_subscriber_ = std::make_unique<CefTraceSubscriber>();
} }
return trace_subscriber_.get(); return trace_subscriber_.get();
} }

View File

@ -30,7 +30,7 @@ class CefContext {
virtual void OnContextDestroyed() = 0; virtual void OnContextDestroyed() = 0;
protected: protected:
virtual ~Observer() {} virtual ~Observer() = default;
}; };
CefContext(); CefContext();
@ -98,11 +98,11 @@ class CefContext {
void FinalizeShutdown(); void FinalizeShutdown();
// Track context state. // Track context state.
bool initialized_; bool initialized_ = false;
bool shutting_down_; bool shutting_down_ = false;
// The thread on which the context was initialized. // The thread on which the context was initialized.
base::PlatformThreadId init_thread_id_; base::PlatformThreadId init_thread_id_ = 0;
CefSettings settings_; CefSettings settings_;
CefRefPtr<CefApp> application_; CefRefPtr<CefApp> application_;

View File

@ -36,7 +36,7 @@ class CefDevToolsController : public content::DevToolsAgentHostClient {
virtual void OnDevToolsControllerDestroyed() = 0; virtual void OnDevToolsControllerDestroyed() = 0;
protected: protected:
~Observer() override {} ~Observer() override = default;
}; };
// |inspected_contents| will outlive this object. // |inspected_contents| will outlive this object.

View File

@ -7,6 +7,7 @@
#include <stddef.h> #include <stddef.h>
#include <iomanip> #include <iomanip>
#include <memory>
#include <utility> #include <utility>
#include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context.h"
@ -256,7 +257,7 @@ CefDevToolsFrontend* CefDevToolsFrontend::Show(
if (inspected_browser->is_views_hosted()) { if (inspected_browser->is_views_hosted()) {
create_params.popup_with_views_hosted_opener = true; create_params.popup_with_views_hosted_opener = true;
} else { } else {
create_params.window_info.reset(new CefWindowInfo(windowInfo)); create_params.window_info = std::make_unique<CefWindowInfo>(windowInfo);
} }
create_params.client = client; create_params.client = client;
create_params.settings = new_settings; create_params.settings = new_settings;
@ -322,7 +323,7 @@ CefDevToolsFrontend::CefDevToolsFrontend(
DCHECK(!frontend_destroyed_callback_.is_null()); DCHECK(!frontend_destroyed_callback_.is_null());
} }
CefDevToolsFrontend::~CefDevToolsFrontend() {} CefDevToolsFrontend::~CefDevToolsFrontend() = default;
void CefDevToolsFrontend::ReadyToCommitNavigation( void CefDevToolsFrontend::ReadyToCommitNavigation(
content::NavigationHandle* navigation_handle) { content::NavigationHandle* navigation_handle) {

View File

@ -4,6 +4,8 @@
#include "libcef/browser/devtools/devtools_manager.h" #include "libcef/browser/devtools/devtools_manager.h"
#include <memory>
#include "libcef/browser/devtools/devtools_controller.h" #include "libcef/browser/devtools/devtools_controller.h"
#include "libcef/browser/devtools/devtools_frontend.h" #include "libcef/browser/devtools/devtools_frontend.h"
#include "libcef/features/runtime.h" #include "libcef/features/runtime.h"
@ -209,8 +211,8 @@ void CefDevToolsManager::OnFrontEndDestroyed() {
bool CefDevToolsManager::EnsureController() { bool CefDevToolsManager::EnsureController() {
if (!devtools_controller_) { if (!devtools_controller_) {
devtools_controller_.reset(new CefDevToolsController( devtools_controller_ = std::make_unique<CefDevToolsController>(
inspected_browser_->contents_delegate()->web_contents())); inspected_browser_->contents_delegate()->web_contents());
} }
return true; return true;
} }

View File

@ -123,9 +123,9 @@ void CefDevToolsManagerDelegate::StopHttpHandler() {
content::DevToolsAgentHost::StopRemoteDebuggingServer(); content::DevToolsAgentHost::StopRemoteDebuggingServer();
} }
CefDevToolsManagerDelegate::CefDevToolsManagerDelegate() {} CefDevToolsManagerDelegate::CefDevToolsManagerDelegate() = default;
CefDevToolsManagerDelegate::~CefDevToolsManagerDelegate() {} CefDevToolsManagerDelegate::~CefDevToolsManagerDelegate() = default;
scoped_refptr<content::DevToolsAgentHost> scoped_refptr<content::DevToolsAgentHost>
CefDevToolsManagerDelegate::CreateNewTarget( CefDevToolsManagerDelegate::CreateNewTarget(

View File

@ -6,8 +6,7 @@
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
namespace extensions { namespace extensions::alloy {
namespace alloy {
int GetTabIdForWebContents(content::WebContents* web_contents) { int GetTabIdForWebContents(content::WebContents* web_contents) {
auto browser = AlloyBrowserHostImpl::GetBrowserForContents(web_contents); auto browser = AlloyBrowserHostImpl::GetBrowserForContents(web_contents);
@ -17,5 +16,4 @@ int GetTabIdForWebContents(content::WebContents* web_contents) {
return browser->GetIdentifier(); return browser->GetIdentifier();
} }
} // namespace alloy } // namespace extensions::alloy
} // namespace extensions

View File

@ -9,13 +9,11 @@ namespace content {
class WebContents; class WebContents;
} }
namespace extensions { namespace extensions::alloy {
namespace alloy {
// Returns the tabId for |web_contents|, or -1 if not found. // Returns the tabId for |web_contents|, or -1 if not found.
int GetTabIdForWebContents(content::WebContents* web_contents); int GetTabIdForWebContents(content::WebContents* web_contents);
} // namespace alloy } // namespace extensions::alloy
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_ALLOY_EXTENSIONS_UTIL_H_ #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_ALLOY_EXTENSIONS_UTIL_H_

View File

@ -13,8 +13,7 @@
#include "extensions/common/api/file_system.h" #include "extensions/common/api/file_system.h"
#include "extensions/common/extension.h" #include "extensions/common/extension.h"
namespace extensions { namespace extensions::cef {
namespace cef {
CefFileSystemDelegate::CefFileSystemDelegate() = default; CefFileSystemDelegate::CefFileSystemDelegate() = default;
@ -85,5 +84,4 @@ SavedFilesServiceInterface* CefFileSystemDelegate::GetSavedFilesService(
return apps::SavedFilesService::Get(browser_context); return apps::SavedFilesService::Get(browser_context);
} }
} // namespace cef } // namespace extensions::cef
} // namespace extensions

View File

@ -18,8 +18,7 @@ namespace content {
class WebContents; class WebContents;
} }
namespace extensions { namespace extensions::cef {
namespace cef {
class CefFileSystemDelegate : public FileSystemDelegate { class CefFileSystemDelegate : public FileSystemDelegate {
public: public:
@ -52,7 +51,6 @@ class CefFileSystemDelegate : public FileSystemDelegate {
content::BrowserContext* browser_context) override; content::BrowserContext* browser_context) override;
}; };
} // namespace cef } // namespace extensions::cef
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_ #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_DELEGATE_H_

View File

@ -21,9 +21,7 @@
using content::BrowserThread; using content::BrowserThread;
namespace extensions { namespace extensions::cef {
namespace cef {
namespace { namespace {
@ -101,5 +99,4 @@ value_store::ValueStore* SyncValueStoreCache::GetStorage(
storage_map_[extension->id()] = std::move(storage); storage_map_[extension->id()] = std::move(storage);
return storage_ptr; return storage_ptr;
} }
} // namespace cef } // namespace extensions::cef
} // namespace extensions

View File

@ -16,8 +16,7 @@ namespace value_store {
class ValueStoreFactory; class ValueStoreFactory;
} }
namespace extensions { namespace extensions::cef {
namespace cef {
// Based on LocalValueStoreCache // Based on LocalValueStoreCache
// ValueStoreCache for the SYNC namespace. It owns a backend for apps and // ValueStoreCache for the SYNC namespace. It owns a backend for apps and
@ -54,7 +53,6 @@ class SyncValueStoreCache : public ValueStoreCache {
StorageMap storage_map_; StorageMap storage_map_;
}; };
} // namespace cef } // namespace extensions::cef
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_ #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_STORAGE_SYNC_VALUE_STORE_CACHE_H_

View File

@ -25,8 +25,7 @@
using zoom::ZoomController; using zoom::ZoomController;
namespace extensions { namespace extensions::cef {
namespace cef {
namespace keys = extensions::tabs_constants; namespace keys = extensions::tabs_constants;
namespace tabs = api::tabs; namespace tabs = api::tabs;
@ -241,10 +240,9 @@ ExtensionFunction::ResponseValue TabsUpdateFunction::GetResult() {
/*opener_browser_id=*/-1, /*active=*/true, tab_id_))); /*opener_browser_id=*/-1, /*active=*/true, tab_id_)));
} }
ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() ExecuteCodeInTabFunction::ExecuteCodeInTabFunction() : cef_details_(this) {}
: cef_details_(this), execute_tab_id_(-1) {}
ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() {} ExecuteCodeInTabFunction::~ExecuteCodeInTabFunction() = default;
ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() { ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
if (init_result_) { if (init_result_) {
@ -538,5 +536,4 @@ ExtensionFunction::ResponseAction TabsGetZoomSettingsFunction::Run() {
ArgumentList(tabs::GetZoomSettings::Results::Create(zoom_settings))); ArgumentList(tabs::GetZoomSettings::Results::Create(zoom_settings)));
} }
} // namespace cef } // namespace extensions::cef
} // namespace extensions

View File

@ -18,11 +18,10 @@ namespace content {
class WebContents; class WebContents;
} }
namespace extensions { namespace extensions::cef {
namespace cef {
class TabsGetFunction : public ExtensionFunction { class TabsGetFunction : public ExtensionFunction {
~TabsGetFunction() override {} ~TabsGetFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
@ -32,7 +31,7 @@ class TabsGetFunction : public ExtensionFunction {
class TabsCreateFunction : public ExtensionFunction { class TabsCreateFunction : public ExtensionFunction {
public: public:
TabsCreateFunction(); TabsCreateFunction();
~TabsCreateFunction() override {} ~TabsCreateFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
@ -47,7 +46,7 @@ class BaseAPIFunction : public ExtensionFunction {
BaseAPIFunction(); BaseAPIFunction();
protected: protected:
~BaseAPIFunction() override {} ~BaseAPIFunction() override = default;
// Gets the WebContents for |tab_id| if it is specified. Otherwise get the // Gets the WebContents for |tab_id| if it is specified. Otherwise get the
// WebContents for the active tab in the current window. Calling this function // WebContents for the active tab in the current window. Calling this function
@ -60,7 +59,7 @@ class BaseAPIFunction : public ExtensionFunction {
class TabsUpdateFunction : public BaseAPIFunction { class TabsUpdateFunction : public BaseAPIFunction {
private: private:
~TabsUpdateFunction() override {} ~TabsUpdateFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
@ -98,19 +97,19 @@ class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
std::unique_ptr<std::string> data); std::unique_ptr<std::string> data);
// Id of tab which executes code. // Id of tab which executes code.
int execute_tab_id_; int execute_tab_id_ = -1;
}; };
class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction { class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction {
private: private:
~TabsExecuteScriptFunction() override {} ~TabsExecuteScriptFunction() override = default;
DECLARE_EXTENSION_FUNCTION("tabs.executeScript", TABS_EXECUTESCRIPT) DECLARE_EXTENSION_FUNCTION("tabs.executeScript", TABS_EXECUTESCRIPT)
}; };
class TabsInsertCSSFunction : public ExecuteCodeInTabFunction { class TabsInsertCSSFunction : public ExecuteCodeInTabFunction {
private: private:
~TabsInsertCSSFunction() override {} ~TabsInsertCSSFunction() override = default;
bool ShouldInsertCSS() const override; bool ShouldInsertCSS() const override;
@ -119,7 +118,7 @@ class TabsInsertCSSFunction : public ExecuteCodeInTabFunction {
class TabsRemoveCSSFunction : public ExecuteCodeInTabFunction { class TabsRemoveCSSFunction : public ExecuteCodeInTabFunction {
private: private:
~TabsRemoveCSSFunction() override {} ~TabsRemoveCSSFunction() override = default;
bool ShouldRemoveCSS() const override; bool ShouldRemoveCSS() const override;
@ -132,7 +131,7 @@ class ZoomAPIFunction : public ExtensionFunction {
ZoomAPIFunction(); ZoomAPIFunction();
protected: protected:
~ZoomAPIFunction() override {} ~ZoomAPIFunction() override = default;
// Gets the WebContents for |tab_id| if it is specified. Otherwise get the // Gets the WebContents for |tab_id| if it is specified. Otherwise get the
// WebContents for the active tab in the current window. Calling this function // WebContents for the active tab in the current window. Calling this function
@ -147,7 +146,7 @@ class ZoomAPIFunction : public ExtensionFunction {
class TabsSetZoomFunction : public BaseAPIFunction { class TabsSetZoomFunction : public BaseAPIFunction {
private: private:
~TabsSetZoomFunction() override {} ~TabsSetZoomFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
@ -156,7 +155,7 @@ class TabsSetZoomFunction : public BaseAPIFunction {
class TabsGetZoomFunction : public BaseAPIFunction { class TabsGetZoomFunction : public BaseAPIFunction {
private: private:
~TabsGetZoomFunction() override {} ~TabsGetZoomFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
@ -165,7 +164,7 @@ class TabsGetZoomFunction : public BaseAPIFunction {
class TabsSetZoomSettingsFunction : public BaseAPIFunction { class TabsSetZoomSettingsFunction : public BaseAPIFunction {
private: private:
~TabsSetZoomSettingsFunction() override {} ~TabsSetZoomSettingsFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
@ -174,14 +173,13 @@ class TabsSetZoomSettingsFunction : public BaseAPIFunction {
class TabsGetZoomSettingsFunction : public BaseAPIFunction { class TabsGetZoomSettingsFunction : public BaseAPIFunction {
private: private:
~TabsGetZoomSettingsFunction() override {} ~TabsGetZoomSettingsFunction() override = default;
ResponseAction Run() override; ResponseAction Run() override;
DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS) DECLARE_EXTENSION_FUNCTION("tabs.getZoomSettings", TABS_GETZOOMSETTINGS)
}; };
} // namespace cef } // namespace extensions::cef
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_ #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_API_TABS_TABS_API_H_

View File

@ -14,7 +14,7 @@ class CefBrowserPlatformDelegateBackground
public CefBrowserPlatformDelegateNative::WindowlessHandler { public CefBrowserPlatformDelegateNative::WindowlessHandler {
public: public:
// Platform-specific behaviors will be delegated to |native_delegate|. // Platform-specific behaviors will be delegated to |native_delegate|.
CefBrowserPlatformDelegateBackground( explicit CefBrowserPlatformDelegateBackground(
std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate); std::unique_ptr<CefBrowserPlatformDelegateNative> native_delegate);
// CefBrowserPlatformDelegate methods: // CefBrowserPlatformDelegate methods:

View File

@ -18,9 +18,7 @@
#include "extensions/browser/api/storage/storage_api.h" #include "extensions/browser/api/storage/storage_api.h"
#include "extensions/browser/extension_function_registry.h" #include "extensions/browser/extension_function_registry.h"
namespace extensions { namespace extensions::api::cef {
namespace api {
namespace cef {
namespace cefimpl = extensions::cef; namespace cefimpl = extensions::cef;
@ -111,6 +109,4 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
registry->RegisterFunction<cefimpl::TabsGetZoomSettingsFunction>(); registry->RegisterFunction<cefimpl::TabsGetZoomSettingsFunction>();
} }
} // namespace cef } // namespace extensions::api::cef
} // namespace api
} // namespace extensions

View File

@ -9,9 +9,7 @@
class ExtensionFunctionRegistry; class ExtensionFunctionRegistry;
namespace extensions { namespace extensions::api::cef {
namespace api {
namespace cef {
// Array of currently supported APIs. // Array of currently supported APIs.
extern const char* const kSupportedAPIs[]; extern const char* const kSupportedAPIs[];
@ -22,8 +20,6 @@ class ChromeFunctionRegistry {
static void RegisterAll(ExtensionFunctionRegistry* registry); static void RegisterAll(ExtensionFunctionRegistry* registry);
}; };
} // namespace cef } // namespace extensions::api::cef
} // namespace api
} // namespace extensions
#endif // CEF_LIBCEF_BROWSER_EXTENSIONS_CHROME_API_REGISTRATION_H_ #endif // CEF_LIBCEF_BROWSER_EXTENSIONS_CHROME_API_REGISTRATION_H_

View File

@ -33,7 +33,8 @@ CefComponentExtensionResourceManager::CefComponentExtensionResourceManager() {
std::move(pdf_viewer_replacements); std::move(pdf_viewer_replacements);
} }
CefComponentExtensionResourceManager::~CefComponentExtensionResourceManager() {} CefComponentExtensionResourceManager::~CefComponentExtensionResourceManager() =
default;
bool CefComponentExtensionResourceManager::IsComponentExtensionResource( bool CefComponentExtensionResourceManager::IsComponentExtensionResource(
const base::FilePath& extension_path, const base::FilePath& extension_path,

View File

@ -4,6 +4,8 @@
#include "libcef/browser/extensions/extension_function_details.h" #include "libcef/browser/extensions/extension_function_details.h"
#include <memory>
#include "libcef/browser/browser_context.h" #include "libcef/browser/browser_context.h"
#include "libcef/browser/extensions/browser_extensions_util.h" #include "libcef/browser/extensions/browser_extensions_util.h"
#include "libcef/browser/extensions/extension_system.h" #include "libcef/browser/extensions/extension_system.h"
@ -42,7 +44,7 @@ class CefGetExtensionLoadFileCallbackImpl
CefGetExtensionLoadFileCallbackImpl& operator=( CefGetExtensionLoadFileCallbackImpl& operator=(
const CefGetExtensionLoadFileCallbackImpl&) = delete; const CefGetExtensionLoadFileCallbackImpl&) = delete;
~CefGetExtensionLoadFileCallbackImpl() { ~CefGetExtensionLoadFileCallbackImpl() override {
if (!callback_.is_null()) { if (!callback_.is_null()) {
// The callback is still pending. Cancel it now. // The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
@ -139,7 +141,7 @@ CefExtensionFunctionDetails::CefExtensionFunctionDetails(
ExtensionFunction* function) ExtensionFunction* function)
: function_(function) {} : function_(function) {}
CefExtensionFunctionDetails::~CefExtensionFunctionDetails() {} CefExtensionFunctionDetails::~CefExtensionFunctionDetails() = default;
Profile* CefExtensionFunctionDetails::GetProfile() const { Profile* CefExtensionFunctionDetails::GetProfile() const {
return Profile::FromBrowserContext(function_->browser_context()); return Profile::FromBrowserContext(function_->browser_context());
@ -285,9 +287,9 @@ bool CefExtensionFunctionDetails::LoadFile(const std::string& file,
return false; return false;
} }
CefExtensionFunctionDetails::OpenTabParams::OpenTabParams() {} CefExtensionFunctionDetails::OpenTabParams::OpenTabParams() = default;
CefExtensionFunctionDetails::OpenTabParams::~OpenTabParams() {} CefExtensionFunctionDetails::OpenTabParams::~OpenTabParams() = default;
std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::OpenTab( std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::OpenTab(
const OpenTabParams& params, const OpenTabParams& params,
@ -369,7 +371,7 @@ std::unique_ptr<api::tabs::Tab> CefExtensionFunctionDetails::OpenTab(
CefBrowserCreateParams create_params; CefBrowserCreateParams create_params;
create_params.url = url.spec(); create_params.url = url.spec();
create_params.request_context = request_context; create_params.request_context = request_context;
create_params.window_info.reset(new CefWindowInfo); create_params.window_info = std::make_unique<CefWindowInfo>();
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
create_params.window_info->SetAsPopup(nullptr, CefString()); create_params.window_info->SetAsPopup(nullptr, CefString());

View File

@ -15,7 +15,7 @@ namespace extensions {
CefExtensionHostDelegate::CefExtensionHostDelegate( CefExtensionHostDelegate::CefExtensionHostDelegate(
AlloyBrowserHostImpl* browser) {} AlloyBrowserHostImpl* browser) {}
CefExtensionHostDelegate::~CefExtensionHostDelegate() {} CefExtensionHostDelegate::~CefExtensionHostDelegate() = default;
void CefExtensionHostDelegate::OnExtensionHostCreated( void CefExtensionHostDelegate::OnExtensionHostCreated(
content::WebContents* web_contents) {} content::WebContents* web_contents) {}

View File

@ -148,7 +148,7 @@ void LoadExtensionFromDisk(base::WeakPtr<CefExtensionSystem> context,
CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context) CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context)
: browser_context_(browser_context), : browser_context_(browser_context),
initialized_(false),
registry_(ExtensionRegistry::Get(browser_context)), registry_(ExtensionRegistry::Get(browser_context)),
renderer_helper_( renderer_helper_(
extensions::RendererStartupHelperFactory::GetForBrowserContext( extensions::RendererStartupHelperFactory::GetForBrowserContext(
@ -157,7 +157,7 @@ CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context)
InitPrefs(); InitPrefs();
} }
CefExtensionSystem::~CefExtensionSystem() {} CefExtensionSystem::~CefExtensionSystem() = default;
void CefExtensionSystem::Init() { void CefExtensionSystem::Init() {
DCHECK(!initialized_); DCHECK(!initialized_);
@ -621,13 +621,11 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) {
info.name = base::UTF8ToUTF16(extension->name()); info.name = base::UTF8ToUTF16(extension->name());
info.path = base::FilePath::FromUTF8Unsafe(extension->url().spec()); info.path = base::FilePath::FromUTF8Unsafe(extension->url().spec());
for (std::set<std::string>::const_iterator mime_type = for (const auto& mime_type : handler->mime_type_set()) {
handler->mime_type_set().begin();
mime_type != handler->mime_type_set().end(); ++mime_type) {
content::WebPluginMimeType mime_type_info; content::WebPluginMimeType mime_type_info;
mime_type_info.mime_type = *mime_type; mime_type_info.mime_type = mime_type;
base::FilePath::StringType file_extension; base::FilePath::StringType file_extension;
if (net::GetPreferredExtensionForMimeType(*mime_type, &file_extension)) { if (net::GetPreferredExtensionForMimeType(mime_type, &file_extension)) {
mime_type_info.file_extensions.push_back( mime_type_info.file_extensions.push_back(
base::FilePath(file_extension).AsUTF8Unsafe()); base::FilePath(file_extension).AsUTF8Unsafe());
} }

View File

@ -155,7 +155,7 @@ class CefExtensionSystem : public ExtensionSystem {
content::BrowserContext* browser_context_; // Not owned. content::BrowserContext* browser_context_; // Not owned.
bool initialized_; bool initialized_ = false;
std::unique_ptr<ServiceWorkerManager> service_worker_manager_; std::unique_ptr<ServiceWorkerManager> service_worker_manager_;
std::unique_ptr<QuotaService> quota_service_; std::unique_ptr<QuotaService> quota_service_;

View File

@ -35,7 +35,7 @@ CefExtensionSystemFactory::CefExtensionSystemFactory()
DependsOn(ExtensionRegistryFactory::GetInstance()); DependsOn(ExtensionRegistryFactory::GetInstance());
} }
CefExtensionSystemFactory::~CefExtensionSystemFactory() {} CefExtensionSystemFactory::~CefExtensionSystemFactory() = default;
std::unique_ptr<KeyedService> std::unique_ptr<KeyedService>
CefExtensionSystemFactory::BuildServiceInstanceForBrowserContext( CefExtensionSystemFactory::BuildServiceInstanceForBrowserContext(

View File

@ -33,7 +33,7 @@ CefExtensionViewHost::CefExtensionViewHost(AlloyBrowserHostImpl* browser,
DCHECK(host_type == mojom::ViewType::kExtensionPopup); DCHECK(host_type == mojom::ViewType::kExtensionPopup);
} }
CefExtensionViewHost::~CefExtensionViewHost() {} CefExtensionViewHost::~CefExtensionViewHost() = default;
void CefExtensionViewHost::OnDidStopFirstLoad() { void CefExtensionViewHost::OnDidStopFirstLoad() {
// Nothing to do here, but don't call the base class method. // Nothing to do here, but don't call the base class method.

View File

@ -20,7 +20,7 @@ CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
*web_contents), *web_contents),
script_executor_(new ScriptExecutor(web_contents)) {} script_executor_(new ScriptExecutor(web_contents)) {}
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {} CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() = default;
// static // static
void CefExtensionWebContentsObserver::CreateForWebContents( void CefExtensionWebContentsObserver::CreateForWebContents(

View File

@ -21,7 +21,7 @@
namespace extensions { namespace extensions {
CefExtensionsAPIClient::CefExtensionsAPIClient() {} CefExtensionsAPIClient::CefExtensionsAPIClient() = default;
AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate() AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate()
const { const {

View File

@ -5,6 +5,7 @@
#include "libcef/browser/extensions/extensions_browser_client.h" #include "libcef/browser/extensions/extensions_browser_client.h"
#include <memory>
#include <utility> #include <utility>
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
@ -100,7 +101,7 @@ CefExtensionsBrowserClient::CefExtensionsBrowserClient()
AddAPIProvider(std::make_unique<CefExtensionsBrowserAPIProvider>()); AddAPIProvider(std::make_unique<CefExtensionsBrowserAPIProvider>());
} }
CefExtensionsBrowserClient::~CefExtensionsBrowserClient() {} CefExtensionsBrowserClient::~CefExtensionsBrowserClient() = default;
// static // static
CefExtensionsBrowserClient* CefExtensionsBrowserClient::Get() { CefExtensionsBrowserClient* CefExtensionsBrowserClient::Get() {
@ -401,7 +402,7 @@ CefExtensionsBrowserClient::GetExtensionWebContentsObserver(
KioskDelegate* CefExtensionsBrowserClient::GetKioskDelegate() { KioskDelegate* CefExtensionsBrowserClient::GetKioskDelegate() {
if (!kiosk_delegate_) { if (!kiosk_delegate_) {
kiosk_delegate_.reset(new CefKioskDelegate()); kiosk_delegate_ = std::make_unique<CefKioskDelegate>();
} }
return kiosk_delegate_.get(); return kiosk_delegate_.get();
} }

View File

@ -19,7 +19,7 @@ CefMimeHandlerViewGuestDelegate::CefMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) MimeHandlerViewGuest* guest)
: guest_(guest), owner_web_contents_(guest_->owner_web_contents()) {} : guest_(guest), owner_web_contents_(guest_->owner_web_contents()) {}
CefMimeHandlerViewGuestDelegate::~CefMimeHandlerViewGuestDelegate() {} CefMimeHandlerViewGuestDelegate::~CefMimeHandlerViewGuestDelegate() = default;
void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams( void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams(
content::WebContents::CreateParams* params) { content::WebContents::CreateParams* params) {

View File

@ -90,8 +90,8 @@ void RunFileDialogDismissed(CefRefPtr<CefRunFileDialogCallback> callback,
const std::vector<base::FilePath>& file_paths) { const std::vector<base::FilePath>& file_paths) {
std::vector<CefString> paths; std::vector<CefString> paths;
if (file_paths.size() > 0) { if (file_paths.size() > 0) {
for (size_t i = 0; i < file_paths.size(); ++i) { for (const auto& file_path : file_paths) {
paths.push_back(file_paths[i].value()); paths.push_back(file_path.value());
} }
} }
callback->OnFileDialogDismissed(paths); callback->OnFileDialogDismissed(paths);

View File

@ -615,8 +615,7 @@ void CefFrameHostImpl::SendToRenderFrame(const std::string& function_name,
if (!render_frame_.is_bound()) { if (!render_frame_.is_bound()) {
// Queue actions until we're notified by the renderer that it's ready to // Queue actions until we're notified by the renderer that it's ready to
// handle them. // handle them.
queued_renderer_actions_.push( queued_renderer_actions_.emplace(function_name, std::move(action));
std::make_pair(function_name, std::move(action)));
return; return;
} }
@ -706,8 +705,7 @@ void CefFrameHostImpl::UpdateDraggableRegions(
for (const auto& region : *regions) { for (const auto& region : *regions) {
const auto& rect = region->bounds; const auto& rect = region->bounds;
const CefRect bounds(rect.x(), rect.y(), rect.width(), rect.height()); const CefRect bounds(rect.x(), rect.y(), rect.width(), rect.height());
draggable_regions.push_back( draggable_regions.emplace_back(bounds, region->draggable);
CefDraggableRegion(bounds, region->draggable));
} }
} }

View File

@ -51,7 +51,7 @@ class FrameServiceBase : public Interface, public WebContentsObserver {
protected: protected:
// Make the destructor private since |this| can only be deleted by Close(). // Make the destructor private since |this| can only be deleted by Close().
virtual ~FrameServiceBase() = default; ~FrameServiceBase() override = default;
// All subclasses should use this function to obtain the origin instead of // All subclasses should use this function to obtain the origin instead of
// trying to get it from the RenderFrameHost pointer directly. // trying to get it from the RenderFrameHost pointer directly.

View File

@ -21,7 +21,7 @@ class CefJSDialogCallbackImpl : public CefJSDialogCallback {
public: public:
using CallbackType = content::JavaScriptDialogManager::DialogClosedCallback; using CallbackType = content::JavaScriptDialogManager::DialogClosedCallback;
CefJSDialogCallbackImpl(CallbackType callback) explicit CefJSDialogCallbackImpl(CallbackType callback)
: callback_(std::move(callback)) {} : callback_(std::move(callback)) {}
~CefJSDialogCallbackImpl() override { ~CefJSDialogCallbackImpl() override {
if (!callback_.is_null()) { if (!callback_.is_null()) {
@ -72,7 +72,7 @@ CefJavaScriptDialogManager::CefJavaScriptDialogManager(
CefBrowserHostBase* browser) CefBrowserHostBase* browser)
: browser_(browser), weak_ptr_factory_(this) {} : browser_(browser), weak_ptr_factory_(this) {}
CefJavaScriptDialogManager::~CefJavaScriptDialogManager() {} CefJavaScriptDialogManager::~CefJavaScriptDialogManager() = default;
void CefJavaScriptDialogManager::Destroy() { void CefJavaScriptDialogManager::Destroy() {
if (handler_) { if (handler_) {

View File

@ -34,6 +34,8 @@
#if BUILDFLAG(IS_WIN) #if BUILDFLAG(IS_WIN)
#include <Objbase.h> #include <Objbase.h>
#include <windows.h> #include <windows.h>
#include <memory>
#include "content/public/app/sandbox_helper_win.h" #include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h" #include "sandbox/win/src/sandbox_types.h"
#endif #endif
@ -498,7 +500,7 @@ int CefMainRunner::RunMainProcess(
bool CefMainRunner::CreateUIThread(base::OnceClosure setup_callback) { bool CefMainRunner::CreateUIThread(base::OnceClosure setup_callback) {
DCHECK(!ui_thread_); DCHECK(!ui_thread_);
ui_thread_.reset(new CefUIThread(this, std::move(setup_callback))); ui_thread_ = std::make_unique<CefUIThread>(this, std::move(setup_callback));
ui_thread_->Start(); ui_thread_->Start();
ui_thread_->WaitUntilThreadStarted(); ui_thread_->WaitUntilThreadStarted();

View File

@ -32,7 +32,7 @@ class CefMainRunner : public CefMainRunnerHandler {
CefMainRunner(const CefMainRunner&) = delete; CefMainRunner(const CefMainRunner&) = delete;
CefMainRunner& operator=(const CefMainRunner&) = delete; CefMainRunner& operator=(const CefMainRunner&) = delete;
~CefMainRunner(); ~CefMainRunner() override;
// Called from CefContext::Initialize. // Called from CefContext::Initialize.
bool Initialize(CefSettings* settings, bool Initialize(CefSettings* settings,

View File

@ -146,8 +146,8 @@ class CefMediaAccessQuery {
} }
if (desktop_audio_requested()) { if (desktop_audio_requested()) {
audio_devices.push_back(blink::MediaStreamDevice( audio_devices.emplace_back(request_.audio_type, "loopback",
request_.audio_type, "loopback", "System Audio")); "System Audio");
} }
if (desktop_video_requested()) { if (desktop_video_requested()) {
@ -160,8 +160,8 @@ class CefMediaAccessQuery {
media_id = media_id =
content::DesktopMediaID::Parse(request_.requested_video_device_id); content::DesktopMediaID::Parse(request_.requested_video_device_id);
} }
video_devices.push_back(blink::MediaStreamDevice( video_devices.emplace_back(request_.video_type, media_id.ToString(),
request_.video_type, media_id.ToString(), "Screen")); "Screen");
} }
blink::mojom::StreamDevicesSetPtr stream_devices_set = blink::mojom::StreamDevicesSetPtr stream_devices_set =

View File

@ -39,9 +39,9 @@ CefMediaCaptureDevicesDispatcher::GetInstance() {
return base::Singleton<CefMediaCaptureDevicesDispatcher>::get(); return base::Singleton<CefMediaCaptureDevicesDispatcher>::get();
} }
CefMediaCaptureDevicesDispatcher::CefMediaCaptureDevicesDispatcher() {} CefMediaCaptureDevicesDispatcher::CefMediaCaptureDevicesDispatcher() = default;
CefMediaCaptureDevicesDispatcher::~CefMediaCaptureDevicesDispatcher() {} CefMediaCaptureDevicesDispatcher::~CefMediaCaptureDevicesDispatcher() = default;
void CefMediaCaptureDevicesDispatcher::RegisterPrefs( void CefMediaCaptureDevicesDispatcher::RegisterPrefs(
PrefRegistrySimple* registry) { PrefRegistrySimple* registry) {

View File

@ -45,7 +45,7 @@ class CefMediaRouterManager
const content::PresentationConnectionStateChangeInfo& info) = 0; const content::PresentationConnectionStateChangeInfo& info) = 0;
protected: protected:
~Observer() override {} ~Observer() override = default;
}; };
explicit CefMediaRouterManager(content::BrowserContext* browser_context); explicit CefMediaRouterManager(content::BrowserContext* browser_context);

View File

@ -44,7 +44,7 @@ class CefRunContextMenuCallbackImpl : public CefRunContextMenuCallback {
CefRunContextMenuCallbackImpl& operator=( CefRunContextMenuCallbackImpl& operator=(
const CefRunContextMenuCallbackImpl&) = delete; const CefRunContextMenuCallbackImpl&) = delete;
~CefRunContextMenuCallbackImpl() { ~CefRunContextMenuCallbackImpl() override {
if (!callback_.is_null()) { if (!callback_.is_null()) {
// The callback is still pending. Cancel it now. // The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {
@ -95,7 +95,7 @@ CefMenuManager::CefMenuManager(AlloyBrowserHostImpl* browser,
: content::WebContentsObserver(browser->web_contents()), : content::WebContentsObserver(browser->web_contents()),
browser_(browser), browser_(browser),
runner_(std::move(runner)), runner_(std::move(runner)),
custom_menu_callback_(nullptr),
weak_ptr_factory_(this) { weak_ptr_factory_(this) {
DCHECK(web_contents()); DCHECK(web_contents());
model_ = new CefMenuModelImpl(this, nullptr, false); model_ = new CefMenuModelImpl(this, nullptr, false);
@ -497,8 +497,8 @@ bool CefMenuManager::IsCustomContextMenuCommand(int command_id) {
// Verify that the specific command ID was passed from the renderer process. // Verify that the specific command ID was passed from the renderer process.
if (!params_.custom_items.empty()) { if (!params_.custom_items.empty()) {
for (size_t i = 0; i < params_.custom_items.size(); ++i) { for (const auto& custom_item : params_.custom_items) {
if (static_cast<int>(params_.custom_items[i]->action) == command_id) { if (static_cast<int>(custom_item->action) == command_id) {
return true; return true;
} }
} }

View File

@ -72,7 +72,7 @@ class CefMenuManager : public CefMenuModelImpl::Delegate,
content::ContextMenuParams params_; content::ContextMenuParams params_;
// Not owned by this class. // Not owned by this class.
CefRunContextMenuCallback* custom_menu_callback_; CefRunContextMenuCallback* custom_menu_callback_ = nullptr;
// Must be the last member. // Must be the last member.
base::WeakPtrFactory<CefMenuManager> weak_ptr_factory_; base::WeakPtrFactory<CefMenuManager> weak_ptr_factory_;

View File

@ -5,6 +5,7 @@
#include "libcef/browser/menu_model_impl.h" #include "libcef/browser/menu_model_impl.h"
#include <memory>
#include <vector> #include <vector>
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
@ -247,10 +248,10 @@ CefMenuModelImpl::CefMenuModelImpl(
menu_model_delegate_(menu_model_delegate), menu_model_delegate_(menu_model_delegate),
is_submenu_(is_submenu) { is_submenu_(is_submenu) {
DCHECK(delegate_ || menu_model_delegate_); DCHECK(delegate_ || menu_model_delegate_);
model_.reset(new CefSimpleMenuModel(this)); model_ = std::make_unique<CefSimpleMenuModel>(this);
} }
CefMenuModelImpl::~CefMenuModelImpl() {} CefMenuModelImpl::~CefMenuModelImpl() = default;
bool CefMenuModelImpl::IsSubMenu() { bool CefMenuModelImpl::IsSubMenu() {
if (!VerifyContext()) { if (!VerifyContext()) {
@ -986,9 +987,9 @@ bool CefMenuModelImpl::VerifyRefCount() {
return false; return false;
} }
for (ItemVector::iterator i = items_.begin(); i != items_.end(); ++i) { for (auto& item : items_) {
if ((*i).submenu_.get()) { if (item.submenu_.get()) {
if (!(*i).submenu_->VerifyRefCount()) { if (!item.submenu_->VerifyRefCount()) {
return false; return false;
} }
} }
@ -1017,8 +1018,8 @@ void CefMenuModelImpl::AddMenuItem(
case blink::mojom::CustomContextMenuItemType::kSubMenu: { case blink::mojom::CustomContextMenuItemType::kSubMenu: {
CefRefPtr<CefMenuModelImpl> sub_menu = static_cast<CefMenuModelImpl*>( CefRefPtr<CefMenuModelImpl> sub_menu = static_cast<CefMenuModelImpl*>(
AddSubMenu(command_id, menu_item.label).get()); AddSubMenu(command_id, menu_item.label).get());
for (size_t i = 0; i < menu_item.submenu.size(); ++i) { for (const auto& i : menu_item.submenu) {
sub_menu->AddMenuItem(*menu_item.submenu[i]); sub_menu->AddMenuItem(*i);
} }
break; break;
} }

View File

@ -50,7 +50,7 @@ class CefMenuModelImpl : public CefMenuModel {
std::u16string& label) = 0; std::u16string& label) = 0;
protected: protected:
virtual ~Delegate() {} virtual ~Delegate() = default;
}; };
// Either |delegate| or |menu_model_delegate| must be non-nullptr. // Either |delegate| or |menu_model_delegate| must be non-nullptr.

View File

@ -13,9 +13,7 @@
CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative( CefBrowserPlatformDelegateNative::CefBrowserPlatformDelegateNative(
const CefWindowInfo& window_info, const CefWindowInfo& window_info,
SkColor background_color) SkColor background_color)
: window_info_(window_info), : window_info_(window_info), background_color_(background_color) {}
background_color_(background_color),
windowless_handler_(nullptr) {}
SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const { SkColor CefBrowserPlatformDelegateNative::GetBackgroundColor() const {
return background_color_; return background_color_;

View File

@ -25,7 +25,7 @@ class CefBrowserPlatformDelegateNative
bool want_dip_coords) const = 0; bool want_dip_coords) const = 0;
protected: protected:
virtual ~WindowlessHandler() {} virtual ~WindowlessHandler() = default;
}; };
// CefBrowserPlatformDelegate methods: // CefBrowserPlatformDelegate methods:
@ -69,7 +69,8 @@ class CefBrowserPlatformDelegateNative
CefWindowInfo window_info_; CefWindowInfo window_info_;
const SkColor background_color_; const SkColor background_color_;
WindowlessHandler* windowless_handler_; // Not owned by this object. // Not owned by this object.
WindowlessHandler* windowless_handler_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_ #endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_H_

View File

@ -162,7 +162,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
if (!window_info_.parent_window) { if (!window_info_.parent_window) {
const bool has_menu = const bool has_menu =
!(window_info_.style & WS_CHILD) && (window_info_.menu != NULL); !(window_info_.style & WS_CHILD) && (window_info_.menu != nullptr);
window_rect = GetAdjustedScreenFrameRect(window_rect, window_info_.style, window_rect = GetAdjustedScreenFrameRect(window_rect, window_info_.style,
window_info_.ex_style, has_menu); window_info_.ex_style, has_menu);
} }
@ -172,7 +172,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
window_info_.style, window_rect.x, window_rect.y, window_info_.style, window_rect.x, window_rect.y,
window_rect.width, window_rect.height, window_rect.width, window_rect.height,
window_info_.parent_window, window_info_.menu, window_info_.parent_window, window_info_.menu,
::GetModuleHandle(NULL), this); ::GetModuleHandle(nullptr), this);
// It's possible for CreateWindowEx to fail if the parent window was // It's possible for CreateWindowEx to fail if the parent window was
// destroyed between the call to CreateBrowser and the above one. // destroyed between the call to CreateBrowser and the above one.
@ -248,7 +248,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
} }
void CefBrowserPlatformDelegateNativeWin::CloseHostWindow() { void CefBrowserPlatformDelegateNativeWin::CloseHostWindow() {
if (window_info_.window != NULL) { if (window_info_.window != nullptr) {
HWND frameWnd = GetAncestor(window_info_.window, GA_ROOT); HWND frameWnd = GetAncestor(window_info_.window, GA_ROOT);
PostMessage(frameWnd, WM_CLOSE, 0, 0); PostMessage(frameWnd, WM_CLOSE, 0, 0);
} }
@ -361,13 +361,13 @@ void CefBrowserPlatformDelegateNativeWin::SizeTo(int width, int height) {
const DWORD style = GetWindowLong(window, GWL_STYLE); const DWORD style = GetWindowLong(window, GWL_STYLE);
const DWORD ex_style = GetWindowLong(window, GWL_EXSTYLE); const DWORD ex_style = GetWindowLong(window, GWL_EXSTYLE);
const bool has_menu = !(style & WS_CHILD) && (GetMenu(window) != NULL); const bool has_menu = !(style & WS_CHILD) && (GetMenu(window) != nullptr);
const auto frame_rect = GetScreenFrameRectFromDIPContentRect( const auto frame_rect = GetScreenFrameRectFromDIPContentRect(
window, gfx::Rect(0, 0, width, height), style, ex_style, has_menu); window, gfx::Rect(0, 0, width, height), style, ex_style, has_menu);
// Size the window. The left/top values may be negative. // Size the window. The left/top values may be negative.
SetWindowPos(window, NULL, 0, 0, frame_rect.width, frame_rect.height, SetWindowPos(window, nullptr, 0, 0, frame_rect.width, frame_rect.height,
SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE); SWP_NOZORDER | SWP_NOMOVE | SWP_NOACTIVATE);
} }
@ -421,7 +421,7 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle( CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const { const content::NativeWebKeyboardEvent& event) const {
if (!event.os_event) { if (!event.os_event) {
return NULL; return nullptr;
} }
return ChromeToWindowsType( return ChromeToWindowsType(
const_cast<CHROME_MSG*>(&event.os_event->native_event())); const_cast<CHROME_MSG*>(&event.os_event->native_event()));
@ -496,13 +496,13 @@ void CefBrowserPlatformDelegateNativeWin::RegisterWindowClass() {
/* lpfnWndProc = */ CefBrowserPlatformDelegateNativeWin::WndProc, /* lpfnWndProc = */ CefBrowserPlatformDelegateNativeWin::WndProc,
/* cbClsExtra = */ 0, /* cbClsExtra = */ 0,
/* cbWndExtra = */ 0, /* cbWndExtra = */ 0,
/* hInstance = */ ::GetModuleHandle(NULL), /* hInstance = */ ::GetModuleHandle(nullptr),
/* hIcon = */ NULL, /* hIcon = */ nullptr,
/* hCursor = */ LoadCursor(NULL, IDC_ARROW), /* hCursor = */ LoadCursor(nullptr, IDC_ARROW),
/* hbrBackground = */ 0, /* hbrBackground = */ nullptr,
/* lpszMenuName = */ NULL, /* lpszMenuName = */ nullptr,
/* lpszClassName = */ CefBrowserPlatformDelegateNativeWin::GetWndClass(), /* lpszClassName = */ CefBrowserPlatformDelegateNativeWin::GetWndClass(),
/* hIconSm = */ NULL, /* hIconSm = */ nullptr,
}; };
RegisterClassEx(&wcex); RegisterClassEx(&wcex);
@ -568,7 +568,7 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
case WM_NCDESTROY: case WM_NCDESTROY:
if (platform_delegate) { if (platform_delegate) {
// Clear the user data pointer. // Clear the user data pointer.
gfx::SetWindowUserData(hwnd, NULL); gfx::SetWindowUserData(hwnd, nullptr);
// Force the browser to be destroyed. This will result in a call to // Force the browser to be destroyed. This will result in a call to
// BrowserDestroyed() that will release the reference added in // BrowserDestroyed() that will release the reference added in
@ -584,7 +584,7 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
// will cause the widget to be hidden which reduces resource usage. // will cause the widget to be hidden which reduces resource usage.
RECT rc; RECT rc;
GetClientRect(hwnd, &rc); GetClientRect(hwnd, &rc);
SetWindowPos(HWNDForWidget(platform_delegate->window_widget_), NULL, SetWindowPos(HWNDForWidget(platform_delegate->window_widget_), nullptr,
rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top,
SWP_NOZORDER); SWP_NOZORDER);
} }
@ -614,8 +614,8 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
// Suggested size and position of the current window scaled for the // Suggested size and position of the current window scaled for the
// new DPI. // new DPI.
const RECT* rect = reinterpret_cast<RECT*>(lParam); const RECT* rect = reinterpret_cast<RECT*>(lParam);
SetWindowPos(platform_delegate->GetHostWindowHandle(), NULL, rect->left, SetWindowPos(platform_delegate->GetHostWindowHandle(), nullptr,
rect->top, rect->right - rect->left, rect->left, rect->top, rect->right - rect->left,
rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE); rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE);
} }
break; break;

View File

@ -4,12 +4,14 @@
#include "libcef/browser/native/menu_runner_views_aura.h" #include "libcef/browser/native/menu_runner_views_aura.h"
#include <memory>
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "base/strings/string_util.h" #include "base/strings/string_util.h"
#include "ui/gfx/geometry/point.h" #include "ui/gfx/geometry/point.h"
CefMenuRunnerViewsAura::CefMenuRunnerViewsAura() {} CefMenuRunnerViewsAura::CefMenuRunnerViewsAura() = default;
bool CefMenuRunnerViewsAura::RunContextMenu( bool CefMenuRunnerViewsAura::RunContextMenu(
AlloyBrowserHostImpl* browser, AlloyBrowserHostImpl* browser,
@ -27,8 +29,8 @@ bool CefMenuRunnerViewsAura::RunContextMenu(
widget = browser->GetWindowWidget(); widget = browser->GetWindowWidget();
} }
menu_.reset( menu_ = std::make_unique<views::MenuRunner>(model->model(),
new views::MenuRunner(model->model(), views::MenuRunner::CONTEXT_MENU)); views::MenuRunner::CONTEXT_MENU);
gfx::Point screen_point = browser->GetScreenPoint( gfx::Point screen_point = browser->GetScreenPoint(
gfx::Point(params.x, params.y), /*want_dip_coords=*/true); gfx::Point(params.x, params.y), /*want_dip_coords=*/true);

View File

@ -136,11 +136,9 @@ const struct {
}; };
ChromeHostId GetChromeHostId(const std::string& host) { ChromeHostId GetChromeHostId(const std::string& host) {
for (size_t i = 0; i < sizeof(kAllowedCefHosts) / sizeof(kAllowedCefHosts[0]); for (auto kAllowedCefHost : kAllowedCefHosts) {
++i) { if (base::EqualsCaseInsensitiveASCII(kAllowedCefHost.host, host.c_str())) {
if (base::EqualsCaseInsensitiveASCII(kAllowedCefHosts[i].host, return kAllowedCefHost.host_id;
host.c_str())) {
return kAllowedCefHosts[i].host_id;
} }
} }
@ -150,17 +148,15 @@ ChromeHostId GetChromeHostId(const std::string& host) {
// Returns WebUI hosts. Does not include chrome debug hosts (for crashing, etc). // Returns WebUI hosts. Does not include chrome debug hosts (for crashing, etc).
void GetAllowedHosts(std::vector<std::string>* hosts) { void GetAllowedHosts(std::vector<std::string>* hosts) {
// Explicitly whitelisted WebUI hosts. // Explicitly whitelisted WebUI hosts.
for (size_t i = 0; for (auto& kAllowedWebUIHost : kAllowedWebUIHosts) {
i < sizeof(kAllowedWebUIHosts) / sizeof(kAllowedWebUIHosts[0]); ++i) { hosts->push_back(kAllowedWebUIHost);
hosts->push_back(kAllowedWebUIHosts[i]);
} }
} }
// Returns true if a host should not be listed on "chrome://webui-hosts". // Returns true if a host should not be listed on "chrome://webui-hosts".
bool IsUnlistedHost(const std::string& host) { bool IsUnlistedHost(const std::string& host) {
for (size_t i = 0; i < sizeof(kUnlistedHosts) / sizeof(kUnlistedHosts[0]); for (auto& kUnlistedHost : kUnlistedHosts) {
++i) { if (host == kUnlistedHost) {
if (host == kUnlistedHosts[i]) {
return true; return true;
} }
} }
@ -175,9 +171,8 @@ bool IsAllowedWebUIHost(const std::string& host) {
} }
// Explicitly whitelisted WebUI hosts. // Explicitly whitelisted WebUI hosts.
for (size_t i = 0; for (auto& kAllowedWebUIHost : kAllowedWebUIHosts) {
i < sizeof(kAllowedWebUIHosts) / sizeof(kAllowedWebUIHosts[0]); ++i) { if (base::EqualsCaseInsensitiveASCII(kAllowedWebUIHost, host.c_str())) {
if (base::EqualsCaseInsensitiveASCII(kAllowedWebUIHosts[i], host.c_str())) {
return true; return true;
} }
} }
@ -195,9 +190,8 @@ void GetDebugURLs(std::vector<std::string>* urls) {
urls->push_back(chrome::kChromeDebugURLs[i]); urls->push_back(chrome::kChromeDebugURLs[i]);
} }
for (size_t i = 0; for (auto& kAllowedDebugURL : kAllowedDebugURLs) {
i < sizeof(kAllowedDebugURLs) / sizeof(kAllowedDebugURLs[0]); ++i) { urls->push_back(kAllowedDebugURL);
urls->push_back(kAllowedDebugURLs[i]);
} }
} }
@ -425,13 +419,12 @@ bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
GetAllowedHosts(&list); GetAllowedHosts(&list);
std::sort(list.begin(), list.end()); std::sort(list.begin(), list.end());
for (size_t i = 0U; i < list.size(); ++i) { for (const auto& i : list) {
if (IsUnlistedHost(list[i])) { if (IsUnlistedHost(i)) {
continue; continue;
} }
html += "<li><a href=\"chrome://" + list[i] + "\">chrome://" + list[i] + html += "<li><a href=\"chrome://" + i + "\">chrome://" + i + "</a></li>\n";
"</a></li>\n";
} }
list.clear(); list.clear();
@ -443,8 +436,8 @@ bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
"<p>The following pages are for debugging purposes only. Because they " "<p>The following pages are for debugging purposes only. Because they "
"crash or hang the renderer, they're not linked directly; you can type " "crash or hang the renderer, they're not linked directly; you can type "
"them into the address bar if you need them.</p>\n<ul>\n"; "them into the address bar if you need them.</p>\n<ul>\n";
for (size_t i = 0U; i < list.size(); ++i) { for (const auto& i : list) {
html += "<li>" + std::string(list[i]) + "</li>\n"; html += "<li>" + std::string(i) + "</li>\n";
} }
html += "</ul>\n"; html += "</ul>\n";

View File

@ -22,7 +22,7 @@ namespace {
class Delegate : public InternalHandlerDelegate { class Delegate : public InternalHandlerDelegate {
public: public:
Delegate() {} Delegate() = default;
bool OnRequest(CefRefPtr<CefBrowser> browser, bool OnRequest(CefRefPtr<CefBrowser> browser,
CefRefPtr<CefRequest> request, CefRefPtr<CefRequest> request,

View File

@ -209,7 +209,7 @@ class InternalHandlerFactory : public CefSchemeHandlerFactory {
} // namespace } // namespace
InternalHandlerDelegate::Action::Action() : stream_size(-1), resource_id(-1) {} InternalHandlerDelegate::Action::Action() = default;
CefRefPtr<CefSchemeHandlerFactory> CreateInternalHandlerFactory( CefRefPtr<CefSchemeHandlerFactory> CreateInternalHandlerFactory(
std::unique_ptr<InternalHandlerDelegate> delegate) { std::unique_ptr<InternalHandlerDelegate> delegate) {

View File

@ -29,19 +29,19 @@ class InternalHandlerDelegate {
// Option 1: Provide a stream for the resource contents. Set |stream_size| // Option 1: Provide a stream for the resource contents. Set |stream_size|
// to the stream size or to -1 if unknown. // to the stream size or to -1 if unknown.
CefRefPtr<CefStreamReader> stream; CefRefPtr<CefStreamReader> stream;
int stream_size; int stream_size = -1;
// Option 2: Provide a base::RefCountedMemory for the resource contents. // Option 2: Provide a base::RefCountedMemory for the resource contents.
scoped_refptr<base::RefCountedMemory> bytes; scoped_refptr<base::RefCountedMemory> bytes;
// Option 3: Specify a resource id to load static content. // Option 3: Specify a resource id to load static content.
int resource_id; int resource_id = -1;
// Option 4: Redirect to the specified URL. // Option 4: Redirect to the specified URL.
GURL redirect_url; GURL redirect_url;
}; };
virtual ~InternalHandlerDelegate() {} virtual ~InternalHandlerDelegate() = default;
// Populate |action| and return true if the request was handled. // Populate |action| and return true if the request was handled.
virtual bool OnRequest(CefRefPtr<CefBrowser> browser, virtual bool OnRequest(CefRefPtr<CefBrowser> browser,

View File

@ -5,6 +5,7 @@
#include "libcef/browser/net_service/browser_urlrequest_impl.h" #include "libcef/browser/net_service/browser_urlrequest_impl.h"
#include <memory>
#include <string> #include <string>
#include <utility> #include <utility>
@ -59,7 +60,7 @@ bool IsValidRequestID(int32_t request_id) {
// Manages the mapping of request IDs to request objects. // Manages the mapping of request IDs to request objects.
class RequestManager { class RequestManager {
public: public:
RequestManager() {} RequestManager() = default;
RequestManager(const RequestManager&) = delete; RequestManager(const RequestManager&) = delete;
RequestManager& operator=(const RequestManager&) = delete; RequestManager& operator=(const RequestManager&) = delete;
@ -626,10 +627,11 @@ CefBrowserURLRequest::CefBrowserURLRequest(
CefRefPtr<CefRequest> request, CefRefPtr<CefRequest> request,
CefRefPtr<CefURLRequestClient> client, CefRefPtr<CefURLRequestClient> client,
CefRefPtr<CefRequestContext> request_context) { CefRefPtr<CefRequestContext> request_context) {
context_.reset(new Context(this, frame, request, client, request_context)); context_ =
std::make_unique<Context>(this, frame, request, client, request_context);
} }
CefBrowserURLRequest::~CefBrowserURLRequest() {} CefBrowserURLRequest::~CefBrowserURLRequest() = default;
bool CefBrowserURLRequest::Start() { bool CefBrowserURLRequest::Start() {
if (!VerifyContext()) { if (!VerifyContext()) {

View File

@ -17,8 +17,7 @@
#include "services/network/cookie_manager.h" #include "services/network/cookie_manager.h"
#include "services/network/public/cpp/resource_request.h" #include "services/network/public/cpp/resource_request.h"
namespace net_service { namespace net_service::cookie_helper {
namespace cookie_helper {
namespace { namespace {
@ -300,7 +299,7 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create( std::unique_ptr<net::CanonicalCookie> cookie = net::CanonicalCookie::Create(
request.url, cookie_string, base::Time::Now(), request.url, cookie_string, base::Time::Now(),
absl::make_optional(response_date), /*partition_key=*/absl::nullopt, absl::make_optional(response_date), /*partition_key=*/absl::nullopt,
/*block_truncated_cookies=*/true, &returned_status); /*block_truncated=*/true, &returned_status);
if (!returned_status.IsInclude()) { if (!returned_status.IsInclude()) {
continue; continue;
} }
@ -325,5 +324,4 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
} }
} }
} // namespace cookie_helper } // namespace net_service::cookie_helper
} // namespace net_service

View File

@ -18,8 +18,7 @@ namespace network {
struct ResourceRequest; struct ResourceRequest;
} // namespace network } // namespace network
namespace net_service { namespace net_service::cookie_helper {
namespace cookie_helper {
// Returns true if the scheme for |url| supports cookies. |cookieable_schemes| // Returns true if the scheme for |url| supports cookies. |cookieable_schemes|
// is the optional list of schemes that the client has explicitly registered as // is the optional list of schemes that the client has explicitly registered as
@ -59,7 +58,6 @@ void SaveCookies(const CefBrowserContext::Getter& browser_context_getter,
const AllowCookieCallback& allow_cookie_callback, const AllowCookieCallback& allow_cookie_callback,
DoneCookieCallback done_callback); DoneCookieCallback done_callback);
} // namespace cookie_helper } // namespace net_service::cookie_helper
} // namespace net_service
#endif // CEF_LIBCEF_BROWSER_NET_SERVICE_COOKIE_HELPER_H_ #endif // CEF_LIBCEF_BROWSER_NET_SERVICE_COOKIE_HELPER_H_

View File

@ -122,7 +122,7 @@ void GetCookiesCallbackImpl(
} // namespace } // namespace
CefCookieManagerImpl::CefCookieManagerImpl() {} CefCookieManagerImpl::CefCookieManagerImpl() = default;
void CefCookieManagerImpl::Initialize( void CefCookieManagerImpl::Initialize(
CefBrowserContext::Getter browser_context_getter, CefBrowserContext::Getter browser_context_getter,

View File

@ -92,7 +92,7 @@ class ResourceContextData : public base::SupportsUserData::Data {
ResourceContextData(const ResourceContextData&) = delete; ResourceContextData(const ResourceContextData&) = delete;
ResourceContextData& operator=(const ResourceContextData&) = delete; ResourceContextData& operator=(const ResourceContextData&) = delete;
~ResourceContextData() override {} ~ResourceContextData() override = default;
static void AddProxyOnUIThread( static void AddProxyOnUIThread(
ProxyURLLoaderFactory* proxy, ProxyURLLoaderFactory* proxy,
@ -1250,8 +1250,8 @@ void InterceptedRequest::OnUploadProgressACK() {
// InterceptedRequestHandler // InterceptedRequestHandler
//============================== //==============================
InterceptedRequestHandler::InterceptedRequestHandler() {} InterceptedRequestHandler::InterceptedRequestHandler() = default;
InterceptedRequestHandler::~InterceptedRequestHandler() {} InterceptedRequestHandler::~InterceptedRequestHandler() = default;
void InterceptedRequestHandler::OnBeforeRequest( void InterceptedRequestHandler::OnBeforeRequest(
int32_t request_id, int32_t request_id,

View File

@ -4,6 +4,8 @@
#include "libcef/browser/net_service/resource_request_handler_wrapper.h" #include "libcef/browser/net_service/resource_request_handler_wrapper.h"
#include <memory>
#include "libcef/browser/browser_host_base.h" #include "libcef/browser/browser_host_base.h"
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/iothread_state.h" #include "libcef/browser/iothread_state.h"
@ -89,7 +91,7 @@ class RequestCallbackWrapper : public CefCallback {
class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler { class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
public: public:
struct RequestState { struct RequestState {
RequestState() {} RequestState() = default;
void Reset(CefRefPtr<CefResourceRequestHandler> handler, void Reset(CefRefPtr<CefResourceRequestHandler> handler,
CefRefPtr<CefSchemeHandlerFactory> scheme_factory, CefRefPtr<CefSchemeHandlerFactory> scheme_factory,
@ -164,7 +166,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
DestructionObserver(const DestructionObserver&) = delete; DestructionObserver(const DestructionObserver&) = delete;
DestructionObserver& operator=(const DestructionObserver&) = delete; DestructionObserver& operator=(const DestructionObserver&) = delete;
virtual ~DestructionObserver() { ~DestructionObserver() override {
CEF_REQUIRE_UIT(); CEF_REQUIRE_UIT();
if (!registered_) { if (!registered_) {
return; return;
@ -225,7 +227,7 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// initialized on the UI thread and later passed to the *Wrapper object on // initialized on the UI thread and later passed to the *Wrapper object on
// the IO thread. // the IO thread.
struct InitState { struct InitState {
InitState() {} InitState() = default;
~InitState() { ~InitState() {
if (destruction_observer_) { if (destruction_observer_) {
@ -259,7 +261,8 @@ class InterceptedRequestHandlerWrapper : public InterceptedRequestHandler {
// that we can stop accepting new requests and cancel pending/in-progress // that we can stop accepting new requests and cancel pending/in-progress
// requests in a timely manner (e.g. before we start asserting about // requests in a timely manner (e.g. before we start asserting about
// leaked objects during CEF shutdown). // leaked objects during CEF shutdown).
destruction_observer_.reset(new DestructionObserver(browser.get())); destruction_observer_ =
std::make_unique<DestructionObserver>(browser.get());
if (browser) { if (browser) {
// These references will be released in OnDestroyed(). // These references will be released in OnDestroyed().

View File

@ -249,7 +249,7 @@ InputStreamReader::InputStreamReader(
DCHECK(work_thread_task_runner_); DCHECK(work_thread_task_runner_);
} }
InputStreamReader::~InputStreamReader() {} InputStreamReader::~InputStreamReader() = default;
void InputStreamReader::Skip(int64_t skip_bytes, void InputStreamReader::Skip(int64_t skip_bytes,
InputStream::SkipCallback callback) { InputStream::SkipCallback callback) {
@ -698,7 +698,7 @@ void StreamReaderURLLoader::ContinueWithResponseHeaders(
if (has_redirect_url || pending_headers->IsRedirect(&location)) { if (has_redirect_url || pending_headers->IsRedirect(&location)) {
pending_response->encoded_data_length = header_length_; pending_response->encoded_data_length = header_length_;
pending_response->content_length = 0; pending_response->content_length = 0;
pending_response->encoded_body_length = 0; pending_response->encoded_body_length = nullptr;
const GURL new_location = const GURL new_location =
has_redirect_url ? *redirect_url : request_.url.Resolve(location); has_redirect_url ? *redirect_url : request_.url.Resolve(location);
client_->OnReceiveRedirect( client_->OnReceiveRedirect(

View File

@ -27,7 +27,7 @@ class InputStreamReader;
// sequence on a worker thread, but not necessarily on the same thread. // sequence on a worker thread, but not necessarily on the same thread.
class InputStream { class InputStream {
public: public:
virtual ~InputStream() {} virtual ~InputStream() = default;
// Callback for asynchronous continuation of Skip(). If |bytes_skipped| > 0 // Callback for asynchronous continuation of Skip(). If |bytes_skipped| > 0
// then either Skip() will be called again until the requested number of // then either Skip() will be called again until the requested number of
@ -69,7 +69,7 @@ class InputStream {
// called on the IO thread unless otherwise indicated. // called on the IO thread unless otherwise indicated.
class ResourceResponse { class ResourceResponse {
public: public:
virtual ~ResourceResponse() {} virtual ~ResourceResponse() = default;
// Callback for asynchronous continuation of Open(). If the InputStream is // Callback for asynchronous continuation of Open(). If the InputStream is
// null the request will be canceled. // null the request will be canceled.

View File

@ -114,7 +114,7 @@ CefHostDisplayClientOSR::CefHostDisplayClientOSR(
gfx::AcceleratedWidget widget) gfx::AcceleratedWidget widget)
: viz::HostDisplayClient(widget), view_(view) {} : viz::HostDisplayClient(widget), view_(view) {}
CefHostDisplayClientOSR::~CefHostDisplayClientOSR() {} CefHostDisplayClientOSR::~CefHostDisplayClientOSR() = default;
void CefHostDisplayClientOSR::SetActive(bool active) { void CefHostDisplayClientOSR::SetActive(bool active) {
active_ = active; active_ = active;

View File

@ -36,7 +36,7 @@ CefMotionEventOSR::CefMotionEventOSR() {
std::fill(id_map_, id_map_ + blink::WebTouchEvent::kTouchesLengthCap, -1); std::fill(id_map_, id_map_ + blink::WebTouchEvent::kTouchesLengthCap, -1);
} }
CefMotionEventOSR::~CefMotionEventOSR() {} CefMotionEventOSR::~CefMotionEventOSR() = default;
int CefMotionEventOSR::GetSourceDeviceId(size_t pointer_index) const { int CefMotionEventOSR::GetSourceDeviceId(size_t pointer_index) const {
if (IsValidIndex(pointer_index)) { if (IsValidIndex(pointer_index)) {
@ -165,9 +165,9 @@ int CefMotionEventOSR::AddId(int id) {
} }
void CefMotionEventOSR::RemoveId(int id) { void CefMotionEventOSR::RemoveId(int id) {
for (int i = 0; i < blink::WebTouchEvent::kTouchesLengthCap; i++) { for (int& i : id_map_) {
if (id_map_[i] == id) { if (i == id) {
id_map_[i] = -1; i = -1;
} }
} }
} }

View File

@ -206,9 +206,9 @@ struct PopulateAxNodeAttributes {
CefRefPtr<CefListValue> list = CefListValue::Create(); CefRefPtr<CefListValue> list = CefListValue::Create();
int index = 0; int index = 0;
// Iterate and find which states are set. // Iterate and find which states are set.
for (unsigned i = 0; i < std::size(textStyleArr); i++) { for (auto& i : textStyleArr) {
if (attr.second & static_cast<int>(textStyleArr[i])) { if (attr.second & static_cast<int>(i)) {
list->SetString(index++, ToString(textStyleArr[i])); list->SetString(index++, ToString(i));
} }
} }
attributes->SetList(ToString(attr.first), list); attributes->SetList(ToString(attr.first), list);
@ -259,8 +259,8 @@ struct PopulateAxNodeAttributes {
if (ax::mojom::IntListAttribute::kMarkerTypes == attr.first) { if (ax::mojom::IntListAttribute::kMarkerTypes == attr.first) {
list = CefListValue::Create(); list = CefListValue::Create();
int index = 0; int index = 0;
for (size_t i = 0; i < attr.second.size(); ++i) { for (int i : attr.second) {
auto type = static_cast<ax::mojom::MarkerType>(attr.second[i]); auto type = static_cast<ax::mojom::MarkerType>(i);
if (type == ax::mojom::MarkerType::kNone) { if (type == ax::mojom::MarkerType::kNone) {
continue; continue;
@ -271,9 +271,9 @@ struct PopulateAxNodeAttributes {
ax::mojom::MarkerType::kTextMatch}; ax::mojom::MarkerType::kTextMatch};
// Iterate and find which markers are set. // Iterate and find which markers are set.
for (unsigned j = 0; j < std::size(marktypeArr); j++) { for (auto& j : marktypeArr) {
if (attr.second[i] & static_cast<int>(marktypeArr[j])) { if (i & static_cast<int>(j)) {
list->SetString(index++, ToString(marktypeArr[j])); list->SetString(index++, ToString(j));
} }
} }
} }

View File

@ -6,6 +6,7 @@
#include "libcef/browser/osr/render_widget_host_view_osr.h" #include "libcef/browser/osr/render_widget_host_view_osr.h"
#include <stdint.h> #include <stdint.h>
#include <memory>
#include <utility> #include <utility>
#include "libcef/browser/alloy/alloy_browser_host_impl.h" #include "libcef/browser/alloy/alloy_browser_host_impl.h"
@ -220,14 +221,15 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
content::RenderViewHost::From(render_widget_host_)); content::RenderViewHost::From(render_widget_host_));
} }
delegated_frame_host_client_.reset(new CefDelegatedFrameHostClient(this)); delegated_frame_host_client_ =
std::make_unique<CefDelegatedFrameHostClient>(this);
// Matching the attributes from BrowserCompositorMac. // Matching the attributes from BrowserCompositorMac.
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>( delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(), delegated_frame_host_client_.get(), AllocateFrameSinkId(), delegated_frame_host_client_.get(),
false /* should_register_frame_sink_id */); false /* should_register_frame_sink_id */);
root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); root_layer_ = std::make_unique<ui::Layer>(ui::LAYER_SOLID_COLOR);
bool opaque = SkColorGetA(background_color_) == SK_AlphaOPAQUE; bool opaque = SkColorGetA(background_color_) == SK_AlphaOPAQUE;
GetRootLayer()->SetFillsBoundsOpaquely(opaque); GetRootLayer()->SetFillsBoundsOpaquely(opaque);
@ -238,10 +240,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
auto context_factory = content::GetContextFactory(); auto context_factory = content::GetContextFactory();
// Matching the attributes from RecyclableCompositorMac. // Matching the attributes from RecyclableCompositorMac.
compositor_.reset(new ui::Compositor( compositor_ = std::make_unique<ui::Compositor>(
context_factory->AllocateFrameSinkId(), context_factory, context_factory->AllocateFrameSinkId(), context_factory,
base::SingleThreadTaskRunner::GetCurrentDefault(), base::SingleThreadTaskRunner::GetCurrentDefault(),
false /* enable_pixel_canvas */, use_external_begin_frame)); false /* enable_pixel_canvas */, use_external_begin_frame);
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
compositor_->SetDelegate(this); compositor_->SetDelegate(this);
@ -254,7 +256,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
render_widget_host_impl->SetCompositorForFlingScheduler(compositor_.get()); render_widget_host_impl->SetCompositorForFlingScheduler(compositor_.get());
} }
cursor_manager_.reset(new content::CursorManager(this)); cursor_manager_ = std::make_unique<content::CursorManager>(this);
// This may result in a call to GetFrameSinkId(). // This may result in a call to GetFrameSinkId().
render_widget_host_->SetView(this); render_widget_host_->SetView(this);
@ -395,7 +397,7 @@ void CefRenderWidgetHostViewOSR::ShowWithVisibility(
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) { if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
// Start generating frames when we're visible and at the correct size. // Start generating frames when we're visible and at the correct size.
if (!video_consumer_) { if (!video_consumer_) {
video_consumer_.reset(new CefVideoConsumerOSR(this)); video_consumer_ = std::make_unique<CefVideoConsumerOSR>(this);
UpdateFrameRate(); UpdateFrameRate();
} else { } else {
video_consumer_->SetActive(true); video_consumer_->SetActive(true);
@ -805,12 +807,12 @@ void CefRenderWidgetHostViewOSR::ImeSetComposition(
std::vector<ui::ImeTextSpan> web_underlines; std::vector<ui::ImeTextSpan> web_underlines;
web_underlines.reserve(underlines.size()); web_underlines.reserve(underlines.size());
for (const CefCompositionUnderline& line : underlines) { for (const CefCompositionUnderline& line : underlines) {
web_underlines.push_back(ui::ImeTextSpan( web_underlines.emplace_back(
ui::ImeTextSpan::Type::kComposition, line.range.from, line.range.to, ui::ImeTextSpan::Type::kComposition, line.range.from, line.range.to,
line.thick ? ui::ImeTextSpan::Thickness::kThick line.thick ? ui::ImeTextSpan::Thickness::kThick
: ui::ImeTextSpan::Thickness::kThin, : ui::ImeTextSpan::Thickness::kThin,
GetImeUnderlineStyle(line.style), line.background_color, line.color, GetImeUnderlineStyle(line.style), line.background_color, line.color,
std::vector<std::string>())); std::vector<std::string>());
} }
gfx::Range range(replacement_range.from, replacement_range.to); gfx::Range range(replacement_range.from, replacement_range.to);
@ -1571,8 +1573,8 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
rect_in_pixels.Intersect(damage_rect); rect_in_pixels.Intersect(damage_rect);
CefRenderHandler::RectList rcList; CefRenderHandler::RectList rcList;
rcList.push_back(CefRect(rect_in_pixels.x(), rect_in_pixels.y(), rcList.emplace_back(rect_in_pixels.x(), rect_in_pixels.y(),
rect_in_pixels.width(), rect_in_pixels.height())); rect_in_pixels.width(), rect_in_pixels.height());
handler->OnPaint(browser_impl_.get(), IsPopupWidget() ? PET_POPUP : PET_VIEW, handler->OnPaint(browser_impl_.get(), IsPopupWidget() ? PET_POPUP : PET_VIEW,
rcList, pixels, pixel_size.width(), pixel_size.height()); rcList, pixels, pixel_size.width(), pixel_size.height());
@ -1816,8 +1818,7 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
if (character_bounds.has_value()) { if (character_bounds.has_value()) {
for (auto& rect : character_bounds.value()) { for (auto& rect : character_bounds.value()) {
rcList.push_back( rcList.emplace_back(rect.x(), rect.y(), rect.width(), rect.height());
CefRect(rect.x(), rect.y(), rect.width(), rect.height()));
} }
} }

View File

@ -46,7 +46,7 @@ class CefRunQuickMenuCallbackImpl : public CefRunQuickMenuCallback {
CefRunQuickMenuCallbackImpl& operator=(const CefRunQuickMenuCallbackImpl&) = CefRunQuickMenuCallbackImpl& operator=(const CefRunQuickMenuCallbackImpl&) =
delete; delete;
~CefRunQuickMenuCallbackImpl() { ~CefRunQuickMenuCallbackImpl() override {
if (!callback_.is_null()) { if (!callback_.is_null()) {
// The callback is still pending. Cancel it now. // The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_UIT()) { if (CEF_CURRENTLY_ON_UIT()) {

View File

@ -120,7 +120,7 @@ class CefTouchSelectionControllerClientOSR
class InternalClient final : public ui::TouchSelectionControllerClient { class InternalClient final : public ui::TouchSelectionControllerClient {
public: public:
explicit InternalClient(CefRenderWidgetHostViewOSR* rwhv) : rwhv_(rwhv) {} explicit InternalClient(CefRenderWidgetHostViewOSR* rwhv) : rwhv_(rwhv) {}
~InternalClient() final {} ~InternalClient() final = default;
bool SupportsAnimation() const final; bool SupportsAnimation() const final;
void SetNeedsAnimate() final; void SetNeedsAnimate() final;

View File

@ -20,10 +20,9 @@ CefWebContentsViewOSR::CefWebContentsViewOSR(SkColor background_color,
bool use_external_begin_frame) bool use_external_begin_frame)
: background_color_(background_color), : background_color_(background_color),
use_shared_texture_(use_shared_texture), use_shared_texture_(use_shared_texture),
use_external_begin_frame_(use_external_begin_frame), use_external_begin_frame_(use_external_begin_frame) {}
web_contents_(nullptr) {}
CefWebContentsViewOSR::~CefWebContentsViewOSR() {} CefWebContentsViewOSR::~CefWebContentsViewOSR() = default;
void CefWebContentsViewOSR::WebContentsCreated( void CefWebContentsViewOSR::WebContentsCreated(
content::WebContents* web_contents) { content::WebContents* web_contents) {

View File

@ -85,12 +85,10 @@ class CefWebContentsViewOSR : public content::WebContentsView,
content::RenderWidgetHostImpl* source_rwh) override; content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragOperation(ui::mojom::DragOperation operation, void UpdateDragOperation(ui::mojom::DragOperation operation,
bool document_is_handling_drag) override; bool document_is_handling_drag) override;
virtual void GotFocus( void GotFocus(content::RenderWidgetHostImpl* render_widget_host) override;
content::RenderWidgetHostImpl* render_widget_host) override; void LostFocus(content::RenderWidgetHostImpl* render_widget_host) override;
virtual void LostFocus( void TakeFocus(bool reverse) override;
content::RenderWidgetHostImpl* render_widget_host) override; void FullscreenStateChanged(bool is_fullscreen) override {}
virtual void TakeFocus(bool reverse) override;
virtual void FullscreenStateChanged(bool is_fullscreen) override {}
private: private:
CefRenderWidgetHostViewOSR* GetView() const; CefRenderWidgetHostViewOSR* GetView() const;
@ -101,7 +99,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
const bool use_shared_texture_; const bool use_shared_texture_;
const bool use_external_begin_frame_; const bool use_external_begin_frame_;
content::WebContents* web_contents_; content::WebContents* web_contents_ = nullptr;
}; };
#endif // CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_ #endif // CEF_LIBCEF_BROWSER_OSR_WEB_CONTENTS_VIEW_OSR_H_

View File

@ -10,14 +10,7 @@
#include "base/memory/ptr_util.h" #include "base/memory/ptr_util.h"
#include "base/values.h" #include "base/values.h"
CefPrefStore::CefPrefStore() CefPrefStore::CefPrefStore() = default;
: read_only_(true),
read_success_(true),
read_error_(PersistentPrefStore::PREF_READ_ERROR_NONE),
block_async_read_(false),
pending_async_read_(false),
init_complete_(false),
committed_(true) {}
bool CefPrefStore::GetValue(base::StringPiece key, bool CefPrefStore::GetValue(base::StringPiece key,
const base::Value** value) const { const base::Value** value) const {
@ -214,4 +207,4 @@ void CefPrefStore::set_read_error(
read_error_ = read_error; read_error_ = read_error;
} }
CefPrefStore::~CefPrefStore() {} CefPrefStore::~CefPrefStore() = default;

View File

@ -47,8 +47,7 @@ class CefPrefStore : public PersistentPrefStore {
PrefReadError GetReadError() const override; PrefReadError GetReadError() const override;
PersistentPrefStore::PrefReadError ReadPrefs() override; PersistentPrefStore::PrefReadError ReadPrefs() override;
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override; void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
virtual void CommitPendingWrite( void CommitPendingWrite(base::OnceClosure done_callback,
base::OnceClosure done_callback,
base::OnceClosure synchronous_done_callback) override; base::OnceClosure synchronous_done_callback) override;
void SchedulePendingLossyWrites() override; void SchedulePendingLossyWrites() override;
void OnStoreDeletionFromDisk() override; void OnStoreDeletionFromDisk() override;
@ -90,26 +89,27 @@ class CefPrefStore : public PersistentPrefStore {
PrefValueMap prefs_; PrefValueMap prefs_;
// Flag that indicates if the PrefStore is read-only // Flag that indicates if the PrefStore is read-only
bool read_only_; bool read_only_ = true;
// The result to pass to PrefStore::Observer::OnInitializationCompleted // The result to pass to PrefStore::Observer::OnInitializationCompleted
bool read_success_; bool read_success_ = true;
// The result to return from ReadPrefs or ReadPrefsAsync. // The result to return from ReadPrefs or ReadPrefsAsync.
PersistentPrefStore::PrefReadError read_error_; PersistentPrefStore::PrefReadError read_error_ =
PersistentPrefStore::PREF_READ_ERROR_NONE;
// Whether a call to ReadPrefsAsync should block. // Whether a call to ReadPrefsAsync should block.
bool block_async_read_; bool block_async_read_ = false;
// Whether there is a pending call to ReadPrefsAsync. // Whether there is a pending call to ReadPrefsAsync.
bool pending_async_read_; bool pending_async_read_ = false;
// Whether initialization has been completed. // Whether initialization has been completed.
bool init_complete_; bool init_complete_ = false;
// Whether the store contents have been committed to disk since the last // Whether the store contents have been committed to disk since the last
// mutation. // mutation.
bool committed_; bool committed_ = true;
std::unique_ptr<ReadErrorDelegate> error_delegate_; std::unique_ptr<ReadErrorDelegate> error_delegate_;
base::ObserverList<PrefStore::Observer, true>::Unchecked observers_; base::ObserverList<PrefStore::Observer, true>::Unchecked observers_;

View File

@ -12,11 +12,9 @@
class CommandLinePrefStore; class CommandLinePrefStore;
namespace blink { namespace blink::web_pref {
namespace web_pref {
struct WebPreferences; struct WebPreferences;
} }
} // namespace blink
namespace content { namespace content {
class RenderViewHost; class RenderViewHost;

View File

@ -97,7 +97,7 @@ void CefPrintSettingsImpl::GetPageRanges(PageRangeList& ranges) {
printing::PageRanges::const_iterator it = page_ranges.begin(); printing::PageRanges::const_iterator it = page_ranges.begin();
for (; it != page_ranges.end(); ++it) { for (; it != page_ranges.end(); ++it) {
const printing::PageRange& range = *it; const printing::PageRange& range = *it;
ranges.push_back(CefRange(range.from, range.to)); ranges.emplace_back(range.from, range.to);
} }
} }

View File

@ -4,6 +4,8 @@
#include "libcef/browser/server_impl.h" #include "libcef/browser/server_impl.h"
#include <memory>
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "libcef/common/request_impl.h" #include "libcef/common/request_impl.h"
#include "libcef/common/task_runner_impl.h" #include "libcef/common/task_runner_impl.h"
@ -46,9 +48,10 @@ std::unique_ptr<std::string> CreateUniqueString(const void* data,
size_t data_size) { size_t data_size) {
std::unique_ptr<std::string> ptr; std::unique_ptr<std::string> ptr;
if (data && data_size > 0) { if (data && data_size > 0) {
ptr.reset(new std::string(static_cast<const char*>(data), data_size)); ptr = std::make_unique<std::string>(static_cast<const char*>(data),
data_size);
} else { } else {
ptr.reset(new std::string()); ptr = std::make_unique<std::string>();
} }
return ptr; return ptr;
} }
@ -165,11 +168,11 @@ void CefServer::CreateServer(const CefString& address,
// CefServerImpl // CefServerImpl
struct CefServerImpl::ConnectionInfo { struct CefServerImpl::ConnectionInfo {
ConnectionInfo() : is_websocket(false), is_websocket_pending(false) {} ConnectionInfo() = default;
// True if this connection is a WebSocket connection. // True if this connection is a WebSocket connection.
bool is_websocket; bool is_websocket = false;
bool is_websocket_pending; bool is_websocket_pending = false;
}; };
CefServerImpl::CefServerImpl(CefRefPtr<CefServerHandler> handler) CefServerImpl::CefServerImpl(CefRefPtr<CefServerHandler> handler)
@ -569,7 +572,7 @@ void CefServerImpl::StartOnHandlerThread(const std::string& address,
std::unique_ptr<net::ServerSocket> socket( std::unique_ptr<net::ServerSocket> socket(
new net::TCPServerSocket(nullptr, net::NetLogSource())); new net::TCPServerSocket(nullptr, net::NetLogSource()));
if (socket->ListenWithAddressAndPort(address, port, backlog) == net::OK) { if (socket->ListenWithAddressAndPort(address, port, backlog) == net::OK) {
server_.reset(new net::HttpServer(std::move(socket), this)); server_ = std::make_unique<net::HttpServer>(std::move(socket), this);
net::IPEndPoint ip_address; net::IPEndPoint ip_address;
if (server_->GetLocalAddress(&ip_address) == net::OK) { if (server_->GetLocalAddress(&ip_address) == net::OK) {

View File

@ -18,7 +18,7 @@ namespace base {
class Thread; class Thread;
} }
class CefServerImpl : public CefServer, net::HttpServer::Delegate { class CefServerImpl : public CefServer, public net::HttpServer::Delegate {
public: public:
explicit CefServerImpl(CefRefPtr<CefServerHandler> handler); explicit CefServerImpl(CefRefPtr<CefServerHandler> handler);

View File

@ -564,7 +564,7 @@ CefRefPtr<CefSimpleMenuModelImpl> CefSimpleMenuModelImpl::CreateNewSubMenu(
} }
CefRefPtr<CefSimpleMenuModelImpl> new_impl = new CefSimpleMenuModelImpl( CefRefPtr<CefSimpleMenuModelImpl> new_impl = new CefSimpleMenuModelImpl(
model, delegate_, state_delegate_, is_owned, /*is_submodel=*/true); model, delegate_, state_delegate_, is_owned, /*is_submenu=*/true);
submenumap_.insert(std::make_pair(model, new_impl)); submenumap_.insert(std::make_pair(model, new_impl));
return new_impl; return new_impl;
} }

View File

@ -27,7 +27,7 @@ class CefSimpleMenuModelImpl : public CefMenuModel {
absl::optional<ui::Accelerator> accel) = 0; absl::optional<ui::Accelerator> accel) = 0;
protected: protected:
virtual ~StateDelegate() {} virtual ~StateDelegate() = default;
}; };
// |delegate| should be the same that was used to create |model|. // |delegate| should be the same that was used to create |model|.

View File

@ -35,7 +35,8 @@ CefSpeechRecognitionManagerDelegate ::CefSpeechRecognitionManagerDelegate() {
command_line->HasSwitch(switches::kEnableProfanityFilter); command_line->HasSwitch(switches::kEnableProfanityFilter);
} }
CefSpeechRecognitionManagerDelegate ::~CefSpeechRecognitionManagerDelegate() {} CefSpeechRecognitionManagerDelegate ::~CefSpeechRecognitionManagerDelegate() =
default;
void CefSpeechRecognitionManagerDelegate::OnRecognitionStart(int session_id) {} void CefSpeechRecognitionManagerDelegate::OnRecognitionStart(int session_id) {}

View File

@ -11,8 +11,8 @@ using content::SSLHostStateDelegate;
namespace internal { namespace internal {
CertPolicy::CertPolicy() {} CertPolicy::CertPolicy() = default;
CertPolicy::~CertPolicy() {} CertPolicy::~CertPolicy() = default;
// For an allowance, we consider a given |cert| to be a match to a saved // For an allowance, we consider a given |cert| to be a match to a saved
// allowed cert if the |error| is an exact match to or subset of the errors // allowed cert if the |error| is an exact match to or subset of the errors
@ -36,9 +36,9 @@ void CertPolicy::Allow(const net::X509Certificate& cert, int error) {
} // namespace internal } // namespace internal
CefSSLHostStateDelegate::CefSSLHostStateDelegate() {} CefSSLHostStateDelegate::CefSSLHostStateDelegate() = default;
CefSSLHostStateDelegate::~CefSSLHostStateDelegate() {} CefSSLHostStateDelegate::~CefSSLHostStateDelegate() = default;
void CefSSLHostStateDelegate::HostRanInsecureContent( void CefSSLHostStateDelegate::HostRanInsecureContent(
const std::string& host, const std::string& host,

View File

@ -7,8 +7,7 @@
#include "net/cert/cert_status_flags.h" #include "net/cert/cert_status_flags.h"
CefSSLInfoImpl::CefSSLInfoImpl(const net::SSLInfo& value) CefSSLInfoImpl::CefSSLInfoImpl(const net::SSLInfo& value) {
: cert_status_(CERT_STATUS_NONE) {
cert_status_ = static_cast<cef_cert_status_t>(value.cert_status); cert_status_ = static_cast<cef_cert_status_t>(value.cert_status);
if (value.cert.get()) { if (value.cert.get()) {
cert_ = new CefX509CertificateImpl(value.cert); cert_ = new CefX509CertificateImpl(value.cert);

View File

@ -23,7 +23,7 @@ class CefSSLInfoImpl : public CefSSLInfo {
CefRefPtr<CefX509Certificate> GetX509Certificate() override; CefRefPtr<CefX509Certificate> GetX509Certificate() override;
private: private:
cef_cert_status_t cert_status_; cef_cert_status_t cert_status_ = CERT_STATUS_NONE;
CefRefPtr<CefX509Certificate> cert_; CefRefPtr<CefX509Certificate> cert_;
IMPLEMENT_REFCOUNTING(CefSSLInfoImpl); IMPLEMENT_REFCOUNTING(CefSSLInfoImpl);

View File

@ -145,8 +145,7 @@ int CefFileWriter::Flush() {
// CefBytesReader // CefBytesReader
CefBytesReader::CefBytesReader(void* data, int64_t datasize, bool copy) CefBytesReader::CefBytesReader(void* data, int64_t datasize, bool copy) {
: data_(nullptr), datasize_(0), copy_(false), offset_(0) {
SetData(data, datasize, copy); SetData(data, datasize, copy);
} }
@ -228,8 +227,7 @@ void CefBytesReader::SetData(void* data, int64_t datasize, bool copy) {
// CefBytesWriter // CefBytesWriter
CefBytesWriter::CefBytesWriter(size_t grow) CefBytesWriter::CefBytesWriter(size_t grow) : grow_(grow), datasize_(grow) {
: grow_(grow), datasize_(grow), offset_(0) {
DCHECK(grow > 0); DCHECK(grow > 0);
data_ = malloc(grow); data_ = malloc(grow);
DCHECK(data_ != nullptr); DCHECK(data_ != nullptr);

View File

@ -73,10 +73,10 @@ class CefBytesReader : public CefStreamReader {
size_t GetDataSize() { return offset_; } size_t GetDataSize() { return offset_; }
protected: protected:
void* data_; void* data_ = nullptr;
int64_t datasize_; int64_t datasize_ = 0;
bool copy_; bool copy_ = false;
int64_t offset_; int64_t offset_ = 0;
base::Lock lock_; base::Lock lock_;
@ -105,7 +105,7 @@ class CefBytesWriter : public CefStreamWriter {
size_t grow_; size_t grow_;
void* data_; void* data_;
int64_t datasize_; int64_t datasize_;
int64_t offset_; int64_t offset_ = 0;
base::Lock lock_; base::Lock lock_;

Some files were not shown because too many files have changed in this diff Show More