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

Side by Side Diff: chrome/browser/search_engines/template_url_parser.h

Issue 14232019: Do not use a UIThreadSearchTermsData when validating a TemplateURL for which the Profile is NULL. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Move logic to GetTemplateURL. Created 7 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 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PARSER_H_ 5 #ifndef CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PARSER_H_
6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PARSER_H_ 6 #define CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PARSER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 10 matching lines...) Expand all
21 // Invoked for each parameter of the template URL while parsing. If this 21 // Invoked for each parameter of the template URL while parsing. If this
22 // methods returns false, the parameter is not included. 22 // methods returns false, the parameter is not included.
23 virtual bool KeepParameter(const std::string& key, 23 virtual bool KeepParameter(const std::string& key,
24 const std::string& value) = 0; 24 const std::string& value) = 0;
25 25
26 protected: 26 protected:
27 virtual ~ParameterFilter() {} 27 virtual ~ParameterFilter() {}
28 }; 28 };
29 29
30 // Decodes the chunk of data representing a TemplateURL, creates the 30 // Decodes the chunk of data representing a TemplateURL, creates the
31 // TemplateURL, and returns it. The caller owns the returned object. Returns 31 // TemplateURL, and returns it. The caller owns the returned object.
32 // NULL if data does not describe a valid TemplateURL, the URLs referenced do 32 // |profile| will be used to generate the TemplateUrl returned and should
Peter Kasting 2013/04/17 22:50:06 Nit: The profile isn't used to generate the TURL,
gab 2013/04/18 15:00:27 Done.
33 // not point to valid http/https resources, or for some other reason we do not 33 // be NULL if this is called from any thread other than the UI thread.
34 // support the described TemplateURL. |parameter_filter| can be used if you 34 // Returns NULL if data does not describe a valid TemplateURL, the URLs
35 // want to filter some parameters out of the URL. For example, when importing 35 // referenced do not point to valid http/https resources, or for some other
36 // from another browser, we remove any parameter identifying that browser. If 36 // reason we do not support the described TemplateURL. |parameter_filter| can
37 // set to NULL, the URL is not modified. 37 // be used if you want to filter some parameters out of the URL. For example,
38 // when importing from another browser, we remove any parameter identifying
39 // that browser. If set to NULL, the URL is not modified.
38 static TemplateURL* Parse(Profile* profile, 40 static TemplateURL* Parse(Profile* profile,
39 bool show_in_default_list, 41 bool show_in_default_list,
40 const char* data, 42 const char* data,
41 size_t length, 43 size_t length,
42 ParameterFilter* parameter_filter); 44 ParameterFilter* parameter_filter);
43 45
44 private: 46 private:
45 // No one should create one of these. 47 // No one should create one of these.
46 TemplateURLParser(); 48 TemplateURLParser();
47 49
48 DISALLOW_COPY_AND_ASSIGN(TemplateURLParser); 50 DISALLOW_COPY_AND_ASSIGN(TemplateURLParser);
49 }; 51 };
50 52
51 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PARSER_H_ 53 #endif // CHROME_BROWSER_SEARCH_ENGINES_TEMPLATE_URL_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698