Merge pull request #235 from electron/modernize-to-c11

Modernize to C++11
This commit is contained in:
Cheng Zhao 2016-07-11 09:03:09 +09:00 committed by GitHub
commit 6dfd0518cd
11 changed files with 19 additions and 19 deletions

View file

@ -121,7 +121,7 @@ class DispatcherImpl : public DevToolsEmbedderMessageDispatcher {
bool Dispatch(const DispatchCallback& callback,
const std::string& method,
const base::ListValue* params) override {
HandlerMap::iterator it = handlers_.find(method);
auto it = handlers_.find(method);
return it != handlers_.end() && it->second.Run(callback, *params);
}
@ -156,7 +156,7 @@ class DispatcherImpl : public DevToolsEmbedderMessageDispatcher {
DevToolsEmbedderMessageDispatcher*
DevToolsEmbedderMessageDispatcher::CreateForDevToolsFrontend(
Delegate* delegate) {
DispatcherImpl* d = new DispatcherImpl();
auto* d = new DispatcherImpl();
d->RegisterHandler("bringToFront", &Delegate::ActivateWindow, delegate);
d->RegisterHandler("closeWindow", &Delegate::CloseWindow, delegate);

View file

@ -160,7 +160,7 @@ void Index::SetTrigramsForFile(const FilePath& file_path,
const Time& time) {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
FileId file_id = GetFileId(file_path);
vector<Trigram>::const_iterator it = index.begin();
auto it = index.begin();
for (; it != index.end(); ++it) {
Trigram trigram = *it;
index_[trigram].push_back(file_id);

View file

@ -89,7 +89,7 @@ class DevToolsDelegate :
public devtools_http_handler::DevToolsHttpHandlerDelegate {
public:
DevToolsDelegate();
virtual ~DevToolsDelegate();
~DevToolsDelegate() override;
// devtools_http_handler::DevToolsHttpHandlerDelegate.
std::string GetDiscoveryPageHTML() override;

View file

@ -113,7 +113,7 @@ class BundledDataSource : public content::URLDataSource {
}
private:
virtual ~BundledDataSource() {}
~BundledDataSource() override {}
DISALLOW_COPY_AND_ASSIGN(BundledDataSource);
};

View file

@ -167,7 +167,7 @@ int ResponseWriter::Initialize(const net::CompletionCallback& callback) {
int ResponseWriter::Write(net::IOBuffer* buffer,
int num_bytes,
const net::CompletionCallback& callback) {
base::FundamentalValue* id = new base::FundamentalValue(stream_id_);
auto* id = new base::FundamentalValue(stream_id_);
base::StringValue* chunk =
new base::StringValue(std::string(buffer->data(), num_bytes));
@ -683,11 +683,11 @@ void InspectableWebContentsImpl::DidStartNavigationToPendingEntry(
void InspectableWebContentsImpl::OnURLFetchComplete(const net::URLFetcher* source) {
DCHECK(source);
PendingRequestsMap::iterator it = pending_requests_.find(source);
auto it = pending_requests_.find(source);
DCHECK(it != pending_requests_.end());
base::DictionaryValue response;
base::DictionaryValue* headers = new base::DictionaryValue();
auto* headers = new base::DictionaryValue();
net::HttpResponseHeaders* rh = source->GetResponseHeaders();
response.SetInteger("statusCode", rh ? rh->response_code() : 200);
response.Set("headers", headers);

View file

@ -20,13 +20,13 @@ namespace {
const content::MediaStreamDevice* FindDeviceWithId(
const content::MediaStreamDevices& devices,
const std::string& device_id) {
content::MediaStreamDevices::const_iterator iter = devices.begin();
auto iter = devices.begin();
for (; iter != devices.end(); ++iter) {
if (iter->id == device_id) {
return &(*iter);
}
}
return NULL;
return nullptr;
}
const MediaStreamDevices& EmptyDevices() {
@ -100,7 +100,7 @@ MediaCaptureDevicesDispatcher::GetFirstAvailableAudioDevice() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
const content::MediaStreamDevices& audio_devices = GetAudioCaptureDevices();
if (audio_devices.empty())
return NULL;
return nullptr;
return &(*audio_devices.begin());
}
@ -119,7 +119,7 @@ MediaCaptureDevicesDispatcher::GetFirstAvailableVideoDevice() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
const content::MediaStreamDevices& video_devices = GetVideoCaptureDevices();
if (video_devices.empty())
return NULL;
return nullptr;
return &(*video_devices.begin());
}

View file

@ -73,7 +73,7 @@ void MediaStreamDevicesController::Accept() {
if (microphone_requested_ || webcam_requested_) {
switch (request_.request_type) {
case content::MEDIA_OPEN_DEVICE_PEPPER_ONLY: {
const content::MediaStreamDevice* device = NULL;
const content::MediaStreamDevice* device = nullptr;
// For open device request pick the desired device or fall back to the
// first available of the given type.
if (request_.audio_type == content::MEDIA_DEVICE_AUDIO_CAPTURE) {

View file

@ -47,7 +47,7 @@ void DevToolsNetworkController::SetNetworkState(
}
bool has_offline_interceptors = false;
InterceptorMap::iterator it = interceptors_.begin();
auto it = interceptors_.begin();
for (; it != interceptors_.end(); ++it) {
if (it->second->IsOffline()) {
has_offline_interceptors = true;

View file

@ -18,7 +18,7 @@ std::unique_ptr<base::DictionaryValue> GetConstants() {
std::unique_ptr<base::DictionaryValue> constants = net::GetNetConstants();
// Adding client information to constants dictionary.
base::DictionaryValue* client_info = new base::DictionaryValue();
auto* client_info = new base::DictionaryValue();
client_info->SetString(
"command_line",
base::CommandLine::ForCurrentProcess()->GetCommandLineString());

View file

@ -221,12 +221,12 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
auto cookie_config = content::CookieStoreConfig(
base_path_.Append(FILE_PATH_LITERAL("Cookies")),
content::CookieStoreConfig::EPHEMERAL_SESSION_COOKIES,
NULL, NULL);
nullptr, nullptr);
cookie_store = content::CreateCookieStore(cookie_config);
}
storage_->set_cookie_store(std::move(cookie_store));
storage_->set_channel_id_service(base::WrapUnique(
new net::ChannelIDService(new net::DefaultChannelIDStore(NULL),
new net::ChannelIDService(new net::DefaultChannelIDStore(nullptr),
base::WorkerPool::GetTaskRunner(true))));
std::string accept_lang = l10n_util::GetApplicationLocale("");
@ -270,7 +270,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
new net::ProxyScriptFetcherImpl(url_request_context_.get()),
dhcp_factory.Create(url_request_context_.get()),
host_resolver.get(),
NULL,
nullptr,
url_request_context_->network_delegate()));
}

View file

@ -54,7 +54,7 @@ content::WebUIController* WebUIControllerFactory::CreateWebUIControllerForURL(
auto browser_context = web_ui->GetWebContents()->GetBrowserContext();
return new DevToolsUI(browser_context, web_ui);
}
return NULL;
return nullptr;
}
} // namespace brightray