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

Unified Diff: chrome/common/extensions/url_pattern.cc

Issue 2870027: Fix a memory leak in ExtensionExtentUnittest by fixing a bad (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: remove unneeded header from url_pattern.h Created 10 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/extensions/url_pattern.h ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/common/extensions/url_pattern.cc
diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc
index 1aae528093f7f5ecb11950bd624b5d85bd0e29a3..41a5f6e21bbba2a572520f7de1918f1de8fc7dd3 100644
--- a/chrome/common/extensions/url_pattern.cc
+++ b/chrome/common/extensions/url_pattern.cc
@@ -4,7 +4,6 @@
#include "chrome/common/extensions/url_pattern.h"
-#include "base/scoped_ptr.h"
#include "base/string_piece.h"
#include "base/string_util.h"
#include "chrome/common/url_constants.h"
@@ -22,15 +21,6 @@ static const char* kValidSchemes[] = {
static const char kPathSeparator[] = "/";
// static
-URLPattern* URLPattern::CreateFromString(const std::string& pattern_string) {
- scoped_ptr<URLPattern> pattern(new URLPattern);
- if (pattern->Parse(pattern_string))
- return pattern.release();
- else
- return NULL;
-}
-
-// static
bool URLPattern::IsValidScheme(const std::string& scheme) {
for (size_t i = 0; i < arraysize(kValidSchemes); ++i) {
if (scheme == kValidSchemes[i])
@@ -40,6 +30,15 @@ bool URLPattern::IsValidScheme(const std::string& scheme) {
return false;
}
+URLPattern::URLPattern()
+ : match_subdomains_(false) {}
+
+URLPattern::URLPattern(const std::string& pattern)
+ : match_subdomains_(false) {
+ if (!Parse(pattern))
+ NOTREACHED() << "URLPattern is invalid: " << pattern;
+}
+
bool URLPattern::Parse(const std::string& pattern) {
size_t scheme_end_pos = pattern.find(chrome::kStandardSchemeSeparator);
if (scheme_end_pos == std::string::npos)
« no previous file with comments | « chrome/common/extensions/url_pattern.h ('k') | tools/heapcheck/suppressions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698