Don't change chromium_src files.

This commit is contained in:
Haojian Wu 2016-07-10 15:35:54 +02:00
parent 55b3f1936f
commit 2717b96310
22 changed files with 131 additions and 110 deletions

View file

@ -7,7 +7,7 @@
#include "chrome/browser/printing/print_job_manager.h" #include "chrome/browser/printing/print_job_manager.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
BrowserProcess* g_browser_process = nullptr; BrowserProcess* g_browser_process = NULL;
BrowserProcess::BrowserProcess() { BrowserProcess::BrowserProcess() {
g_browser_process = this; g_browser_process = this;
@ -16,7 +16,7 @@ BrowserProcess::BrowserProcess() {
} }
BrowserProcess::~BrowserProcess() { BrowserProcess::~BrowserProcess() {
g_browser_process = nullptr; g_browser_process = NULL;
} }
std::string BrowserProcess::GetApplicationLocale() { std::string BrowserProcess::GetApplicationLocale() {

View file

@ -53,7 +53,7 @@ void GlobalShortcutListener::UnregisterAccelerator(
if (IsShortcutHandlingSuspended()) if (IsShortcutHandlingSuspended())
return; return;
auto it = accelerator_map_.find(accelerator); AcceleratorMap::iterator 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;
auto it = accelerator_map_.begin(); AcceleratorMap::iterator it = accelerator_map_.begin();
while (it != accelerator_map_.end()) { while (it != accelerator_map_.end()) {
if (it->second == observer) { if (it->second == observer) {
auto to_remove = it++; AcceleratorMap::iterator to_remove = it++;
UnregisterAccelerator(to_remove->first, observer); UnregisterAccelerator(to_remove->first, observer);
} else { } else {
++it; ++it;
@ -87,16 +87,18 @@ void GlobalShortcutListener::SetShortcutHandlingSuspended(bool suspended) {
return; return;
shortcut_handling_suspended_ = suspended; shortcut_handling_suspended_ = suspended;
for (auto& it : accelerator_map_) { for (AcceleratorMap::iterator it = accelerator_map_.begin();
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
// user from setting the shortcut. Therefore we must unregister while // user from setting the shortcut. Therefore we must unregister while
// handling is suspended and register when handling resumes. // handling is suspended and register when handling resumes.
if (shortcut_handling_suspended_) if (shortcut_handling_suspended_)
UnregisterAcceleratorImpl(it.first); UnregisterAcceleratorImpl(it->first);
else else
RegisterAcceleratorImpl(it.first); RegisterAcceleratorImpl(it->first);
} }
} }
@ -106,7 +108,7 @@ bool GlobalShortcutListener::IsShortcutHandlingSuspended() const {
void GlobalShortcutListener::NotifyKeyPressed( void GlobalShortcutListener::NotifyKeyPressed(
const ui::Accelerator& accelerator) { const ui::Accelerator& accelerator) {
auto iter = accelerator_map_.find(accelerator); AcceleratorMap::iterator 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,12 +152,13 @@ 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 (auto& window : windows) { for (webrtc::WindowCapturer::WindowList::iterator it = windows.begin();
it != windows.end(); ++it) {
// Skip the picker dialog window. // Skip the picker dialog window.
if (window.id != view_dialog_id) { if (it->id != view_dialog_id) {
sources.push_back(SourceDescription( sources.push_back(SourceDescription(
DesktopMediaID(DesktopMediaID::TYPE_WINDOW, window.id), DesktopMediaID(DesktopMediaID::TYPE_WINDOW, it->id),
base::UTF8ToUTF16(window.title))); base::UTF8ToUTF16(it->title)));
} }
} }
} }
@ -198,7 +199,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.
auto it = image_hashes_.find(source.id); ImageHashesMap::iterator 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);
@ -219,7 +220,7 @@ void NativeDesktopMediaList::Worker::Refresh(
webrtc::SharedMemory* NativeDesktopMediaList::Worker::CreateSharedMemory( webrtc::SharedMemory* NativeDesktopMediaList::Worker::CreateSharedMemory(
size_t size) { size_t size) {
return nullptr; return NULL;
} }
void NativeDesktopMediaList::Worker::OnCaptureCompleted( void NativeDesktopMediaList::Worker::OnCaptureCompleted(
@ -235,7 +236,7 @@ NativeDesktopMediaList::NativeDesktopMediaList(
update_period_(base::TimeDelta::FromMilliseconds(kDefaultUpdatePeriod)), update_period_(base::TimeDelta::FromMilliseconds(kDefaultUpdatePeriod)),
thumbnail_size_(100, 100), thumbnail_size_(100, 100),
view_dialog_id_(-1), view_dialog_id_(-1),
observer_(nullptr), observer_(NULL),
weak_factory_(this) { weak_factory_(this) {
base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool(); base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool();
capture_task_runner_ = worker_pool->GetSequencedTaskRunner( capture_task_runner_ = worker_pool->GetSequencedTaskRunner(
@ -296,8 +297,8 @@ void NativeDesktopMediaList::OnSourcesList(
const std::vector<SourceDescription>& new_sources) { const std::vector<SourceDescription>& new_sources) {
typedef std::set<content::DesktopMediaID> SourceSet; typedef std::set<content::DesktopMediaID> SourceSet;
SourceSet new_source_set; SourceSet new_source_set;
for (const auto& new_source : new_sources) { for (size_t i = 0; i < new_sources.size(); ++i) {
new_source_set.insert(new_source.id); new_source_set.insert(new_sources[i].id);
} }
// Iterate through the old sources to find the removed sources. // Iterate through the old sources to find the removed sources.
for (size_t i = 0; i < sources_.size(); ++i) { for (size_t i = 0; i < sources_.size(); ++i) {
@ -310,8 +311,8 @@ void NativeDesktopMediaList::OnSourcesList(
// Iterate through the new sources to find the added sources. // Iterate through the new sources to find the added sources.
if (new_sources.size() > sources_.size()) { if (new_sources.size() > sources_.size()) {
SourceSet old_source_set; SourceSet old_source_set;
for (auto& source : sources_) { for (size_t i = 0; i < sources_.size(); ++i) {
old_source_set.insert(source.id); old_source_set.insert(sources_[i].id);
} }
for (size_t i = 0; i < new_sources.size(); ++i) { for (size_t i = 0; i < new_sources.size(); ++i) {

View file

@ -38,7 +38,7 @@ void HoldRefCallback(const scoped_refptr<printing::PrintJobWorkerOwner>& owner,
namespace printing { namespace printing {
PrintJob::PrintJob() PrintJob::PrintJob()
: source_(nullptr), : source_(NULL),
worker_(), worker_(),
settings_(), settings_(),
is_job_pending_(false), is_job_pending_(false),
@ -71,8 +71,10 @@ void PrintJob::Initialize(PrintJobWorkerOwner* job,
worker_.reset(job->DetachWorker(this)); worker_.reset(job->DetachWorker(this));
settings_ = job->settings(); settings_ = job->settings();
auto* new_doc = PrintedDocument* new_doc =
new PrintedDocument(settings_, source_, job->cookie(), new PrintedDocument(settings_,
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);
@ -104,7 +106,7 @@ void PrintJob::GetSettingsDone(const PrintSettings& new_settings,
PrintJobWorker* PrintJob::DetachWorker(PrintJobWorkerOwner* new_owner) { PrintJobWorker* PrintJob::DetachWorker(PrintJobWorkerOwner* new_owner) {
NOTREACHED(); NOTREACHED();
return nullptr; return NULL;
} }
const PrintSettings& PrintJob::settings() const { const PrintSettings& PrintJob::settings() const {
@ -137,7 +139,7 @@ void PrintJob::StartPrinting() {
// Tell everyone! // Tell everyone!
scoped_refptr<JobEventDetails> details( scoped_refptr<JobEventDetails> details(
new JobEventDetails(JobEventDetails::NEW_DOC, document_.get(), nullptr)); new JobEventDetails(JobEventDetails::NEW_DOC, document_.get(), NULL));
content::NotificationService::current()->Notify( content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PRINT_JOB_EVENT, chrome::NOTIFICATION_PRINT_JOB_EVENT,
content::Source<PrintJob>(this), content::Source<PrintJob>(this),
@ -161,7 +163,7 @@ void PrintJob::Stop() {
ControlledWorkerShutdown(); ControlledWorkerShutdown();
} else { } else {
// Flush the cached document. // Flush the cached document.
UpdatePrintedDocument(nullptr); UpdatePrintedDocument(NULL);
} }
} }
@ -181,7 +183,7 @@ void PrintJob::Cancel() {
} }
// Make sure a Cancel() is broadcast. // Make sure a Cancel() is broadcast.
scoped_refptr<JobEventDetails> details( scoped_refptr<JobEventDetails> details(
new JobEventDetails(JobEventDetails::FAILED, nullptr, nullptr)); new JobEventDetails(JobEventDetails::FAILED, NULL, NULL));
content::NotificationService::current()->Notify( content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PRINT_JOB_EVENT, chrome::NOTIFICATION_PRINT_JOB_EVENT,
content::Source<PrintJob>(this), content::Source<PrintJob>(this),
@ -205,7 +207,7 @@ bool PrintJob::FlushJob(base::TimeDelta timeout) {
} }
void PrintJob::DisconnectSource() { void PrintJob::DisconnectSource() {
source_ = nullptr; source_ = NULL;
if (document_.get()) if (document_.get())
document_->DisconnectSource(); document_->DisconnectSource();
} }
@ -386,7 +388,7 @@ void PrintJob::OnDocumentDone() {
Stop(); Stop();
scoped_refptr<JobEventDetails> details( scoped_refptr<JobEventDetails> details(
new JobEventDetails(JobEventDetails::JOB_DONE, document_.get(), nullptr)); new JobEventDetails(JobEventDetails::JOB_DONE, document_.get(), NULL));
content::NotificationService::current()->Notify( content::NotificationService::current()->Notify(
chrome::NOTIFICATION_PRINT_JOB_EVENT, chrome::NOTIFICATION_PRINT_JOB_EVENT,
content::Source<PrintJob>(this), content::Source<PrintJob>(this),
@ -432,7 +434,7 @@ void PrintJob::ControlledWorkerShutdown() {
is_job_pending_ = false; is_job_pending_ = false;
registrar_.RemoveAll(); registrar_.RemoveAll();
UpdatePrintedDocument(nullptr); UpdatePrintedDocument(NULL);
} }
void PrintJob::HoldUntilStopIsCalled() { void PrintJob::HoldUntilStopIsCalled() {

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 (auto itr = queued_queries_.begin(); itr != queued_queries_.end(); for (PrinterQueries::iterator itr = queued_queries_.begin();
++itr) { itr != queued_queries_.end(); ++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);
@ -41,7 +41,7 @@ scoped_refptr<PrinterQuery> PrintQueriesQueue::PopPrinterQuery(
return current_query; return current_query;
} }
} }
return nullptr; return NULL;
} }
scoped_refptr<PrinterQuery> PrintQueriesQueue::CreatePrinterQuery( scoped_refptr<PrinterQuery> PrintQueriesQueue::CreatePrinterQuery(
@ -61,8 +61,9 @@ 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 (auto& itr : queries_to_stop) { for (PrinterQueries::iterator itr = queries_to_stop.begin();
itr->PostTask(FROM_HERE, base::Bind(&PrinterQuery::StopWorker, itr)); itr != queries_to_stop.end(); ++itr) {
(*itr)->PostTask(FROM_HERE, base::Bind(&PrinterQuery::StopWorker, *itr));
} }
} }
@ -89,7 +90,7 @@ void PrintJobManager::Shutdown() {
StopJobs(true); StopJobs(true);
if (queue_.get()) if (queue_.get())
queue_->Shutdown(); queue_->Shutdown();
queue_ = nullptr; queue_ = NULL;
} }
void PrintJobManager::StopJobs(bool wait_for_finish) { void PrintJobManager::StopJobs(bool wait_for_finish) {
@ -98,11 +99,12 @@ void PrintJobManager::StopJobs(bool wait_for_finish) {
PrintJobs to_stop; PrintJobs to_stop;
to_stop.swap(current_jobs_); to_stop.swap(current_jobs_);
for (const auto& job : to_stop) { for (PrintJobs::const_iterator job = to_stop.begin(); job != to_stop.end();
++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));
job->Stop(); (*job)->Stop();
} }
} }

View file

@ -38,10 +38,10 @@ void HoldRefCallback(const scoped_refptr<printing::PrintJobWorkerOwner>& owner,
class PrintingContextDelegate : public PrintingContext::Delegate { class PrintingContextDelegate : public PrintingContext::Delegate {
public: public:
PrintingContextDelegate(int render_process_id, int render_view_id); PrintingContextDelegate(int render_process_id, int render_view_id);
~PrintingContextDelegate() override; virtual ~PrintingContextDelegate();
gfx::NativeView GetParentView() override; virtual gfx::NativeView GetParentView() override;
std::string GetAppLocale() override; virtual std::string GetAppLocale() override;
private: private:
int render_process_id_; int render_process_id_;
@ -62,9 +62,9 @@ gfx::NativeView PrintingContextDelegate::GetParentView() {
content::RenderViewHost* view = content::RenderViewHost* view =
content::RenderViewHost::FromID(render_process_id_, render_view_id_); content::RenderViewHost::FromID(render_process_id_, render_view_id_);
if (!view) if (!view)
return nullptr; return NULL;
content::WebContents* wc = content::WebContents::FromRenderViewHost(view); content::WebContents* wc = content::WebContents::FromRenderViewHost(view);
return wc ? wc->GetNativeView() : nullptr; return wc ? wc->GetNativeView() : NULL;
} }
std::string PrintingContextDelegate::GetAppLocale() { std::string PrintingContextDelegate::GetAppLocale() {
@ -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) {
auto* details = new JobEventDetails(detail_type, document, page); JobEventDetails* 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.
@ -343,7 +343,7 @@ void PrintJobWorker::OnDocumentDone() {
base::RetainedRef(document_), nullptr)); base::RetainedRef(document_), nullptr));
// Makes sure the variables are reinitialized. // Makes sure the variables are reinitialized.
document_ = nullptr; document_ = NULL;
} }
void PrintJobWorker::SpoolPage(PrintedPage* page) { void PrintJobWorker::SpoolPage(PrintedPage* page) {
@ -397,7 +397,7 @@ void PrintJobWorker::OnFailure() {
Cancel(); Cancel();
// Makes sure the variables are reinitialized. // Makes sure the variables are reinitialized.
document_ = nullptr; document_ = NULL;
page_number_ = PageNumber::npos(); page_number_ = PageNumber::npos();
} }

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());
auto* pdf_data = new char[params.data_size]; char* 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

@ -394,7 +394,7 @@ void PrintViewManagerBase::ReleasePrintJob() {
content::Source<PrintJob>(print_job_.get())); content::Source<PrintJob>(print_job_.get()));
print_job_->DisconnectSource(); print_job_->DisconnectSource();
// Don't close the worker thread. // Don't close the worker thread.
print_job_ = nullptr; print_job_ = NULL;
} }
bool PrintViewManagerBase::RunInnerMessageLoop() { bool PrintViewManagerBase::RunInnerMessageLoop() {

View file

@ -122,7 +122,7 @@ bool PrinterQuery::is_callback_pending() const {
} }
bool PrinterQuery::is_valid() const { bool PrinterQuery::is_valid() const {
return worker_.get() != nullptr; return worker_.get() != NULL;
} }
} // namespace printing } // namespace printing

View file

@ -246,7 +246,7 @@ content::WebContents* PrintingMessageFilter::GetWebContentsForRenderView(
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::RenderViewHost* view = content::RenderViewHost::FromID( content::RenderViewHost* view = content::RenderViewHost::FromID(
render_process_id_, render_view_id); render_process_id_, render_view_id);
return view ? content::WebContents::FromRenderViewHost(view) : nullptr; return view ? content::WebContents::FromRenderViewHost(view) : NULL;
} }
void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) {

View file

@ -171,7 +171,7 @@ int WaitSocketForRead(int fd, const base::TimeDelta& timeout) {
FD_ZERO(&read_fds); FD_ZERO(&read_fds);
FD_SET(fd, &read_fds); FD_SET(fd, &read_fds);
return HANDLE_EINTR(select(fd + 1, &read_fds, nullptr, nullptr, &tv)); return HANDLE_EINTR(select(fd + 1, &read_fds, NULL, NULL, &tv));
} }
// Read a message from a socket fd, with an optional timeout. // Read a message from a socket fd, with an optional timeout.
@ -579,7 +579,9 @@ 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.";
auto* reader = new SocketReader(this, ui_message_loop_, connection_socket); SocketReader* reader = new SocketReader(this,
ui_message_loop_,
connection_socket);
readers_.insert(reader); readers_.insert(reader);
} }
@ -820,9 +822,10 @@ 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 (const auto& it : argv) { for (std::vector<std::string>::const_iterator it = argv.begin();
it != argv.end(); ++it) {
to_send.push_back(kTokenDelimiter); to_send.push_back(kTokenDelimiter);
to_send.append(it); to_send.append(*it);
} }
// Send the message // Send the message

View file

@ -86,10 +86,12 @@ 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 (const auto& it : data) { for (std::map<base::string16, std::string>::const_iterator it = data.begin();
if (!pickle->WriteString16(it.first)) it != data.end();
++it) {
if (!pickle->WriteString16(it->first))
return false; return false;
if (!pickle->WriteString(it.second)) if (!pickle->WriteString(it->second))
return false; return false;
} }
return true; return true;

View file

@ -26,7 +26,7 @@ PepperIsolatedFileSystemMessageFilter::Create(PP_Instance instance,
int unused_render_frame_id; int unused_render_frame_id;
if (!host->GetRenderFrameIDsForInstance( if (!host->GetRenderFrameIDsForInstance(
instance, &render_process_id, &unused_render_frame_id)) { instance, &render_process_id, &unused_render_frame_id)) {
return nullptr; return NULL;
} }
return new PepperIsolatedFileSystemMessageFilter( return new PepperIsolatedFileSystemMessageFilter(
render_process_id, render_process_id,

View file

@ -43,14 +43,16 @@ void WidevineCdmMessageFilter::OnIsInternalPluginAvailableForMimeType(
std::vector<WebPluginInfo> plugins; std::vector<WebPluginInfo> plugins;
PluginService::GetInstance()->GetInternalPlugins(&plugins); PluginService::GetInstance()->GetInternalPlugins(&plugins);
for (auto& plugin : plugins) { for (size_t i = 0; i < plugins.size(); ++i) {
const WebPluginInfo& plugin = plugins[i];
const std::vector<content::WebPluginMimeType>& mime_types = const std::vector<content::WebPluginMimeType>& mime_types =
plugin.mime_types; plugin.mime_types;
for (const auto& j : mime_types) { for (size_t j = 0; j < mime_types.size(); ++j) {
if (j.mime_type == mime_type) {
if (mime_types[j].mime_type == mime_type) {
*is_available = true; *is_available = true;
*additional_param_names = j.additional_param_names; *additional_param_names = mime_types[j].additional_param_names;
*additional_param_values = j.additional_param_values; *additional_param_values = mime_types[j].additional_param_values;
return; return;
} }
} }

View file

@ -115,10 +115,10 @@ TtsControllerImpl* TtsControllerImpl::GetInstance() {
} }
TtsControllerImpl::TtsControllerImpl() TtsControllerImpl::TtsControllerImpl()
: current_utterance_(nullptr), : current_utterance_(NULL),
paused_(false), paused_(false),
platform_impl_(nullptr), platform_impl_(NULL),
tts_engine_delegate_(nullptr) { tts_engine_delegate_(NULL) {
} }
TtsControllerImpl::~TtsControllerImpl() { TtsControllerImpl::~TtsControllerImpl() {
@ -206,7 +206,7 @@ void TtsControllerImpl::SpeakNow(Utterance* utterance) {
if (!sends_end_event) { if (!sends_end_event) {
utterance->Finish(); utterance->Finish();
delete utterance; delete utterance;
current_utterance_ = nullptr; current_utterance_ = NULL;
SpeakNextUtterance(); SpeakNextUtterance();
} }
#endif #endif
@ -222,7 +222,7 @@ void TtsControllerImpl::SpeakNow(Utterance* utterance) {
voice, voice,
utterance->continuous_parameters()); utterance->continuous_parameters());
if (!success) if (!success)
current_utterance_ = nullptr; current_utterance_ = NULL;
// If the native voice wasn't able to process this speech, see if // If the native voice wasn't able to process this speech, see if
// the browser has built-in TTS that isn't loaded yet. // the browser has built-in TTS that isn't loaded yet.
@ -323,7 +323,7 @@ void TtsControllerImpl::GetVoices(content::BrowserContext* browser_context,
} }
bool TtsControllerImpl::IsSpeaking() { bool TtsControllerImpl::IsSpeaking() {
return current_utterance_ != nullptr || GetPlatformImpl()->IsSpeaking(); return current_utterance_ != NULL || GetPlatformImpl()->IsSpeaking();
} }
void TtsControllerImpl::FinishCurrentUtterance() { void TtsControllerImpl::FinishCurrentUtterance() {
@ -332,7 +332,7 @@ void TtsControllerImpl::FinishCurrentUtterance() {
current_utterance_->OnTtsEvent(TTS_EVENT_INTERRUPTED, kInvalidCharIndex, current_utterance_->OnTtsEvent(TTS_EVENT_INTERRUPTED, kInvalidCharIndex,
std::string()); std::string());
delete current_utterance_; delete current_utterance_;
current_utterance_ = nullptr; current_utterance_ = NULL;
} }
} }
@ -415,8 +415,11 @@ 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 (auto iter : utterance->required_event_types()) { for (std::set<TtsEventType>::const_iterator iter =
if (voice.events.find(iter) == voice.events.end()) { utterance->required_event_types().begin();
iter != utterance->required_event_types().end();
++iter) {
if (voice.events.find(*iter) == voice.events.end()) {
has_all_required_event_types = false; has_all_required_event_types = false;
break; break;
} }
@ -433,8 +436,10 @@ int TtsControllerImpl::GetMatchingVoice(
} }
void TtsControllerImpl::VoicesChanged() { void TtsControllerImpl::VoicesChanged() {
for (auto voices_changed_delegate : voices_changed_delegates_) { for (std::set<VoicesChangedDelegate*>::iterator iter =
voices_changed_delegate->OnVoicesChanged(); voices_changed_delegates_.begin();
iter != voices_changed_delegates_.end(); ++iter) {
(*iter)->OnVoicesChanged();
} }
} }

View file

@ -112,13 +112,13 @@ static void AddPepperBasedWidevine(
supported_codecs |= media::EME_CODEC_MP4_AAC; supported_codecs |= media::EME_CODEC_MP4_AAC;
#endif // defined(USE_PROPRIETARY_CODECS) #endif // defined(USE_PROPRIETARY_CODECS)
for (auto& codec : codecs) { for (size_t i = 0; i < codecs.size(); ++i) {
if (codec == kCdmSupportedCodecVp8) if (codecs[i] == kCdmSupportedCodecVp8)
supported_codecs |= media::EME_CODEC_WEBM_VP8; supported_codecs |= media::EME_CODEC_WEBM_VP8;
if (codec == kCdmSupportedCodecVp9) if (codecs[i] == kCdmSupportedCodecVp9)
supported_codecs |= media::EME_CODEC_WEBM_VP9; supported_codecs |= media::EME_CODEC_WEBM_VP9;
#if defined(USE_PROPRIETARY_CODECS) #if defined(USE_PROPRIETARY_CODECS)
if (codec == kCdmSupportedCodecAvc1) if (codecs[i] == kCdmSupportedCodecAvc1)
supported_codecs |= media::EME_CODEC_MP4_AVC1; supported_codecs |= media::EME_CODEC_MP4_AVC1;
#endif // defined(USE_PROPRIETARY_CODECS) #endif // defined(USE_PROPRIETARY_CODECS)
} }

View file

@ -195,7 +195,7 @@ void PepperFlashMenuHost::OnMenuClosed(int request_id) {
void PepperFlashMenuHost::SendMenuReply(int32_t result, int action) { void PepperFlashMenuHost::SendMenuReply(int32_t result, int action) {
ppapi::host::ReplyMessageContext reply_context( ppapi::host::ReplyMessageContext reply_context(
ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0), ppapi::proxy::ResourceMessageReplyParams(pp_resource(), 0),
nullptr, NULL,
MSG_ROUTING_NONE); MSG_ROUTING_NONE);
reply_context.params.set_result(result); reply_context.params.set_result(result);
host()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(action)); host()->SendReply(reply_context, PpapiPluginMsg_FlashMenu_ShowReply(action));

View file

@ -115,7 +115,7 @@ bool IsSimpleHeader(const std::string& lower_case_header_name,
&lower_case_mime_type, &lower_case_mime_type,
&lower_case_charset, &lower_case_charset,
&had_charset, &had_charset,
nullptr); NULL);
return lower_case_mime_type == "application/x-www-form-urlencoded" || return lower_case_mime_type == "application/x-www-form-urlencoded" ||
lower_case_mime_type == "multipart/form-data" || lower_case_mime_type == "multipart/form-data" ||
lower_case_mime_type == "text/plain"; lower_case_mime_type == "text/plain";

View file

@ -110,8 +110,8 @@ PrintMsg_Print_Params GetCssPrintParams(
// Invalid page size and/or margins. We just use the default setting. // Invalid page size and/or margins. We just use the default setting.
if (new_content_width < 1 || new_content_height < 1) { if (new_content_width < 1 || new_content_height < 1) {
CHECK(frame != nullptr); CHECK(frame != NULL);
page_css_params = GetCssPrintParams(nullptr, page_index, page_params); page_css_params = GetCssPrintParams(NULL, page_index, page_params);
return page_css_params; return page_css_params;
} }
@ -254,7 +254,7 @@ void ComputeWebKitPrintParamsInDesiredDpi(
blink::WebPlugin* GetPlugin(const blink::WebFrame* frame) { blink::WebPlugin* GetPlugin(const blink::WebFrame* frame) {
return frame->document().isPluginDocument() ? return frame->document().isPluginDocument() ?
frame->document().to<blink::WebPluginDocument>().plugin() : nullptr; frame->document().to<blink::WebPluginDocument>().plugin() : NULL;
} }
bool PrintingNodeOrPdfFrame(const blink::WebFrame* frame, bool PrintingNodeOrPdfFrame(const blink::WebFrame* frame,
@ -323,7 +323,7 @@ FrameReference::FrameReference(blink::WebLocalFrame* frame) {
} }
FrameReference::FrameReference() { FrameReference::FrameReference() {
Reset(nullptr); Reset(NULL);
} }
FrameReference::~FrameReference() { FrameReference::~FrameReference() {
@ -334,20 +334,20 @@ void FrameReference::Reset(blink::WebLocalFrame* frame) {
view_ = frame->view(); view_ = frame->view();
frame_ = frame; frame_ = frame;
} else { } else {
view_ = nullptr; view_ = NULL;
frame_ = nullptr; frame_ = NULL;
} }
} }
blink::WebLocalFrame* FrameReference::GetFrame() { blink::WebLocalFrame* FrameReference::GetFrame() {
if (view_ == nullptr || frame_ == nullptr) if (view_ == NULL || frame_ == NULL)
return nullptr; return NULL;
for (blink::WebFrame* frame = view_->mainFrame(); frame != nullptr; for (blink::WebFrame* frame = view_->mainFrame(); frame != NULL;
frame = frame->traverseNext(false)) { frame = frame->traverseNext(false)) {
if (frame == frame_) if (frame == frame_)
return frame_; return frame_;
} }
return nullptr; return NULL;
} }
blink::WebView* FrameReference::view() { blink::WebView* FrameReference::view() {
@ -477,7 +477,7 @@ PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint(
frame->printBegin(web_print_params_, node_to_print_); frame->printBegin(web_print_params_, node_to_print_);
print_params = CalculatePrintParamsForCss(frame, 0, print_params, print_params = CalculatePrintParamsForCss(frame, 0, print_params,
ignore_css_margins, fit_to_page, ignore_css_margins, fit_to_page,
nullptr); NULL);
frame->printEnd(); frame->printEnd();
} }
ComputeWebKitPrintParamsInDesiredDpi(print_params, &web_print_params_); ComputeWebKitPrintParamsInDesiredDpi(print_params, &web_print_params_);
@ -623,7 +623,7 @@ void PrepareFrameAndViewForPrint::FinishPrinting() {
web_view->close(); web_view->close();
} }
} }
frame_.Reset(nullptr); frame_.Reset(NULL);
on_ready_.Reset(); on_ready_.Reset();
} }
@ -980,10 +980,10 @@ bool PrintWebViewHelper::PrintPagesNative(blink::WebFrame* frame,
PrintPageInternal(page_params, frame); PrintPageInternal(page_params, frame);
} }
} else { } else {
for (int page : params.pages) { for (size_t i = 0; i < params.pages.size(); ++i) {
if (page >= page_count) if (params.pages[i] >= page_count)
break; break;
page_params.page_number = page; page_params.page_number = params.pages[i];
PrintPageInternal(page_params, frame); PrintPageInternal(page_params, frame);
} }
} }

View file

@ -301,8 +301,8 @@ bool SpellcheckCharAttribute::OutputDefault(UChar c,
// SpellcheckWordIterator implementation: // SpellcheckWordIterator implementation:
SpellcheckWordIterator::SpellcheckWordIterator() SpellcheckWordIterator::SpellcheckWordIterator()
: text_(nullptr), : text_(NULL),
attribute_(nullptr), attribute_(NULL),
iterator_() { iterator_() {
} }

View file

@ -118,8 +118,8 @@ std::string StripTrailingWildcard(const std::string& path) {
namespace extensions { namespace extensions {
// static // static
bool URLPattern::IsValidSchemeForExtensions(const std::string& scheme) { bool URLPattern::IsValidSchemeForExtensions(const std::string& scheme) {
for (auto& kValidScheme : kValidSchemes) { for (size_t i = 0; i < arraysize(kValidSchemes); ++i) {
if (scheme == kValidScheme) if (scheme == kValidSchemes[i])
return true; return true;
} }
return false; return false;
@ -346,7 +346,7 @@ bool URLPattern::SetPort(const std::string& port) {
bool URLPattern::MatchesURL(const GURL& test) const { bool URLPattern::MatchesURL(const GURL& test) const {
const GURL* test_url = &test; const GURL* test_url = &test;
bool has_inner_url = test.inner_url() != nullptr; bool has_inner_url = test.inner_url() != NULL;
if (has_inner_url) { if (has_inner_url) {
if (!test.SchemeIsFileSystem()) if (!test.SchemeIsFileSystem())
@ -370,7 +370,7 @@ bool URLPattern::MatchesURL(const GURL& test) const {
bool URLPattern::MatchesSecurityOrigin(const GURL& test) const { bool URLPattern::MatchesSecurityOrigin(const GURL& test) const {
const GURL* test_url = &test; const GURL* test_url = &test;
bool has_inner_url = test.inner_url() != nullptr; bool has_inner_url = test.inner_url() != NULL;
if (has_inner_url) { if (has_inner_url) {
if (!test.SchemeIsFileSystem()) if (!test.SchemeIsFileSystem())
@ -543,8 +543,9 @@ 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 (const auto& scheme : schemes) { for (std::vector<std::string>::const_iterator i = schemes.begin();
if (MatchesScheme(scheme)) i != schemes.end(); ++i) {
if (MatchesScheme(*i))
return true; return true;
} }
@ -553,8 +554,9 @@ bool URLPattern::MatchesAnyScheme(
bool URLPattern::MatchesAllSchemes( bool URLPattern::MatchesAllSchemes(
const std::vector<std::string>& schemes) const { const std::vector<std::string>& schemes) const {
for (const auto& scheme : schemes) { for (std::vector<std::string>::const_iterator i = schemes.begin();
if (!MatchesScheme(scheme)) i != schemes.end(); ++i) {
if (!MatchesScheme(*i))
return false; return false;
} }
@ -584,9 +586,9 @@ std::vector<std::string> URLPattern::GetExplicitSchemes() const {
return result; return result;
} }
for (auto& kValidScheme : kValidSchemes) { for (size_t i = 0; i < arraysize(kValidSchemes); ++i) {
if (MatchesScheme(kValidScheme)) { if (MatchesScheme(kValidSchemes[i])) {
result.push_back(kValidScheme); result.push_back(kValidSchemes[i]);
} }
} }

View file

@ -123,7 +123,7 @@ int StreamListenSocket::GetPeerAddress(IPEndPoint* address) const {
} }
SocketDescriptor StreamListenSocket::AcceptSocket() { SocketDescriptor StreamListenSocket::AcceptSocket() {
SocketDescriptor conn = HANDLE_EINTR(accept(socket_, nullptr, nullptr)); SocketDescriptor conn = HANDLE_EINTR(accept(socket_, NULL, NULL));
if (conn == kInvalidSocket) if (conn == kInvalidSocket)
LOG(ERROR) << "Error accepting connection."; LOG(ERROR) << "Error accepting connection.";
else else