OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/browser/importer/firefox_importer_utils.h" | 5 #include "chrome/browser/importer/firefox_importer_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/search_engines/template_url.h" | 13 #include "chrome/browser/search_engines/template_url.h" |
14 #include "chrome/browser/search_engines/template_url_model.h" | 14 #include "chrome/browser/search_engines/template_url_model.h" |
15 #include "chrome/browser/search_engines/template_url_parser.h" | 15 #include "chrome/browser/search_engines/template_url_parser.h" |
16 #include "googleurl/src/gurl.h" | 16 #include "googleurl/src/gurl.h" |
17 | 17 |
18 namespace { | 18 namespace { |
19 | 19 |
20 // FirefoxURLParameterFilter is used to remove parameter mentioning Firefox from | 20 // FirefoxURLParameterFilter is used to remove parameter mentioning Firefox from |
21 // the search URL when importing search engines. | 21 // the search URL when importing search engines. |
22 class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter { | 22 class FirefoxURLParameterFilter : public TemplateURLParser::ParameterFilter { |
23 public: | 23 public: |
24 FirefoxURLParameterFilter() {} | 24 FirefoxURLParameterFilter() { } |
25 virtual ~FirefoxURLParameterFilter() {} | 25 ~FirefoxURLParameterFilter() { } |
26 | 26 |
27 // TemplateURLParser::ParameterFilter method. | 27 // TemplateURLParser::ParameterFilter method. |
28 virtual bool KeepParameter(const std::string& key, | 28 virtual bool KeepParameter(const std::string& key, |
29 const std::string& value) { | 29 const std::string& value) { |
30 std::string low_value = StringToLowerASCII(value); | 30 std::string low_value = StringToLowerASCII(value); |
31 if (low_value.find("mozilla") != std::string::npos || | 31 if (low_value.find("mozilla") != std::string::npos || |
32 low_value.find("firefox") != std::string::npos || | 32 low_value.find("firefox") != std::string::npos || |
33 low_value.find("moz:") != std::string::npos ) | 33 low_value.find("moz:") != std::string::npos ) |
34 return false; | 34 return false; |
35 return true; | 35 return true; |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 std::vector<std::string> urls; | 323 std::vector<std::string> urls; |
324 SplitString(default_homepages, '|', &urls); | 324 SplitString(default_homepages, '|', &urls); |
325 | 325 |
326 for (size_t i = 0; i < urls.size(); ++i) { | 326 for (size_t i = 0; i < urls.size(); ++i) { |
327 if (homepage.spec() == GURL(urls[i]).spec()) | 327 if (homepage.spec() == GURL(urls[i]).spec()) |
328 return true; | 328 return true; |
329 } | 329 } |
330 | 330 |
331 return false; | 331 return false; |
332 } | 332 } |
OLD | NEW |