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 <map>
#include <memory>
#include <utility>
#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"));
}
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,
visited_link_path, 0));
visited_link_path, 0);
visitedlink_listener_->CreateListenerForContext(this);
visitedlink_master_->Init();
// Initialize proxy configuration tracker.
pref_proxy_config_tracker_.reset(new PrefProxyConfigTrackerImpl(
GetPrefs(), content::GetIOThreadTaskRunner({})));
pref_proxy_config_tracker_ = std::make_unique<PrefProxyConfigTrackerImpl>(
GetPrefs(), content::GetIOThreadTaskRunner({}));
// Spell checking support and possibly other subsystems retrieve the
// PrefService associated with a BrowserContext via UserPrefs::Get().
@ -355,8 +356,8 @@ AlloyBrowserContext::CreateZoomLevelDelegate(
content::DownloadManagerDelegate*
AlloyBrowserContext::GetDownloadManagerDelegate() {
if (!download_manager_delegate_) {
download_manager_delegate_.reset(
new CefDownloadManagerDelegate(GetDownloadManager()));
download_manager_delegate_ =
std::make_unique<CefDownloadManagerDelegate>(GetDownloadManager());
}
return download_manager_delegate_.get();
}
@ -388,7 +389,7 @@ AlloyBrowserContext::GetStorageNotificationService() {
content::SSLHostStateDelegate* AlloyBrowserContext::GetSSLHostStateDelegate() {
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();
}
@ -475,7 +476,7 @@ void AlloyBrowserContext::RebuildTable(
DownloadPrefs* AlloyBrowserContext::GetDownloadPrefs() {
CEF_REQUIRE_UIT();
if (!download_prefs_) {
download_prefs_.reset(new DownloadPrefs(this));
download_prefs_ = std::make_unique<DownloadPrefs>(this);
}
return download_prefs_.get();
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,6 +4,8 @@
#include "libcef/browser/browser_info.h"
#include <memory>
#include "libcef/browser/browser_host_base.h"
#include "libcef/browser/thread_util.h"
#include "libcef/common/frame_util.h"
@ -542,7 +544,8 @@ CefBrowserInfo::NotificationStateLock::NotificationStateLock(
}
// 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() {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -9,13 +9,11 @@ namespace content {
class WebContents;
}
namespace extensions {
namespace alloy {
namespace extensions::alloy {
// Returns the tabId for |web_contents|, or -1 if not found.
int GetTabIdForWebContents(content::WebContents* web_contents);
} // namespace alloy
} // namespace extensions
} // namespace extensions::alloy
#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/extension.h"
namespace extensions {
namespace cef {
namespace extensions::cef {
CefFileSystemDelegate::CefFileSystemDelegate() = default;
@ -85,5 +84,4 @@ SavedFilesServiceInterface* CefFileSystemDelegate::GetSavedFilesService(
return apps::SavedFilesService::Get(browser_context);
}
} // namespace cef
} // namespace extensions
} // namespace extensions::cef

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -51,7 +51,7 @@ class FrameServiceBase : public Interface, public WebContentsObserver {
protected:
// 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
// trying to get it from the RenderFrameHost pointer directly.

View File

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

View File

@ -34,6 +34,8 @@
#if BUILDFLAG(IS_WIN)
#include <Objbase.h>
#include <windows.h>
#include <memory>
#include "content/public/app/sandbox_helper_win.h"
#include "sandbox/win/src/sandbox_types.h"
#endif
@ -498,7 +500,7 @@ int CefMainRunner::RunMainProcess(
bool CefMainRunner::CreateUIThread(base::OnceClosure setup_callback) {
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_->WaitUntilThreadStarted();

View File

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

View File

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

View File

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

View File

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

View File

@ -44,7 +44,7 @@ class CefRunContextMenuCallbackImpl : public CefRunContextMenuCallback {
CefRunContextMenuCallbackImpl& operator=(
const CefRunContextMenuCallbackImpl&) = delete;
~CefRunContextMenuCallbackImpl() {
~CefRunContextMenuCallbackImpl() override {
if (!callback_.is_null()) {
// The callback is still pending. Cancel it now.
if (CEF_CURRENTLY_ON_UIT()) {
@ -95,7 +95,7 @@ CefMenuManager::CefMenuManager(AlloyBrowserHostImpl* browser,
: content::WebContentsObserver(browser->web_contents()),
browser_(browser),
runner_(std::move(runner)),
custom_menu_callback_(nullptr),
weak_ptr_factory_(this) {
DCHECK(web_contents());
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.
if (!params_.custom_items.empty()) {
for (size_t i = 0; i < params_.custom_items.size(); ++i) {
if (static_cast<int>(params_.custom_items[i]->action) == command_id) {
for (const auto& custom_item : params_.custom_items) {
if (static_cast<int>(custom_item->action) == command_id) {
return true;
}
}

View File

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

View File

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

View File

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

View File

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

View File

@ -25,7 +25,7 @@ class CefBrowserPlatformDelegateNative
bool want_dip_coords) const = 0;
protected:
virtual ~WindowlessHandler() {}
virtual ~WindowlessHandler() = default;
};
// CefBrowserPlatformDelegate methods:
@ -69,7 +69,8 @@ class CefBrowserPlatformDelegateNative
CefWindowInfo window_info_;
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_

View File

@ -162,7 +162,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
if (!window_info_.parent_window) {
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_info_.ex_style, has_menu);
}
@ -172,7 +172,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
window_info_.style, window_rect.x, window_rect.y,
window_rect.width, window_rect.height,
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
// destroyed between the call to CreateBrowser and the above one.
@ -248,7 +248,7 @@ bool CefBrowserPlatformDelegateNativeWin::CreateHostWindow() {
}
void CefBrowserPlatformDelegateNativeWin::CloseHostWindow() {
if (window_info_.window != NULL) {
if (window_info_.window != nullptr) {
HWND frameWnd = GetAncestor(window_info_.window, GA_ROOT);
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 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(
window, gfx::Rect(0, 0, width, height), style, ex_style, has_menu);
// 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);
}
@ -421,7 +421,7 @@ bool CefBrowserPlatformDelegateNativeWin::HandleKeyboardEvent(
CefEventHandle CefBrowserPlatformDelegateNativeWin::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const {
if (!event.os_event) {
return NULL;
return nullptr;
}
return ChromeToWindowsType(
const_cast<CHROME_MSG*>(&event.os_event->native_event()));
@ -496,13 +496,13 @@ void CefBrowserPlatformDelegateNativeWin::RegisterWindowClass() {
/* lpfnWndProc = */ CefBrowserPlatformDelegateNativeWin::WndProc,
/* cbClsExtra = */ 0,
/* cbWndExtra = */ 0,
/* hInstance = */ ::GetModuleHandle(NULL),
/* hIcon = */ NULL,
/* hCursor = */ LoadCursor(NULL, IDC_ARROW),
/* hbrBackground = */ 0,
/* lpszMenuName = */ NULL,
/* hInstance = */ ::GetModuleHandle(nullptr),
/* hIcon = */ nullptr,
/* hCursor = */ LoadCursor(nullptr, IDC_ARROW),
/* hbrBackground = */ nullptr,
/* lpszMenuName = */ nullptr,
/* lpszClassName = */ CefBrowserPlatformDelegateNativeWin::GetWndClass(),
/* hIconSm = */ NULL,
/* hIconSm = */ nullptr,
};
RegisterClassEx(&wcex);
@ -568,7 +568,7 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
case WM_NCDESTROY:
if (platform_delegate) {
// 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
// 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.
RECT 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,
SWP_NOZORDER);
}
@ -614,8 +614,8 @@ LRESULT CALLBACK CefBrowserPlatformDelegateNativeWin::WndProc(HWND hwnd,
// Suggested size and position of the current window scaled for the
// new DPI.
const RECT* rect = reinterpret_cast<RECT*>(lParam);
SetWindowPos(platform_delegate->GetHostWindowHandle(), NULL, rect->left,
rect->top, rect->right - rect->left,
SetWindowPos(platform_delegate->GetHostWindowHandle(), nullptr,
rect->left, rect->top, rect->right - rect->left,
rect->bottom - rect->top, SWP_NOZORDER | SWP_NOACTIVATE);
}
break;

View File

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

View File

@ -136,11 +136,9 @@ const struct {
};
ChromeHostId GetChromeHostId(const std::string& host) {
for (size_t i = 0; i < sizeof(kAllowedCefHosts) / sizeof(kAllowedCefHosts[0]);
++i) {
if (base::EqualsCaseInsensitiveASCII(kAllowedCefHosts[i].host,
host.c_str())) {
return kAllowedCefHosts[i].host_id;
for (auto kAllowedCefHost : kAllowedCefHosts) {
if (base::EqualsCaseInsensitiveASCII(kAllowedCefHost.host, host.c_str())) {
return kAllowedCefHost.host_id;
}
}
@ -150,17 +148,15 @@ ChromeHostId GetChromeHostId(const std::string& host) {
// Returns WebUI hosts. Does not include chrome debug hosts (for crashing, etc).
void GetAllowedHosts(std::vector<std::string>* hosts) {
// Explicitly whitelisted WebUI hosts.
for (size_t i = 0;
i < sizeof(kAllowedWebUIHosts) / sizeof(kAllowedWebUIHosts[0]); ++i) {
hosts->push_back(kAllowedWebUIHosts[i]);
for (auto& kAllowedWebUIHost : kAllowedWebUIHosts) {
hosts->push_back(kAllowedWebUIHost);
}
}
// Returns true if a host should not be listed on "chrome://webui-hosts".
bool IsUnlistedHost(const std::string& host) {
for (size_t i = 0; i < sizeof(kUnlistedHosts) / sizeof(kUnlistedHosts[0]);
++i) {
if (host == kUnlistedHosts[i]) {
for (auto& kUnlistedHost : kUnlistedHosts) {
if (host == kUnlistedHost) {
return true;
}
}
@ -175,9 +171,8 @@ bool IsAllowedWebUIHost(const std::string& host) {
}
// Explicitly whitelisted WebUI hosts.
for (size_t i = 0;
i < sizeof(kAllowedWebUIHosts) / sizeof(kAllowedWebUIHosts[0]); ++i) {
if (base::EqualsCaseInsensitiveASCII(kAllowedWebUIHosts[i], host.c_str())) {
for (auto& kAllowedWebUIHost : kAllowedWebUIHosts) {
if (base::EqualsCaseInsensitiveASCII(kAllowedWebUIHost, host.c_str())) {
return true;
}
}
@ -195,9 +190,8 @@ void GetDebugURLs(std::vector<std::string>* urls) {
urls->push_back(chrome::kChromeDebugURLs[i]);
}
for (size_t i = 0;
i < sizeof(kAllowedDebugURLs) / sizeof(kAllowedDebugURLs[0]); ++i) {
urls->push_back(kAllowedDebugURLs[i]);
for (auto& kAllowedDebugURL : kAllowedDebugURLs) {
urls->push_back(kAllowedDebugURL);
}
}
@ -425,13 +419,12 @@ bool OnWebUIHostsUI(std::string* mime_type, std::string* output) {
GetAllowedHosts(&list);
std::sort(list.begin(), list.end());
for (size_t i = 0U; i < list.size(); ++i) {
if (IsUnlistedHost(list[i])) {
for (const auto& i : list) {
if (IsUnlistedHost(i)) {
continue;
}
html += "<li><a href=\"chrome://" + list[i] + "\">chrome://" + list[i] +
"</a></li>\n";
html += "<li><a href=\"chrome://" + i + "\">chrome://" + i + "</a></li>\n";
}
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 "
"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";
for (size_t i = 0U; i < list.size(); ++i) {
html += "<li>" + std::string(list[i]) + "</li>\n";
for (const auto& i : list) {
html += "<li>" + std::string(i) + "</li>\n";
}
html += "</ul>\n";

View File

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

View File

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

View File

@ -5,6 +5,7 @@
#include "libcef/browser/net_service/browser_urlrequest_impl.h"
#include <memory>
#include <string>
#include <utility>
@ -59,7 +60,7 @@ bool IsValidRequestID(int32_t request_id) {
// Manages the mapping of request IDs to request objects.
class RequestManager {
public:
RequestManager() {}
RequestManager() = default;
RequestManager(const RequestManager&) = delete;
RequestManager& operator=(const RequestManager&) = delete;
@ -626,10 +627,11 @@ CefBrowserURLRequest::CefBrowserURLRequest(
CefRefPtr<CefRequest> request,
CefRefPtr<CefURLRequestClient> client,
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() {
if (!VerifyContext()) {

View File

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

View File

@ -18,8 +18,7 @@ namespace network {
struct ResourceRequest;
} // namespace network
namespace net_service {
namespace cookie_helper {
namespace net_service::cookie_helper {
// Returns true if the scheme for |url| supports cookies. |cookieable_schemes|
// 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,
DoneCookieCallback done_callback);
} // namespace cookie_helper
} // namespace net_service
} // namespace net_service::cookie_helper
#endif // CEF_LIBCEF_BROWSER_NET_SERVICE_COOKIE_HELPER_H_

View File

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

View File

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

View File

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

View File

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

View File

@ -27,7 +27,7 @@ class InputStreamReader;
// sequence on a worker thread, but not necessarily on the same thread.
class InputStream {
public:
virtual ~InputStream() {}
virtual ~InputStream() = default;
// Callback for asynchronous continuation of Skip(). If |bytes_skipped| > 0
// 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.
class ResourceResponse {
public:
virtual ~ResourceResponse() {}
virtual ~ResourceResponse() = default;
// Callback for asynchronous continuation of Open(). If the InputStream is
// null the request will be canceled.

View File

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

View File

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

View File

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

View File

@ -6,6 +6,7 @@
#include "libcef/browser/osr/render_widget_host_view_osr.h"
#include <stdint.h>
#include <memory>
#include <utility>
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
@ -220,14 +221,15 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
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.
delegated_frame_host_ = std::make_unique<content::DelegatedFrameHost>(
AllocateFrameSinkId(), delegated_frame_host_client_.get(),
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;
GetRootLayer()->SetFillsBoundsOpaquely(opaque);
@ -238,10 +240,10 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
auto context_factory = content::GetContextFactory();
// Matching the attributes from RecyclableCompositorMac.
compositor_.reset(new ui::Compositor(
compositor_ = std::make_unique<ui::Compositor>(
context_factory->AllocateFrameSinkId(), context_factory,
base::SingleThreadTaskRunner::GetCurrentDefault(),
false /* enable_pixel_canvas */, use_external_begin_frame));
false /* enable_pixel_canvas */, use_external_begin_frame);
compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget);
compositor_->SetDelegate(this);
@ -254,7 +256,7 @@ CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
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().
render_widget_host_->SetView(this);
@ -395,7 +397,7 @@ void CefRenderWidgetHostViewOSR::ShowWithVisibility(
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
// Start generating frames when we're visible and at the correct size.
if (!video_consumer_) {
video_consumer_.reset(new CefVideoConsumerOSR(this));
video_consumer_ = std::make_unique<CefVideoConsumerOSR>(this);
UpdateFrameRate();
} else {
video_consumer_->SetActive(true);
@ -805,12 +807,12 @@ void CefRenderWidgetHostViewOSR::ImeSetComposition(
std::vector<ui::ImeTextSpan> web_underlines;
web_underlines.reserve(underlines.size());
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,
line.thick ? ui::ImeTextSpan::Thickness::kThick
: ui::ImeTextSpan::Thickness::kThin,
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);
@ -1571,8 +1573,8 @@ void CefRenderWidgetHostViewOSR::OnPaint(const gfx::Rect& damage_rect,
rect_in_pixels.Intersect(damage_rect);
CefRenderHandler::RectList rcList;
rcList.push_back(CefRect(rect_in_pixels.x(), rect_in_pixels.y(),
rect_in_pixels.width(), rect_in_pixels.height()));
rcList.emplace_back(rect_in_pixels.x(), rect_in_pixels.y(),
rect_in_pixels.width(), rect_in_pixels.height());
handler->OnPaint(browser_impl_.get(), IsPopupWidget() ? PET_POPUP : PET_VIEW,
rcList, pixels, pixel_size.width(), pixel_size.height());
@ -1816,8 +1818,7 @@ void CefRenderWidgetHostViewOSR::ImeCompositionRangeChanged(
if (character_bounds.has_value()) {
for (auto& rect : character_bounds.value()) {
rcList.push_back(
CefRect(rect.x(), rect.y(), rect.width(), rect.height()));
rcList.emplace_back(rect.x(), rect.y(), rect.width(), rect.height());
}
}

View File

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

View File

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

View File

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

View File

@ -85,12 +85,10 @@ class CefWebContentsViewOSR : public content::WebContentsView,
content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragOperation(ui::mojom::DragOperation operation,
bool document_is_handling_drag) override;
virtual void GotFocus(
content::RenderWidgetHostImpl* render_widget_host) override;
virtual void LostFocus(
content::RenderWidgetHostImpl* render_widget_host) override;
virtual void TakeFocus(bool reverse) override;
virtual void FullscreenStateChanged(bool is_fullscreen) override {}
void GotFocus(content::RenderWidgetHostImpl* render_widget_host) override;
void LostFocus(content::RenderWidgetHostImpl* render_widget_host) override;
void TakeFocus(bool reverse) override;
void FullscreenStateChanged(bool is_fullscreen) override {}
private:
CefRenderWidgetHostViewOSR* GetView() const;
@ -101,7 +99,7 @@ class CefWebContentsViewOSR : public content::WebContentsView,
const bool use_shared_texture_;
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_

View File

@ -10,14 +10,7 @@
#include "base/memory/ptr_util.h"
#include "base/values.h"
CefPrefStore::CefPrefStore()
: 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) {}
CefPrefStore::CefPrefStore() = default;
bool CefPrefStore::GetValue(base::StringPiece key,
const base::Value** value) const {
@ -214,4 +207,4 @@ void CefPrefStore::set_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;
PersistentPrefStore::PrefReadError ReadPrefs() override;
void ReadPrefsAsync(ReadErrorDelegate* error_delegate) override;
virtual void CommitPendingWrite(
base::OnceClosure done_callback,
void CommitPendingWrite(base::OnceClosure done_callback,
base::OnceClosure synchronous_done_callback) override;
void SchedulePendingLossyWrites() override;
void OnStoreDeletionFromDisk() override;
@ -90,26 +89,27 @@ class CefPrefStore : public PersistentPrefStore {
PrefValueMap prefs_;
// Flag that indicates if the PrefStore is read-only
bool read_only_;
bool read_only_ = true;
// The result to pass to PrefStore::Observer::OnInitializationCompleted
bool read_success_;
bool read_success_ = true;
// 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.
bool block_async_read_;
bool block_async_read_ = false;
// Whether there is a pending call to ReadPrefsAsync.
bool pending_async_read_;
bool pending_async_read_ = false;
// Whether initialization has been completed.
bool init_complete_;
bool init_complete_ = false;
// Whether the store contents have been committed to disk since the last
// mutation.
bool committed_;
bool committed_ = true;
std::unique_ptr<ReadErrorDelegate> error_delegate_;
base::ObserverList<PrefStore::Observer, true>::Unchecked observers_;

View File

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

View File

@ -97,7 +97,7 @@ void CefPrintSettingsImpl::GetPageRanges(PageRangeList& ranges) {
printing::PageRanges::const_iterator it = page_ranges.begin();
for (; it != page_ranges.end(); ++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 <memory>
#include "libcef/browser/thread_util.h"
#include "libcef/common/request_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) {
std::unique_ptr<std::string> ptr;
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 {
ptr.reset(new std::string());
ptr = std::make_unique<std::string>();
}
return ptr;
}
@ -165,11 +168,11 @@ void CefServer::CreateServer(const CefString& address,
// CefServerImpl
struct CefServerImpl::ConnectionInfo {
ConnectionInfo() : is_websocket(false), is_websocket_pending(false) {}
ConnectionInfo() = default;
// True if this connection is a WebSocket connection.
bool is_websocket;
bool is_websocket_pending;
bool is_websocket = false;
bool is_websocket_pending = false;
};
CefServerImpl::CefServerImpl(CefRefPtr<CefServerHandler> handler)
@ -569,7 +572,7 @@ void CefServerImpl::StartOnHandlerThread(const std::string& address,
std::unique_ptr<net::ServerSocket> socket(
new net::TCPServerSocket(nullptr, net::NetLogSource()));
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;
if (server_->GetLocalAddress(&ip_address) == net::OK) {

View File

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

View File

@ -564,7 +564,7 @@ CefRefPtr<CefSimpleMenuModelImpl> CefSimpleMenuModelImpl::CreateNewSubMenu(
}
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));
return new_impl;
}

View File

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

View File

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

View File

@ -11,8 +11,8 @@ using content::SSLHostStateDelegate;
namespace internal {
CertPolicy::CertPolicy() {}
CertPolicy::~CertPolicy() {}
CertPolicy::CertPolicy() = default;
CertPolicy::~CertPolicy() = default;
// 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
@ -36,9 +36,9 @@ void CertPolicy::Allow(const net::X509Certificate& cert, int error) {
} // namespace internal
CefSSLHostStateDelegate::CefSSLHostStateDelegate() {}
CefSSLHostStateDelegate::CefSSLHostStateDelegate() = default;
CefSSLHostStateDelegate::~CefSSLHostStateDelegate() {}
CefSSLHostStateDelegate::~CefSSLHostStateDelegate() = default;
void CefSSLHostStateDelegate::HostRanInsecureContent(
const std::string& host,

View File

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

View File

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

View File

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

View File

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

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