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

Side by Side Diff: chrome/common/extensions/url_pattern.cc

Issue 10174001: Add an API for hosted apps to check their install and running states. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 | Annotate | Revision Log
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 "chrome/common/extensions/url_pattern.h" 5 #include "chrome/common/extensions/url_pattern.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_piece.h" 8 #include "base/string_piece.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return false; 371 return false;
372 372
373 if (test.host().compare(test.host().length() - host_.length(), 373 if (test.host().compare(test.host().length() - host_.length(),
374 host_.length(), host_) != 0) 374 host_.length(), host_) != 0)
375 return false; 375 return false;
376 376
377 return test.host()[test.host().length() - host_.length() - 1] == '.'; 377 return test.host()[test.host().length() - host_.length() - 1] == '.';
378 } 378 }
379 379
380 bool URLPattern::MatchesPath(const std::string& test) const { 380 bool URLPattern::MatchesPath(const std::string& test) const {
381 if (!MatchPattern(test, path_escaped_)) 381 return MatchPattern(test, path_escaped_) ||
382 return false; 382 MatchPattern(test + '/', path_escaped_) ||
383 383 MatchPattern(test, path_escaped_ + '/');
384 return true;
385 } 384 }
386 385
387 bool URLPattern::MatchesPort(int port) const { 386 bool URLPattern::MatchesPort(int port) const {
388 if (port == url_parse::PORT_INVALID) 387 if (port == url_parse::PORT_INVALID)
389 return false; 388 return false;
390 389
391 return port_ == "*" || port_ == base::IntToString(port); 390 return port_ == "*" || port_ == base::IntToString(port);
392 } 391 }
393 392
394 393
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 511 }
513 512
514 return result; 513 return result;
515 } 514 }
516 515
517 // static 516 // static
518 const char* URLPattern::GetParseResultString( 517 const char* URLPattern::GetParseResultString(
519 URLPattern::ParseResult parse_result) { 518 URLPattern::ParseResult parse_result) {
520 return kParseResultMessages[parse_result]; 519 return kParseResultMessages[parse_result];
521 } 520 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698