Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: extensions/browser/content_hash_fetcher.cc

Issue 598173003: Run clang-modernize -use-nullptr over src/extensions/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "extensions/browser/content_hash_fetcher.h" 5 #include "extensions/browser/content_hash_fetcher.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/base64.h" 9 #include "base/base64.h"
10 #include "base/files/file_enumerator.h" 10 #include "base/files/file_enumerator.h"
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 url_fetcher_->Start(); 247 url_fetcher_->Start();
248 } 248 }
249 } 249 }
250 250
251 // Helper function to let us pass ownership of a string via base::Bind with the 251 // Helper function to let us pass ownership of a string via base::Bind with the
252 // contents to be written into a file. Also ensures that the directory for 252 // contents to be written into a file. Also ensures that the directory for
253 // |path| exists, creating it if needed. 253 // |path| exists, creating it if needed.
254 static int WriteFileHelper(const base::FilePath& path, 254 static int WriteFileHelper(const base::FilePath& path,
255 scoped_ptr<std::string> content) { 255 scoped_ptr<std::string> content) {
256 base::FilePath dir = path.DirName(); 256 base::FilePath dir = path.DirName();
257 return (base::CreateDirectoryAndGetError(dir, NULL) && 257 return (base::CreateDirectoryAndGetError(dir, nullptr) &&
258 base::WriteFile(path, content->data(), content->size())); 258 base::WriteFile(path, content->data(), content->size()));
259 } 259 }
260 260
261 void ContentHashFetcherJob::OnURLFetchComplete(const net::URLFetcher* source) { 261 void ContentHashFetcherJob::OnURLFetchComplete(const net::URLFetcher* source) {
262 VLOG(1) << "URLFetchComplete for " << extension_id_ 262 VLOG(1) << "URLFetchComplete for " << extension_id_
263 << " is_success:" << url_fetcher_->GetStatus().is_success() << " " 263 << " is_success:" << url_fetcher_->GetStatus().is_success() << " "
264 << fetch_url_.possibly_invalid_spec(); 264 << fetch_url_.possibly_invalid_spec();
265 if (IsCancelled()) 265 if (IsCancelled())
266 return; 266 return;
267 scoped_ptr<std::string> response(new std::string); 267 scoped_ptr<std::string> response(new std::string);
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 creation_thread_, 334 creation_thread_,
335 FROM_HERE, 335 FROM_HERE,
336 base::Bind(&ContentHashFetcherJob::DispatchCallback, this)); 336 base::Bind(&ContentHashFetcherJob::DispatchCallback, this));
337 } 337 }
338 338
339 bool ContentHashFetcherJob::CreateHashes(const base::FilePath& hashes_file) { 339 bool ContentHashFetcherJob::CreateHashes(const base::FilePath& hashes_file) {
340 base::ElapsedTimer timer; 340 base::ElapsedTimer timer;
341 if (IsCancelled()) 341 if (IsCancelled())
342 return false; 342 return false;
343 // Make sure the directory exists. 343 // Make sure the directory exists.
344 if (!base::CreateDirectoryAndGetError(hashes_file.DirName(), NULL)) 344 if (!base::CreateDirectoryAndGetError(hashes_file.DirName(), nullptr))
345 return false; 345 return false;
346 346
347 if (!verified_contents_.get()) { 347 if (!verified_contents_.get()) {
348 base::FilePath verified_contents_path = 348 base::FilePath verified_contents_path =
349 file_util::GetVerifiedContentsPath(extension_path_); 349 file_util::GetVerifiedContentsPath(extension_path_);
350 verified_contents_.reset(new VerifiedContents(key_.data, key_.size)); 350 verified_contents_.reset(new VerifiedContents(key_.data, key_.size));
351 if (!verified_contents_->InitFrom(verified_contents_path, false)) 351 if (!verified_contents_->InitFrom(verified_contents_path, false))
352 return false; 352 return false;
353 verified_contents_.reset(); 353 verified_contents_.reset();
354 } 354 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 498
499 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) { 499 for (JobMap::iterator i = jobs_.begin(); i != jobs_.end(); ++i) {
500 if (i->second.get() == job) { 500 if (i->second.get() == job) {
501 jobs_.erase(i); 501 jobs_.erase(i);
502 break; 502 break;
503 } 503 }
504 } 504 }
505 } 505 }
506 506
507 } // namespace extensions 507 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698