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

Side by Side Diff: chrome/common/extensions/matcher/url_matcher_factory.h

Issue 10398054: Improve documentation of potential memory leaks in URLMatcherFactory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « chrome/common/extensions/matcher/url_matcher.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_FACTORY_H_ 5 #ifndef CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_FACTORY_H_
6 #define CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_FACTORY_H_ 6 #define CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_FACTORY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "chrome/common/extensions/matcher/url_matcher.h" 12 #include "chrome/common/extensions/matcher/url_matcher.h"
13 13
14 namespace base { 14 namespace base {
15 class DictionaryValue; 15 class DictionaryValue;
16 class Value; 16 class Value;
17 } 17 }
18 18
19 namespace extensions { 19 namespace extensions {
20 20
21 class URLMatcherFactory { 21 class URLMatcherFactory {
22 public: 22 public:
23 // Creates a URLMatcherConditionSet from a UrlFilter dictionary as defined in 23 // Creates a URLMatcherConditionSet from a UrlFilter dictionary as defined in
24 // the declarative API. |url_fetcher_dict| contains the dictionary passed 24 // the declarative API. |url_fetcher_dict| contains the dictionary passed
25 // by the extension, |id| is the identifier assigned to the created 25 // by the extension, |id| is the identifier assigned to the created
26 // URLMatcherConditionSet. In case of an error, |error| is set to contain 26 // URLMatcherConditionSet. In case of an error, |error| is set to contain
27 // an error message. 27 // an error message.
28 //
29 // Note: In case this function fails or if you don't register the
30 // URLMatcherConditionSet to the URLMatcher, you need to call
31 // URLMatcher::ClearUnusedConditionSets() on the URLMatcher that owns this
32 // URLMatcherFactory. Otherwise you leak memory.
28 static scoped_refptr<URLMatcherConditionSet> CreateFromURLFilterDictionary( 33 static scoped_refptr<URLMatcherConditionSet> CreateFromURLFilterDictionary(
29 URLMatcherConditionFactory* url_matcher_condition_factory, 34 URLMatcherConditionFactory* url_matcher_condition_factory,
30 const base::DictionaryValue* url_filter_dict, 35 const base::DictionaryValue* url_filter_dict,
31 URLMatcherConditionSet::ID id, 36 URLMatcherConditionSet::ID id,
32 std::string* error); 37 std::string* error);
33 38
34 private: 39 private:
35 // Returns whether a condition attribute with name |condition_attribute_name| 40 // Returns whether a condition attribute with name |condition_attribute_name|
36 // needs to be handled by the URLMatcher. 41 // needs to be handled by the URLMatcher.
37 static bool IsURLMatcherConditionAttribute( 42 static bool IsURLMatcherConditionAttribute(
(...skipping 11 matching lines...) Expand all
49 54
50 static scoped_ptr<URLMatcherPortFilter> CreateURLMatcherPorts( 55 static scoped_ptr<URLMatcherPortFilter> CreateURLMatcherPorts(
51 const base::Value* value, std::string* error); 56 const base::Value* value, std::string* error);
52 57
53 DISALLOW_IMPLICIT_CONSTRUCTORS(URLMatcherFactory); 58 DISALLOW_IMPLICIT_CONSTRUCTORS(URLMatcherFactory);
54 }; 59 };
55 60
56 } // namespace extensions 61 } // namespace extensions
57 62
58 #endif // CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_FACTORY_H_ 63 #endif // CHROME_COMMON_EXTENSIONS_MATCHER_URL_MATCHER_FACTORY_H_
OLDNEW
« no previous file with comments | « chrome/common/extensions/matcher/url_matcher.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698