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

Side by Side Diff: extensions/common/url_pattern.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, 3 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/url_pattern.h" 5 #include "extensions/common/url_pattern.h"
6 6
7 #include <ostream> 7 #include <ostream>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 spec_.clear(); 337 spec_.clear();
338 if (IsValidPortForScheme(scheme_, port)) { 338 if (IsValidPortForScheme(scheme_, port)) {
339 port_ = port; 339 port_ = port;
340 return true; 340 return true;
341 } 341 }
342 return false; 342 return false;
343 } 343 }
344 344
345 bool URLPattern::MatchesURL(const GURL& test) const { 345 bool URLPattern::MatchesURL(const GURL& test) const {
346 const GURL* test_url = &test; 346 const GURL* test_url = &test;
347 bool has_inner_url = test.inner_url() != NULL; 347 bool has_inner_url = test.inner_url() != nullptr;
348 348
349 if (has_inner_url) { 349 if (has_inner_url) {
350 if (!test.SchemeIsFileSystem()) 350 if (!test.SchemeIsFileSystem())
351 return false; // The only nested URLs we handle are filesystem URLs. 351 return false; // The only nested URLs we handle are filesystem URLs.
352 test_url = test.inner_url(); 352 test_url = test.inner_url();
353 } 353 }
354 354
355 if (!MatchesScheme(test_url->scheme())) 355 if (!MatchesScheme(test_url->scheme()))
356 return false; 356 return false;
357 357
358 if (match_all_urls_) 358 if (match_all_urls_)
359 return true; 359 return true;
360 360
361 std::string path_for_request = test.PathForRequest(); 361 std::string path_for_request = test.PathForRequest();
362 if (has_inner_url) 362 if (has_inner_url)
363 path_for_request = test_url->path() + path_for_request; 363 path_for_request = test_url->path() + path_for_request;
364 364
365 return MatchesSecurityOriginHelper(*test_url) && 365 return MatchesSecurityOriginHelper(*test_url) &&
366 MatchesPath(path_for_request); 366 MatchesPath(path_for_request);
367 } 367 }
368 368
369 bool URLPattern::MatchesSecurityOrigin(const GURL& test) const { 369 bool URLPattern::MatchesSecurityOrigin(const GURL& test) const {
370 const GURL* test_url = &test; 370 const GURL* test_url = &test;
371 bool has_inner_url = test.inner_url() != NULL; 371 bool has_inner_url = test.inner_url() != nullptr;
372 372
373 if (has_inner_url) { 373 if (has_inner_url) {
374 if (!test.SchemeIsFileSystem()) 374 if (!test.SchemeIsFileSystem())
375 return false; // The only nested URLs we handle are filesystem URLs. 375 return false; // The only nested URLs we handle are filesystem URLs.
376 test_url = test.inner_url(); 376 test_url = test.inner_url();
377 } 377 }
378 378
379 if (!MatchesScheme(test_url->scheme())) 379 if (!MatchesScheme(test_url->scheme()))
380 return false; 380 return false;
381 381
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 } 605 }
606 606
607 return result; 607 return result;
608 } 608 }
609 609
610 // static 610 // static
611 const char* URLPattern::GetParseResultString( 611 const char* URLPattern::GetParseResultString(
612 URLPattern::ParseResult parse_result) { 612 URLPattern::ParseResult parse_result) {
613 return kParseResultMessages[parse_result]; 613 return kParseResultMessages[parse_result];
614 } 614 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698