Apply clang-format to all C, C++ and ObjC files (issue #2171)

This commit is contained in:
Marshall Greenblatt
2017-05-17 11:29:28 +02:00
parent b461c9fbd2
commit 33f077616f
1331 changed files with 33014 additions and 32258 deletions

View File

@@ -43,8 +43,9 @@ bool GetTabById(int tab_id,
// BrowserContext.
Profile* profile = Profile::FromBrowserContext(browser_context);
Profile* incognito_profile =
include_incognito && profile->HasOffTheRecordProfile() ?
profile->GetOffTheRecordProfile() : NULL;
include_incognito && profile->HasOffTheRecordProfile()
? profile->GetOffTheRecordProfile()
: NULL;
CefBrowserInfoManager::BrowserInfoList list;
CefBrowserInfoManager::GetInstance()->GetBrowserInfoList(list);
@@ -65,8 +66,7 @@ bool GetTabById(int tab_id,
if (!browser_context)
continue;
if (browser_context == profile ||
browser_context == incognito_profile) {
if (browser_context == profile || browser_context == incognito_profile) {
content::WebContents* web_contents = cef_browser->web_contents();
if (SessionTabHelper::IdForTab(web_contents) == tab_id) {
if (browser)
@@ -94,8 +94,8 @@ bool GetTabById(int tab_id,
}
if (error_message) {
*error_message = ErrorUtils::FormatErrorMessage(
keys::kTabNotFoundError, base::IntToString(tab_id));
*error_message = ErrorUtils::FormatErrorMessage(keys::kTabNotFoundError,
base::IntToString(tab_id));
}
return false;
@@ -134,11 +134,8 @@ content::WebContents* ZoomAPIFunction::GetWebContents(int tab_id) {
content::WebContents* web_contents = NULL;
if (tab_id != -1) {
// We assume this call leaves web_contents unchanged if it is unsuccessful.
GetTabById(tab_id,
context_,
include_incognito(),
NULL /* ignore CefBrowserHostImpl* output */,
&web_contents,
GetTabById(tab_id, context_, include_incognito(),
NULL /* ignore CefBrowserHostImpl* output */, &web_contents,
&error_);
} else {
// Use the sender as the default.

View File

@@ -77,10 +77,10 @@ CefRefPtr<CefBrowserHostImpl> GetOwnerBrowserForFrame(int render_process_id,
if (info.get()) {
CefRefPtr<CefBrowserHostImpl> browser = info->browser();
if (!browser.get()) {
LOG(WARNING) << "Found browser id " << info->browser_id() <<
" but no browser object matching view process id " <<
render_process_id << " and frame routing id " <<
render_routing_id;
LOG(WARNING) << "Found browser id " << info->browser_id()
<< " but no browser object matching view process id "
<< render_process_id << " and frame routing id "
<< render_routing_id;
}
return browser;
}

View File

@@ -26,16 +26,16 @@ namespace cefimpl = extensions::cef;
// static
bool ChromeFunctionRegistry::IsSupported(const std::string& name) {
static const char* const supported_apis[] = {
"resourcesPrivate",
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
"streamsPrivate",
EXTENSION_FUNCTION_NAME(StreamsPrivateAbortFunction),
"tabs",
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomSettingsFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomSettingsFunction),
"resourcesPrivate",
EXTENSION_FUNCTION_NAME(ResourcesPrivateGetStringsFunction),
"streamsPrivate",
EXTENSION_FUNCTION_NAME(StreamsPrivateAbortFunction),
"tabs",
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomSettingsFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomSettingsFunction),
};
for (size_t i = 0; i < arraysize(supported_apis); ++i) {
if (name == supported_apis[i])

View File

@@ -12,9 +12,8 @@
namespace extensions {
CefComponentExtensionResourceManager::CefComponentExtensionResourceManager() {
AddComponentResourceEntries(
kComponentExtensionResources,
kComponentExtensionResourcesSize);
AddComponentResourceEntries(kComponentExtensionResources,
kComponentExtensionResourcesSize);
}
CefComponentExtensionResourceManager::~CefComponentExtensionResourceManager() {}
@@ -45,12 +44,12 @@ void CefComponentExtensionResourceManager::AddComponentResourceEntries(
const GritResourceMap* entries,
size_t size) {
for (size_t i = 0; i < size; ++i) {
base::FilePath resource_path = base::FilePath().AppendASCII(
entries[i].name);
base::FilePath resource_path =
base::FilePath().AppendASCII(entries[i].name);
resource_path = resource_path.NormalizePathSeparators();
DCHECK(path_to_resource_id_.find(resource_path) ==
path_to_resource_id_.end());
path_to_resource_id_.end());
path_to_resource_id_[resource_path] = entries[i].value;
}
}

View File

@@ -64,8 +64,7 @@ std::string GenerateId(const base::DictionaryValue* manifest,
}
// Implementation based on ComponentLoader::ParseManifest.
base::DictionaryValue* ParseManifest(
const std::string& manifest_contents) {
base::DictionaryValue* ParseManifest(const std::string& manifest_contents) {
JSONStringValueDeserializer deserializer(manifest_contents);
std::unique_ptr<base::Value> manifest(deserializer.Deserialize(NULL, NULL));
@@ -86,11 +85,9 @@ CefExtensionSystem::CefExtensionSystem(BrowserContext* browser_context)
renderer_helper_(
extensions::RendererStartupHelperFactory::GetForBrowserContext(
browser_context)),
weak_ptr_factory_(this) {
}
weak_ptr_factory_(this) {}
CefExtensionSystem::~CefExtensionSystem() {
}
CefExtensionSystem::~CefExtensionSystem() {}
void CefExtensionSystem::Init() {
DCHECK(!initialized_);
@@ -189,8 +186,7 @@ void CefExtensionSystem::RemoveExtension(const std::string& extension_id) {
}
}
void CefExtensionSystem::Shutdown() {
}
void CefExtensionSystem::Shutdown() {}
void CefExtensionSystem::InitForRegularProfile(bool extensions_enabled) {
DCHECK(!initialized_);
@@ -254,14 +250,11 @@ void CefExtensionSystem::RegisterExtensionWithRequestContexts(
// TODO(extensions): The |incognito_enabled| value should be set based on
// manifest settings.
BrowserThread::PostTaskAndReply(
BrowserThread::IO,
FROM_HERE,
base::Bind(&InfoMap::AddExtension,
info_map(),
base::RetainedRef(extension),
base::Time::Now(),
true, // incognito_enabled
false), // notifications_disabled
BrowserThread::IO, FROM_HERE,
base::Bind(&InfoMap::AddExtension, info_map(),
base::RetainedRef(extension), base::Time::Now(),
true, // incognito_enabled
false), // notifications_disabled
callback);
}
@@ -271,8 +264,7 @@ void CefExtensionSystem::UnregisterExtensionWithRequestContexts(
const std::string& extension_id,
const UnloadedExtensionInfo::Reason reason) {
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
BrowserThread::IO, FROM_HERE,
base::Bind(&InfoMap::RemoveExtension, info_map(), extension_id, reason));
}
@@ -295,11 +287,10 @@ void CefExtensionSystem::InstallUpdate(const std::string& extension_id,
base::DeleteFile(temp_dir, true /* recursive */);
}
CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
const base::DictionaryValue* manifest, const base::FilePath& directory)
: manifest(manifest),
root_directory(directory) {
const base::DictionaryValue* manifest,
const base::FilePath& directory)
: manifest(manifest), root_directory(directory) {
if (!root_directory.IsAbsolute()) {
// This path structure is required by
// url_request_util::MaybeCreateURLRequestResourceBundleJob.
@@ -311,16 +302,13 @@ CefExtensionSystem::ComponentExtensionInfo::ComponentExtensionInfo(
// Implementation based on ComponentLoader::CreateExtension.
scoped_refptr<const Extension> CefExtensionSystem::CreateExtension(
const ComponentExtensionInfo& info, std::string* utf8_error) {
const ComponentExtensionInfo& info,
std::string* utf8_error) {
// TODO(abarth): We should REQUIRE_MODERN_MANIFEST_VERSION once we've updated
// our component extensions to the new manifest version.
int flags = Extension::REQUIRE_KEY;
return Extension::Create(
info.root_directory,
Manifest::COMPONENT,
*info.manifest,
flags,
utf8_error);
return Extension::Create(info.root_directory, Manifest::COMPONENT,
*info.manifest, flags, utf8_error);
}
// Implementation based on ComponentLoader::Load and
@@ -343,9 +331,8 @@ const Extension* CefExtensionSystem::LoadExtension(
}
// Implementation based on ExtensionService::UnloadExtension.
void CefExtensionSystem::UnloadExtension(
const std::string& extension_id,
UnloadedExtensionInfo::Reason reason) {
void CefExtensionSystem::UnloadExtension(const std::string& extension_id,
UnloadedExtensionInfo::Reason reason) {
// Make sure the extension gets deleted after we return from this function.
int include_mask =
ExtensionRegistry::EVERYTHING & ~ExtensionRegistry::TERMINATED;
@@ -418,7 +405,7 @@ void CefExtensionSystem::NotifyExtensionLoaded(const Extension* extension) {
info.path = base::FilePath::FromUTF8Unsafe(extension->url().spec());
for (std::set<std::string>::const_iterator mime_type =
handler->mime_type_set().begin();
handler->mime_type_set().begin();
mime_type != handler->mime_type_set().end(); ++mime_type) {
content::WebPluginMimeType mime_type_info;
mime_type_info.mime_type = *mime_type;

View File

@@ -97,23 +97,22 @@ class CefExtensionSystem : public ExtensionSystem {
};
scoped_refptr<const Extension> CreateExtension(
const ComponentExtensionInfo& info, std::string* utf8_error);
const ComponentExtensionInfo& info,
std::string* utf8_error);
// Loads a registered component extension.
const Extension* LoadExtension(const ComponentExtensionInfo& info);
// Unload the specified extension.
void UnloadExtension(
const std::string& extension_id,
extensions::UnloadedExtensionInfo::Reason reason);
void UnloadExtension(const std::string& extension_id,
extensions::UnloadedExtensionInfo::Reason reason);
// Handles sending notification that |extension| was loaded.
void NotifyExtensionLoaded(const Extension* extension);
// Handles sending notification that |extension| was unloaded.
void NotifyExtensionUnloaded(
const Extension* extension,
UnloadedExtensionInfo::Reason reason);
void NotifyExtensionUnloaded(const Extension* extension,
UnloadedExtensionInfo::Reason reason);
// Completes extension loading after URLRequestContexts have been updated
// on the IO thread.

View File

@@ -35,8 +35,7 @@ CefExtensionSystemFactory::CefExtensionSystemFactory()
DependsOn(ExtensionRegistryFactory::GetInstance());
}
CefExtensionSystemFactory::~CefExtensionSystemFactory() {
}
CefExtensionSystemFactory::~CefExtensionSystemFactory() {}
KeyedService* CefExtensionSystemFactory::BuildServiceInstanceFor(
BrowserContext* context) const {

View File

@@ -15,11 +15,9 @@ namespace extensions {
CefExtensionWebContentsObserver::CefExtensionWebContentsObserver(
content::WebContents* web_contents)
: ExtensionWebContentsObserver(web_contents) {
}
: ExtensionWebContentsObserver(web_contents) {}
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {
}
CefExtensionWebContentsObserver::~CefExtensionWebContentsObserver() {}
void CefExtensionWebContentsObserver::RenderViewCreated(
content::RenderViewHost* render_view_host) {

View File

@@ -17,8 +17,7 @@ class CefExtensionWebContentsObserver
private:
friend class content::WebContentsUserData<CefExtensionWebContentsObserver>;
explicit CefExtensionWebContentsObserver(
content::WebContents* web_contents);
explicit CefExtensionWebContentsObserver(content::WebContents* web_contents);
~CefExtensionWebContentsObserver() override;
// content::WebContentsObserver overrides.

View File

@@ -21,8 +21,7 @@
namespace extensions {
CefExtensionsAPIClient::CefExtensionsAPIClient() {
}
CefExtensionsAPIClient::CefExtensionsAPIClient() {}
AppViewGuestDelegate* CefExtensionsAPIClient::CreateAppViewGuestDelegate()
const {
@@ -42,9 +41,8 @@ CefExtensionsAPIClient::CreateGuestViewManagerDelegate(
// to provide the *Impl object instead of |context| which may be a *Proxy
// object. If we don't do this then the Delegate may attempt to access a
// *Proxy object that has already been deleted.
return base::WrapUnique(
new extensions::ExtensionsGuestViewManagerDelegate(
CefBrowserContextImpl::GetForContext(context)));
return base::WrapUnique(new extensions::ExtensionsGuestViewManagerDelegate(
CefBrowserContextImpl::GetForContext(context)));
}
std::unique_ptr<MimeHandlerViewGuestDelegate>
@@ -62,9 +60,8 @@ void CefExtensionsAPIClient::AttachWebContentsHelpers(
// Used by the PDF extension.
pdf::PDFWebContentsHelper::CreateForWebContentsWithClient(
web_contents,
std::unique_ptr<pdf::PDFWebContentsHelperClient>(
new CefPDFWebContentsHelperClient()));
web_contents, std::unique_ptr<pdf::PDFWebContentsHelperClient>(
new CefPDFWebContentsHelperClient()));
// Used by the tabs extension API.
SessionTabHelper::CreateForWebContents(web_contents);

View File

@@ -22,8 +22,8 @@ class CefExtensionsAPIClient : public ExtensionsAPIClient {
std::unique_ptr<MimeHandlerViewGuestDelegate>
CreateMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest) const override;
void AttachWebContentsHelpers(content::WebContents* web_contents) const
override;
void AttachWebContentsHelpers(
content::WebContents* web_contents) const override;
};
} // namespace extensions

View File

@@ -40,11 +40,9 @@ namespace extensions {
CefExtensionsBrowserClient::CefExtensionsBrowserClient()
: api_client_(new CefExtensionsAPIClient),
resource_manager_(new CefComponentExtensionResourceManager) {
}
resource_manager_(new CefComponentExtensionResourceManager) {}
CefExtensionsBrowserClient::~CefExtensionsBrowserClient() {
}
CefExtensionsBrowserClient::~CefExtensionsBrowserClient() {}
bool CefExtensionsBrowserClient::IsShuttingDown() {
return false;
@@ -84,8 +82,7 @@ BrowserContext* CefExtensionsBrowserClient::GetOriginalContext(
return chrome::GetBrowserContextRedirectedInIncognito(context);
}
bool CefExtensionsBrowserClient::IsGuestSession(
BrowserContext* context) const {
bool CefExtensionsBrowserClient::IsGuestSession(BrowserContext* context) const {
return false;
}
@@ -109,10 +106,7 @@ CefExtensionsBrowserClient::MaybeCreateResourceBundleRequestJob(
const std::string& content_security_policy,
bool send_cors_header) {
return chrome_url_request_util::MaybeCreateURLRequestResourceBundleJob(
request,
network_delegate,
directory_path,
content_security_policy,
request, network_delegate, directory_path, content_security_policy,
send_cors_header);
}
@@ -145,11 +139,10 @@ PrefService* CefExtensionsBrowserClient::GetPrefServiceForContext(
void CefExtensionsBrowserClient::GetEarlyExtensionPrefsObservers(
content::BrowserContext* context,
std::vector<ExtensionPrefsObserver*>* observers) const {
}
std::vector<ExtensionPrefsObserver*>* observers) const {}
ProcessManagerDelegate*
CefExtensionsBrowserClient::GetProcessManagerDelegate() const {
ProcessManagerDelegate* CefExtensionsBrowserClient::GetProcessManagerDelegate()
const {
return NULL;
}
@@ -165,14 +158,13 @@ bool CefExtensionsBrowserClient::DidVersionUpdate(BrowserContext* context) {
return false;
}
void CefExtensionsBrowserClient::PermitExternalProtocolHandler() {
}
void CefExtensionsBrowserClient::PermitExternalProtocolHandler() {}
bool CefExtensionsBrowserClient::IsRunningInForcedAppMode() {
return false;
}
bool CefExtensionsBrowserClient::IsLoggedInAsPublicAccount() {
bool CefExtensionsBrowserClient::IsLoggedInAsPublicAccount() {
return false;
}
@@ -189,7 +181,7 @@ void CefExtensionsBrowserClient::RegisterExtensionFunctions(
// CEF-only APIs.
// TODO(cef): Enable if/when CEF exposes its own Mojo APIs. See
// libcef/common/extensions/api/README.txt for details.
//api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
// api::cef::CefGeneratedFunctionRegistry::RegisterAll(registry);
// Chrome APIs whitelisted by CEF.
api::cef::ChromeFunctionRegistry::RegisterAll(registry);
@@ -218,9 +210,9 @@ void CefExtensionsBrowserClient::BroadcastEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
std::unique_ptr<base::ListValue> args) {
g_browser_process->extension_event_router_forwarder()->
BroadcastEventToRenderers(histogram_value, event_name, std::move(args),
GURL());
g_browser_process->extension_event_router_forwarder()
->BroadcastEventToRenderers(histogram_value, event_name, std::move(args),
GURL());
}
net::NetLog* CefExtensionsBrowserClient::GetNetLog() {

View File

@@ -53,11 +53,9 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) override;
void GetEarlyExtensionPrefsObservers(
content::BrowserContext* context,
std::vector<ExtensionPrefsObserver*>* observers) const
override;
std::vector<ExtensionPrefsObserver*>* observers) const override;
ProcessManagerDelegate* GetProcessManagerDelegate() const override;
std::unique_ptr<ExtensionHostDelegate>
CreateExtensionHostDelegate() override;
std::unique_ptr<ExtensionHostDelegate> CreateExtensionHostDelegate() override;
bool DidVersionUpdate(content::BrowserContext* context) override;
void PermitExternalProtocolHandler() override;
bool IsRunningInForcedAppMode() override;
@@ -71,9 +69,10 @@ class CefExtensionsBrowserClient : public ExtensionsBrowserClient {
content::BrowserContext* context) const override;
const ComponentExtensionResourceManager*
GetComponentExtensionResourceManager() override;
void BroadcastEventToRenderers(events::HistogramValue histogram_value,
const std::string& event_name,
std::unique_ptr<base::ListValue> args) override;
void BroadcastEventToRenderers(
events::HistogramValue histogram_value,
const std::string& event_name,
std::unique_ptr<base::ListValue> args) override;
net::NetLog* GetNetLog() override;
ExtensionCache* GetExtensionCache() override;
bool IsBackgroundUpdateAllowed() override;

View File

@@ -32,11 +32,9 @@ CefRefPtr<CefBrowserHostImpl> GetOwnerBrowser(
CefMimeHandlerViewGuestDelegate::CefMimeHandlerViewGuestDelegate(
MimeHandlerViewGuest* guest)
: guest_(guest) {
}
: guest_(guest) {}
CefMimeHandlerViewGuestDelegate::~CefMimeHandlerViewGuestDelegate() {
}
CefMimeHandlerViewGuestDelegate::~CefMimeHandlerViewGuestDelegate() {}
void CefMimeHandlerViewGuestDelegate::OverrideWebContentsCreateParams(
content::WebContents::CreateParams* params) {
@@ -64,11 +62,9 @@ void CefMimeHandlerViewGuestDelegate::OnGuestAttached(
// Associate guest state information with the owner browser.
scoped_refptr<CefBrowserInfo> info = owner_browser->browser_info();
info->guest_render_id_manager()->add_render_view_id(
view_host->GetProcess()->GetID(),
view_host->GetRoutingID());
view_host->GetProcess()->GetID(), view_host->GetRoutingID());
info->guest_render_id_manager()->add_render_frame_id(
main_frame_host->GetProcess()->GetID(),
main_frame_host->GetRoutingID());
main_frame_host->GetProcess()->GetID(), main_frame_host->GetRoutingID());
}
void CefMimeHandlerViewGuestDelegate::OnGuestDetached(
@@ -88,10 +84,9 @@ void CefMimeHandlerViewGuestDelegate::OnGuestDetached(
// Disassociate guest state information with the owner browser.
scoped_refptr<CefBrowserInfo> info = owner_browser->browser_info();
info->guest_render_id_manager()->remove_render_view_id(
view_host->GetProcess()->GetID(),
view_host->GetRoutingID());
info->guest_render_id_manager()->remove_render_frame_id(
render_process_id, render_frame_id);
view_host->GetProcess()->GetID(), view_host->GetRoutingID());
info->guest_render_id_manager()->remove_render_frame_id(render_process_id,
render_frame_id);
CefBrowserContext* context =
static_cast<CefBrowserContext*>(web_contents->GetBrowserContext());
@@ -107,8 +102,9 @@ bool CefMimeHandlerViewGuestDelegate::HandleContextMenu(
content::ContextMenuParams new_params = params;
gfx::Point guest_coordinates =
static_cast<content::WebContentsImpl*>(web_contents)->
GetBrowserPluginGuest()->GetScreenCoordinates(gfx::Point());
static_cast<content::WebContentsImpl*>(web_contents)
->GetBrowserPluginGuest()
->GetScreenCoordinates(gfx::Point());
// Adjust (x,y) position for offset from guest to embedder.
new_params.x += guest_coordinates.x();

View File

@@ -32,12 +32,12 @@ const char kPdfResourceIdentifier[] = "chromium-pdf";
const char kPdfPluginName[] = "Chrome PDF Viewer";
std::string GetManifest() {
std::string manifest_contents =
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_PDF_MANIFEST).as_string();
std::string manifest_contents = ResourceBundle::GetSharedInstance()
.GetRawDataResource(IDR_PDF_MANIFEST)
.as_string();
DCHECK(manifest_contents.find(kNameTag) != std::string::npos);
base::ReplaceFirstSubstringAfterOffset(
&manifest_contents, 0, kNameTag, kPdfPluginName);
base::ReplaceFirstSubstringAfterOffset(&manifest_contents, 0, kNameTag,
kPdfPluginName);
return manifest_contents;
}

View File

@@ -6,23 +6,17 @@
namespace extensions {
CefPDFWebContentsHelperClient::CefPDFWebContentsHelperClient() {
}
CefPDFWebContentsHelperClient::CefPDFWebContentsHelperClient() {}
CefPDFWebContentsHelperClient::~CefPDFWebContentsHelperClient() {
}
CefPDFWebContentsHelperClient::~CefPDFWebContentsHelperClient() {}
void CefPDFWebContentsHelperClient::UpdateContentRestrictions(
content::WebContents* contents,
int content_restrictions) {
}
int content_restrictions) {}
void CefPDFWebContentsHelperClient::OnPDFHasUnsupportedFeature(
content::WebContents* contents) {
}
content::WebContents* contents) {}
void CefPDFWebContentsHelperClient::OnSaveURL(
content::WebContents* contents) {
}
void CefPDFWebContentsHelperClient::OnSaveURL(content::WebContents* contents) {}
} // namespace extensions

View File

@@ -10,8 +10,7 @@
namespace extensions {
class CefPDFWebContentsHelperClient
: public pdf::PDFWebContentsHelperClient {
class CefPDFWebContentsHelperClient : public pdf::PDFWebContentsHelperClient {
public:
CefPDFWebContentsHelperClient();
~CefPDFWebContentsHelperClient() override;