| OLD | NEW |
| 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_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ | 5 #ifndef CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ |
| 6 #define CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ | 6 #define CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 // IsRelative=1 | 64 // IsRelative=1 |
| 65 // Path=Profiles/abcdefeg.default | 65 // Path=Profiles/abcdefeg.default |
| 66 // We set "[value]" in path "<Section>.<Key>". For example, the path | 66 // We set "[value]" in path "<Section>.<Key>". For example, the path |
| 67 // "Genenral.StartWithLastProfile" has the value "1". | 67 // "Genenral.StartWithLastProfile" has the value "1". |
| 68 void ParseProfileINI(const base::FilePath& file, base::DictionaryValue* root); | 68 void ParseProfileINI(const base::FilePath& file, base::DictionaryValue* root); |
| 69 | 69 |
| 70 // Returns true if we want to add the URL to the history. We filter out the URL | 70 // Returns true if we want to add the URL to the history. We filter out the URL |
| 71 // with a unsupported scheme. | 71 // with a unsupported scheme. |
| 72 bool CanImportURL(const GURL& url); | 72 bool CanImportURL(const GURL& url); |
| 73 | 73 |
| 74 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| | |
| 75 // with the resulting TemplateURLs. | |
| 76 void ParseSearchEnginesFromXMLFiles(const std::vector<base::FilePath>& xml_files
, | |
| 77 std::vector<TemplateURL*>* search_engines); | |
| 78 | |
| 79 // Returns the home page set in Firefox in a particular profile. | 74 // Returns the home page set in Firefox in a particular profile. |
| 80 GURL GetHomepage(const base::FilePath& profile_path); | 75 GURL GetHomepage(const base::FilePath& profile_path); |
| 81 | 76 |
| 82 // Checks to see if this home page is a default home page, as specified by | 77 // Checks to see if this home page is a default home page, as specified by |
| 83 // the resource file browserconfig.properties in the Firefox application | 78 // the resource file browserconfig.properties in the Firefox application |
| 84 // directory. | 79 // directory. |
| 85 bool IsDefaultHomepage(const GURL& homepage, const base::FilePath& app_path); | 80 bool IsDefaultHomepage(const GURL& homepage, const base::FilePath& app_path); |
| 86 | 81 |
| 87 // Parses the prefs found in the file |pref_file| and puts the key/value pairs | 82 // Parses the prefs found in the file |pref_file| and puts the key/value pairs |
| 88 // in |prefs|. Keys are strings, and values can be strings, booleans or | 83 // in |prefs|. Keys are strings, and values can be strings, booleans or |
| 89 // integers. Returns true if it succeeded, false otherwise (in which case | 84 // integers. Returns true if it succeeded, false otherwise (in which case |
| 90 // |prefs| is not filled). | 85 // |prefs| is not filled). |
| 91 // Note: for strings, only valid UTF-8 string values are supported. If a | 86 // Note: for strings, only valid UTF-8 string values are supported. If a |
| 92 // key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|. | 87 // key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|. |
| 93 bool ParsePrefFile(const base::FilePath& pref_file, base::DictionaryValue* prefs
); | 88 bool ParsePrefFile(const base::FilePath& pref_file, base::DictionaryValue* prefs
); |
| 94 | 89 |
| 95 // Parses the value of a particular firefox preference from a string that is the | 90 // Parses the value of a particular firefox preference from a string that is the |
| 96 // contents of the prefs file. | 91 // contents of the prefs file. |
| 97 std::string GetPrefsJsValue(const std::string& prefs, | 92 std::string GetPrefsJsValue(const std::string& prefs, |
| 98 const std::string& pref_key); | 93 const std::string& pref_key); |
| 99 | 94 |
| 100 // Returns the localized Firefox branding name. | 95 // Returns the localized Firefox branding name. |
| 101 // This is useful to differentiate between Firefox and Iceweasel. | 96 // This is useful to differentiate between Firefox and Iceweasel. |
| 102 // If anything goes wrong while trying to obtain the branding name, | 97 // If anything goes wrong while trying to obtain the branding name, |
| 103 // the function assumes it's Firefox. | 98 // the function assumes it's Firefox. |
| 104 string16 GetFirefoxImporterName(const base::FilePath& app_path); | 99 string16 GetFirefoxImporterName(const base::FilePath& app_path); |
| 105 | 100 |
| 106 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ | 101 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ |
| OLD | NEW |