Modernize to C++11: Use auto key to improve code readability and maintainability.

This commit is contained in:
Haojian Wu 2016-07-10 13:09:55 +02:00
parent fab02809c6
commit 04f9d35312
22 changed files with 43 additions and 61 deletions

View file

@ -21,7 +21,7 @@ UvTaskRunner::~UvTaskRunner() {
bool UvTaskRunner::PostDelayedTask(const tracked_objects::Location& from_here, bool UvTaskRunner::PostDelayedTask(const tracked_objects::Location& from_here,
const base::Closure& task, const base::Closure& task,
base::TimeDelta delay) { base::TimeDelta delay) {
uv_timer_t* timer = new uv_timer_t; auto* timer = new uv_timer_t;
timer->data = this; timer->data = this;
uv_timer_init(loop_, timer); uv_timer_init(loop_, timer);
uv_timer_start(timer, UvTaskRunner::OnTimeout, delay.InMilliseconds(), 0); uv_timer_start(timer, UvTaskRunner::OnTimeout, delay.InMilliseconds(), 0);

View file

@ -266,7 +266,7 @@ void DoCacheActionInIO(
// Call GetBackend and make the backend's ptr accessable in OnGetBackend. // Call GetBackend and make the backend's ptr accessable in OnGetBackend.
using BackendPtr = disk_cache::Backend*; using BackendPtr = disk_cache::Backend*;
BackendPtr* backend_ptr = new BackendPtr(nullptr); auto* backend_ptr = new BackendPtr(nullptr);
net::CompletionCallback on_get_backend = net::CompletionCallback on_get_backend =
base::Bind(&OnGetBackend, base::Owned(backend_ptr), action, callback); base::Bind(&OnGetBackend, base::Owned(backend_ptr), action, callback);
int rv = http_cache->GetBackend(backend_ptr, on_get_backend); int rv = http_cache->GetBackend(backend_ptr, on_get_backend);

View file

@ -94,7 +94,7 @@ FileSystem CreateFileSystemStruct(
} }
base::DictionaryValue* CreateFileSystemValue(const FileSystem& file_system) { base::DictionaryValue* CreateFileSystemValue(const FileSystem& file_system) {
base::DictionaryValue* file_system_value = new base::DictionaryValue(); auto* file_system_value = new base::DictionaryValue();
file_system_value->SetString("fileSystemName", file_system.file_system_name); file_system_value->SetString("fileSystemName", file_system.file_system_name);
file_system_value->SetString("rootURL", file_system.root_url); file_system_value->SetString("rootURL", file_system.root_url);
file_system_value->SetString("fileSystemPath", file_system.file_system_path); file_system_value->SetString("fileSystemPath", file_system.file_system_path);
@ -377,7 +377,7 @@ content::SecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
void CommonWebContentsDelegate::DevToolsSaveToFile( void CommonWebContentsDelegate::DevToolsSaveToFile(
const std::string& url, const std::string& content, bool save_as) { const std::string& url, const std::string& content, bool save_as) {
base::FilePath path; base::FilePath path;
PathsMap::iterator it = saved_files_.find(url); auto it = saved_files_.find(url);
if (it != saved_files_.end() && !save_as) { if (it != saved_files_.end() && !save_as) {
path = it->second; path = it->second;
} else { } else {
@ -402,7 +402,7 @@ void CommonWebContentsDelegate::DevToolsSaveToFile(
void CommonWebContentsDelegate::DevToolsAppendToFile( void CommonWebContentsDelegate::DevToolsAppendToFile(
const std::string& url, const std::string& content) { const std::string& url, const std::string& content) {
PathsMap::iterator it = saved_files_.find(url); auto it = saved_files_.find(url);
if (it == saved_files_.end()) if (it == saved_files_.end())
return; return;
@ -610,8 +610,7 @@ void CommonWebContentsDelegate::OnDevToolsSearchCompleted(
const std::string& file_system_path, const std::string& file_system_path,
const std::vector<std::string>& file_paths) { const std::vector<std::string>& file_paths) {
base::ListValue file_paths_value; base::ListValue file_paths_value;
for (std::vector<std::string>::const_iterator it(file_paths.begin()); for (auto it(file_paths.begin()); it != file_paths.end(); ++it) {
it != file_paths.end(); ++it) {
file_paths_value.AppendString(*it); file_paths_value.AppendString(*it);
} }
base::FundamentalValue request_id_value(request_id); base::FundamentalValue request_id_value(request_id);

View file

@ -22,7 +22,7 @@ net::URLRequestJob* AsarProtocolHandler::MaybeCreateJob(
net::NetworkDelegate* network_delegate) const { net::NetworkDelegate* network_delegate) const {
base::FilePath full_path; base::FilePath full_path;
net::FileURLToFilePath(request->url(), &full_path); net::FileURLToFilePath(request->url(), &full_path);
URLRequestAsarJob* job = new URLRequestAsarJob(request, network_delegate); auto* job = new URLRequestAsarJob(request, network_delegate);
job->Initialize(file_task_runner_, full_path); job->Initialize(file_task_runner_, full_path);
return job; return job;
} }

View file

@ -111,7 +111,7 @@ void URLRequestAsarJob::Start() {
if (rv != net::ERR_IO_PENDING) if (rv != net::ERR_IO_PENDING)
DidOpen(rv); DidOpen(rv);
} else if (type_ == TYPE_FILE) { } else if (type_ == TYPE_FILE) {
FileMetaInfo* meta_info = new FileMetaInfo(); auto* meta_info = new FileMetaInfo();
file_task_runner_->PostTaskAndReply( file_task_runner_->PostTaskAndReply(
FROM_HERE, FROM_HERE,
base::Bind(&URLRequestAsarJob::FetchMetaInfo, file_path_, base::Bind(&URLRequestAsarJob::FetchMetaInfo, file_path_,
@ -224,7 +224,7 @@ int URLRequestAsarJob::GetResponseCode() const {
void URLRequestAsarJob::GetResponseInfo(net::HttpResponseInfo* info) { void URLRequestAsarJob::GetResponseInfo(net::HttpResponseInfo* info) {
std::string status("HTTP/1.1 200 OK"); std::string status("HTTP/1.1 200 OK");
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); auto* headers = new net::HttpResponseHeaders(status);
headers->AddHeader(atom::kCORSHeader); headers->AddHeader(atom::kCORSHeader);
info->headers = headers; info->headers = headers;

View file

@ -27,7 +27,7 @@ bool AtomURLRequestJobFactory::SetProtocolHandler(
const std::string& scheme, const std::string& scheme,
std::unique_ptr<ProtocolHandler> protocol_handler) { std::unique_ptr<ProtocolHandler> protocol_handler) {
if (!protocol_handler) { if (!protocol_handler) {
ProtocolHandlerMap::iterator it = protocol_handler_map_.find(scheme); auto it = protocol_handler_map_.find(scheme);
if (it == protocol_handler_map_.end()) if (it == protocol_handler_map_.end())
return false; return false;
@ -66,7 +66,7 @@ ProtocolHandler* AtomURLRequestJobFactory::GetProtocolHandler(
const std::string& scheme) const { const std::string& scheme) const {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); auto it = protocol_handler_map_.find(scheme);
if (it == protocol_handler_map_.end()) if (it == protocol_handler_map_.end())
return nullptr; return nullptr;
return it->second; return it->second;
@ -87,7 +87,7 @@ net::URLRequestJob* AtomURLRequestJobFactory::MaybeCreateJobWithProtocolHandler(
net::NetworkDelegate* network_delegate) const { net::NetworkDelegate* network_delegate) const {
DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK_CURRENTLY_ON(BrowserThread::IO);
ProtocolHandlerMap::const_iterator it = protocol_handler_map_.find(scheme); auto it = protocol_handler_map_.find(scheme);
if (it == protocol_handler_map_.end()) if (it == protocol_handler_map_.end())
return nullptr; return nullptr;
return it->second->MaybeCreateJob(request, network_delegate); return it->second->MaybeCreateJob(request, network_delegate);

View file

@ -40,7 +40,7 @@ void URLRequestAsyncAsarJob::StartAsync(std::unique_ptr<base::Value> options) {
void URLRequestAsyncAsarJob::GetResponseInfo(net::HttpResponseInfo* info) { void URLRequestAsyncAsarJob::GetResponseInfo(net::HttpResponseInfo* info) {
std::string status("HTTP/1.1 200 OK"); std::string status("HTTP/1.1 200 OK");
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); auto* headers = new net::HttpResponseHeaders(status);
headers->AddHeader(kCORSHeader); headers->AddHeader(kCORSHeader);
info->headers = headers; info->headers = headers;

View file

@ -72,7 +72,7 @@ void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
status.append(" "); status.append(" ");
status.append(net::GetHttpReasonPhrase(status_code_)); status.append(net::GetHttpReasonPhrase(status_code_));
status.append("\0\0", 2); status.append("\0\0", 2);
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); auto* headers = new net::HttpResponseHeaders(status);
headers->AddHeader(kCORSHeader); headers->AddHeader(kCORSHeader);

View file

@ -31,7 +31,7 @@ void URLRequestStringJob::StartAsync(std::unique_ptr<base::Value> options) {
void URLRequestStringJob::GetResponseInfo(net::HttpResponseInfo* info) { void URLRequestStringJob::GetResponseInfo(net::HttpResponseInfo* info) {
std::string status("HTTP/1.1 200 OK"); std::string status("HTTP/1.1 200 OK");
net::HttpResponseHeaders* headers = new net::HttpResponseHeaders(status); auto* headers = new net::HttpResponseHeaders(status);
headers->AddHeader(kCORSHeader); headers->AddHeader(kCORSHeader);

View file

@ -123,7 +123,7 @@ v8::Local<v8::Value> CreateFunctionFromTranslater(
v8::Local<v8::FunctionTemplate> call_translater = v8::Local<v8::FunctionTemplate> call_translater =
v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translater); v8::Local<v8::FunctionTemplate>::New(isolate, g_call_translater);
TranslaterHolder* holder = new TranslaterHolder; auto* holder = new TranslaterHolder;
holder->translater = translater; holder->translater = translater;
return BindFunctionWith(isolate, return BindFunctionWith(isolate,
isolate->GetCurrentContext(), isolate->GetCurrentContext(),

View file

@ -55,7 +55,7 @@ class V8ValueConverter::FromV8ValueState {
// hash. Different hash obviously means different objects, but two objects // hash. Different hash obviously means different objects, but two objects
// in a couple of thousands could have the same identity hash. // in a couple of thousands could have the same identity hash.
std::pair<Iterator, Iterator> range = unique_map_.equal_range(hash); std::pair<Iterator, Iterator> range = unique_map_.equal_range(hash);
for (Iterator it = range.first; it != range.second; ++it) { for (auto it = range.first; it != range.second; ++it) {
// Operator == for handles actually compares the underlying objects. // Operator == for handles actually compares the underlying objects.
if (it->second == handle) if (it->second == handle)
return false; return false;
@ -295,7 +295,7 @@ base::Value* V8ValueConverter::FromV8Array(
val->CreationContext() != isolate->GetCurrentContext()) val->CreationContext() != isolate->GetCurrentContext())
scope.reset(new v8::Context::Scope(val->CreationContext())); scope.reset(new v8::Context::Scope(val->CreationContext()));
base::ListValue* result = new base::ListValue(); auto* result = new base::ListValue();
// Only fields with integer keys are carried over to the ListValue. // Only fields with integer keys are carried over to the ListValue.
for (uint32_t i = 0; i < val->Length(); ++i) { for (uint32_t i = 0; i < val->Length(); ++i) {

View file

@ -58,8 +58,7 @@ bool AtomContentUtilityClient::OnMessageReceived(
IPC_MESSAGE_UNHANDLED(handled = false) IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP() IPC_END_MESSAGE_MAP()
for (Handlers::iterator it = handlers_.begin(); for (auto it = handlers_.begin(); !handled && it != handlers_.end(); ++it) {
!handled && it != handlers_.end(); ++it) {
handled = (*it)->OnMessageReceived(message); handled = (*it)->OnMessageReceived(message);
} }

View file

@ -53,7 +53,7 @@ void GlobalShortcutListener::UnregisterAccelerator(
if (IsShortcutHandlingSuspended()) if (IsShortcutHandlingSuspended())
return; return;
AcceleratorMap::iterator it = accelerator_map_.find(accelerator); auto it = accelerator_map_.find(accelerator);
// We should never get asked to unregister something that we didn't register. // We should never get asked to unregister something that we didn't register.
DCHECK(it != accelerator_map_.end()); DCHECK(it != accelerator_map_.end());
// The caller should call this function with the right observer. // The caller should call this function with the right observer.
@ -70,10 +70,10 @@ void GlobalShortcutListener::UnregisterAccelerators(Observer* observer) {
if (IsShortcutHandlingSuspended()) if (IsShortcutHandlingSuspended())
return; return;
AcceleratorMap::iterator it = accelerator_map_.begin(); auto it = accelerator_map_.begin();
while (it != accelerator_map_.end()) { while (it != accelerator_map_.end()) {
if (it->second == observer) { if (it->second == observer) {
AcceleratorMap::iterator to_remove = it++; auto to_remove = it++;
UnregisterAccelerator(to_remove->first, observer); UnregisterAccelerator(to_remove->first, observer);
} else { } else {
++it; ++it;
@ -87,9 +87,7 @@ void GlobalShortcutListener::SetShortcutHandlingSuspended(bool suspended) {
return; return;
shortcut_handling_suspended_ = suspended; shortcut_handling_suspended_ = suspended;
for (AcceleratorMap::iterator it = accelerator_map_.begin(); for (auto it = accelerator_map_.begin(); it != accelerator_map_.end(); ++it) {
it != accelerator_map_.end();
++it) {
// On Linux, when shortcut handling is suspended we cannot simply early // On Linux, when shortcut handling is suspended we cannot simply early
// return in NotifyKeyPressed (similar to what we do for non-global // return in NotifyKeyPressed (similar to what we do for non-global
// shortcuts) because we'd eat the keyboard event thereby preventing the // shortcuts) because we'd eat the keyboard event thereby preventing the
@ -108,7 +106,7 @@ bool GlobalShortcutListener::IsShortcutHandlingSuspended() const {
void GlobalShortcutListener::NotifyKeyPressed( void GlobalShortcutListener::NotifyKeyPressed(
const ui::Accelerator& accelerator) { const ui::Accelerator& accelerator) {
AcceleratorMap::iterator iter = accelerator_map_.find(accelerator); auto iter = accelerator_map_.find(accelerator);
if (iter == accelerator_map_.end()) { if (iter == accelerator_map_.end()) {
// This should never occur, because if it does, we have failed to unregister // This should never occur, because if it does, we have failed to unregister
// or failed to clean up the map after unregistering the shortcut. // or failed to clean up the map after unregistering the shortcut.

View file

@ -152,8 +152,7 @@ void NativeDesktopMediaList::Worker::Refresh(
if (window_capturer_) { if (window_capturer_) {
webrtc::WindowCapturer::WindowList windows; webrtc::WindowCapturer::WindowList windows;
if (window_capturer_->GetWindowList(&windows)) { if (window_capturer_->GetWindowList(&windows)) {
for (webrtc::WindowCapturer::WindowList::iterator it = windows.begin(); for (auto it = windows.begin(); it != windows.end(); ++it) {
it != windows.end(); ++it) {
// Skip the picker dialog window. // Skip the picker dialog window.
if (it->id != view_dialog_id) { if (it->id != view_dialog_id) {
sources.push_back(SourceDescription( sources.push_back(SourceDescription(
@ -199,7 +198,7 @@ void NativeDesktopMediaList::Worker::Refresh(
new_image_hashes[source.id] = frame_hash; new_image_hashes[source.id] = frame_hash;
// Scale the image only if it has changed. // Scale the image only if it has changed.
ImageHashesMap::iterator it = image_hashes_.find(source.id); auto it = image_hashes_.find(source.id);
if (it == image_hashes_.end() || it->second != frame_hash) { if (it == image_hashes_.end() || it->second != frame_hash) {
gfx::ImageSkia thumbnail = gfx::ImageSkia thumbnail =
ScaleDesktopFrame(std::move(current_frame_), thumbnail_size); ScaleDesktopFrame(std::move(current_frame_), thumbnail_size);

View file

@ -71,10 +71,8 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job,
worker_.reset(job->DetachWorker(this)); worker_.reset(job->DetachWorker(this));
settings_ = job->settings(); settings_ = job->settings();
PrintedDocument* new_doc = auto* new_doc =
new PrintedDocument(settings_, new PrintedDocument(settings_, source_, job->cookie(),
source_,
job->cookie(),
content::BrowserThread::GetBlockingPool()); content::BrowserThread::GetBlockingPool());
new_doc->set_page_count(page_count); new_doc->set_page_count(page_count);
UpdatePrintedDocument(new_doc); UpdatePrintedDocument(new_doc);

View file

@ -32,8 +32,8 @@ void PrintQueriesQueue::QueuePrinterQuery(PrinterQuery* job) {
scoped_refptr<PrinterQuery> PrintQueriesQueue::PopPrinterQuery( scoped_refptr<PrinterQuery> PrintQueriesQueue::PopPrinterQuery(
int document_cookie) { int document_cookie) {
base::AutoLock lock(lock_); base::AutoLock lock(lock_);
for (PrinterQueries::iterator itr = queued_queries_.begin(); for (auto itr = queued_queries_.begin(); itr != queued_queries_.end();
itr != queued_queries_.end(); ++itr) { ++itr) {
if ((*itr)->cookie() == document_cookie && !(*itr)->is_callback_pending()) { if ((*itr)->cookie() == document_cookie && !(*itr)->is_callback_pending()) {
scoped_refptr<printing::PrinterQuery> current_query(*itr); scoped_refptr<printing::PrinterQuery> current_query(*itr);
queued_queries_.erase(itr); queued_queries_.erase(itr);
@ -61,8 +61,8 @@ void PrintQueriesQueue::Shutdown() {
// Stop all pending queries, requests to generate print preview do not have // Stop all pending queries, requests to generate print preview do not have
// corresponding PrintJob, so any pending preview requests are not covered // corresponding PrintJob, so any pending preview requests are not covered
// by PrintJobManager::StopJobs and should be stopped explicitly. // by PrintJobManager::StopJobs and should be stopped explicitly.
for (PrinterQueries::iterator itr = queries_to_stop.begin(); for (auto itr = queries_to_stop.begin(); itr != queries_to_stop.end();
itr != queries_to_stop.end(); ++itr) { ++itr) {
(*itr)->PostTask(FROM_HERE, base::Bind(&PrinterQuery::StopWorker, *itr)); (*itr)->PostTask(FROM_HERE, base::Bind(&PrinterQuery::StopWorker, *itr));
} }
} }
@ -99,8 +99,7 @@ void PrintJobManager::StopJobs(bool wait_for_finish) {
PrintJobs to_stop; PrintJobs to_stop;
to_stop.swap(current_jobs_); to_stop.swap(current_jobs_);
for (PrintJobs::const_iterator job = to_stop.begin(); job != to_stop.end(); for (auto job = to_stop.begin(); job != to_stop.end(); ++job) {
++job) {
// Wait for two minutes for the print job to be spooled. // Wait for two minutes for the print job to be spooled.
if (wait_for_finish) if (wait_for_finish)
(*job)->FlushJob(base::TimeDelta::FromMinutes(2)); (*job)->FlushJob(base::TimeDelta::FromMinutes(2));

View file

@ -75,7 +75,7 @@ void NotificationCallback(PrintJobWorkerOwner* print_job,
JobEventDetails::Type detail_type, JobEventDetails::Type detail_type,
PrintedDocument* document, PrintedDocument* document,
PrintedPage* page) { PrintedPage* page) {
JobEventDetails* details = new JobEventDetails(detail_type, document, page); auto* details = new JobEventDetails(detail_type, document, page);
content::NotificationService::current()->Notify( content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PRINT_JOB_EVENT, chrome::NOTIFICATION_PRINT_JOB_EVENT,
// We know that is is a PrintJob object in this circumstance. // We know that is is a PrintJob object in this circumstance.

View file

@ -48,7 +48,7 @@ char* CopyPDFDataOnIOThread(
if (!shared_buf->Map(params.data_size)) if (!shared_buf->Map(params.data_size))
return nullptr; return nullptr;
char* memory_pdf_data = static_cast<char*>(shared_buf->memory()); char* memory_pdf_data = static_cast<char*>(shared_buf->memory());
char* pdf_data = new char[params.data_size]; auto* pdf_data = new char[params.data_size];
memcpy(pdf_data, memory_pdf_data, params.data_size); memcpy(pdf_data, memory_pdf_data, params.data_size);
return pdf_data; return pdf_data;
} }

View file

@ -579,9 +579,7 @@ void ProcessSingleton::LinuxWatcher::OnFileCanReadWithoutBlocking(int fd) {
} }
int rv = base::SetNonBlocking(connection_socket); int rv = base::SetNonBlocking(connection_socket);
DCHECK_EQ(0, rv) << "Failed to make non-blocking socket."; DCHECK_EQ(0, rv) << "Failed to make non-blocking socket.";
SocketReader* reader = new SocketReader(this, auto* reader = new SocketReader(this, ui_message_loop_, connection_socket);
ui_message_loop_,
connection_socket);
readers_.insert(reader); readers_.insert(reader);
} }
@ -822,8 +820,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcessWithTimeout(
to_send.append(current_dir.value()); to_send.append(current_dir.value());
const std::vector<std::string>& argv = atom::AtomCommandLine::argv(); const std::vector<std::string>& argv = atom::AtomCommandLine::argv();
for (std::vector<std::string>::const_iterator it = argv.begin(); for (auto it = argv.begin(); it != argv.end(); ++it) {
it != argv.end(); ++it) {
to_send.push_back(kTokenDelimiter); to_send.push_back(kTokenDelimiter);
to_send.append(*it); to_send.append(*it);
} }

View file

@ -86,9 +86,7 @@ std::string ReadDataFromPickle(const base::string16& format,
bool WriteDataToPickle(const std::map<base::string16, std::string>& data, bool WriteDataToPickle(const std::map<base::string16, std::string>& data,
base::Pickle* pickle) { base::Pickle* pickle) {
pickle->WriteUInt32(data.size()); pickle->WriteUInt32(data.size());
for (std::map<base::string16, std::string>::const_iterator it = data.begin(); for (auto it = data.begin(); it != data.end(); ++it) {
it != data.end();
++it) {
if (!pickle->WriteString16(it->first)) if (!pickle->WriteString16(it->first))
return false; return false;
if (!pickle->WriteString(it->second)) if (!pickle->WriteString(it->second))

View file

@ -415,10 +415,8 @@ int TtsControllerImpl::GetMatchingVoice(
if (utterance->required_event_types().size() > 0) { if (utterance->required_event_types().size() > 0) {
bool has_all_required_event_types = true; bool has_all_required_event_types = true;
for (std::set<TtsEventType>::const_iterator iter = for (auto iter = utterance->required_event_types().begin();
utterance->required_event_types().begin(); iter != utterance->required_event_types().end(); ++iter) {
iter != utterance->required_event_types().end();
++iter) {
if (voice.events.find(*iter) == voice.events.end()) { if (voice.events.find(*iter) == voice.events.end()) {
has_all_required_event_types = false; has_all_required_event_types = false;
break; break;
@ -436,8 +434,7 @@ int TtsControllerImpl::GetMatchingVoice(
} }
void TtsControllerImpl::VoicesChanged() { void TtsControllerImpl::VoicesChanged() {
for (std::set<VoicesChangedDelegate*>::iterator iter = for (auto iter = voices_changed_delegates_.begin();
voices_changed_delegates_.begin();
iter != voices_changed_delegates_.end(); ++iter) { iter != voices_changed_delegates_.end(); ++iter) {
(*iter)->OnVoicesChanged(); (*iter)->OnVoicesChanged();
} }

View file

@ -543,8 +543,7 @@ bool URLPattern::Contains(const URLPattern& other) const {
bool URLPattern::MatchesAnyScheme( bool URLPattern::MatchesAnyScheme(
const std::vector<std::string>& schemes) const { const std::vector<std::string>& schemes) const {
for (std::vector<std::string>::const_iterator i = schemes.begin(); for (auto i = schemes.begin(); i != schemes.end(); ++i) {
i != schemes.end(); ++i) {
if (MatchesScheme(*i)) if (MatchesScheme(*i))
return true; return true;
} }
@ -554,8 +553,7 @@ bool URLPattern::MatchesAnyScheme(
bool URLPattern::MatchesAllSchemes( bool URLPattern::MatchesAllSchemes(
const std::vector<std::string>& schemes) const { const std::vector<std::string>& schemes) const {
for (std::vector<std::string>::const_iterator i = schemes.begin(); for (auto i = schemes.begin(); i != schemes.end(); ++i) {
i != schemes.end(); ++i) {
if (!MatchesScheme(*i)) if (!MatchesScheme(*i))
return false; return false;
} }