OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "build/build_config.h" | 13 #include "build/build_config.h" |
14 | 14 |
15 class DictionaryValue; | |
16 class FilePath; | 15 class FilePath; |
17 class GURL; | 16 class GURL; |
18 class TemplateURL; | 17 class TemplateURL; |
19 | 18 |
| 19 namespace base { |
| 20 class DictionaryValue; |
| 21 } |
| 22 |
20 #if defined(OS_WIN) | 23 #if defined(OS_WIN) |
21 // Detects which version of Firefox is installed from registry. Returns its | 24 // Detects which version of Firefox is installed from registry. Returns its |
22 // major version, and drops the minor version. Returns 0 if failed. If there are | 25 // major version, and drops the minor version. Returns 0 if failed. If there are |
23 // indicators of both Firefox 2 and Firefox 3 it is biased to return the biggest | 26 // indicators of both Firefox 2 and Firefox 3 it is biased to return the biggest |
24 // version. | 27 // version. |
25 int GetCurrentFirefoxMajorVersionFromRegistry(); | 28 int GetCurrentFirefoxMajorVersionFromRegistry(); |
26 | 29 |
27 // Detects where Firefox lives. Returns an empty path if Firefox is not | 30 // Detects where Firefox lives. Returns an empty path if Firefox is not |
28 // installed. | 31 // installed. |
29 FilePath GetFirefoxInstallPathFromRegistry(); | 32 FilePath GetFirefoxInstallPathFromRegistry(); |
(...skipping 25 matching lines...) Expand all Loading... |
55 // they are separated in different sections. For example: | 58 // they are separated in different sections. For example: |
56 // [General] | 59 // [General] |
57 // StartWithLastProfile=1 | 60 // StartWithLastProfile=1 |
58 // | 61 // |
59 // [Profile0] | 62 // [Profile0] |
60 // Name=default | 63 // Name=default |
61 // IsRelative=1 | 64 // IsRelative=1 |
62 // Path=Profiles/abcdefeg.default | 65 // Path=Profiles/abcdefeg.default |
63 // We set "[value]" in path "<Section>.<Key>". For example, the path | 66 // We set "[value]" in path "<Section>.<Key>". For example, the path |
64 // "Genenral.StartWithLastProfile" has the value "1". | 67 // "Genenral.StartWithLastProfile" has the value "1". |
65 void ParseProfileINI(const FilePath& file, DictionaryValue* root); | 68 void ParseProfileINI(const FilePath& file, base::DictionaryValue* root); |
66 | 69 |
67 // 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 |
68 // with a unsupported scheme. | 71 // with a unsupported scheme. |
69 bool CanImportURL(const GURL& url); | 72 bool CanImportURL(const GURL& url); |
70 | 73 |
71 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| | 74 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| |
72 // with the resulting TemplateURLs. | 75 // with the resulting TemplateURLs. |
73 void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files, | 76 void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files, |
74 std::vector<TemplateURL*>* search_engines); | 77 std::vector<TemplateURL*>* search_engines); |
75 | 78 |
(...skipping 10 matching lines...) Expand all Loading... |
86 // the resource file browserconfig.properties in the Firefox application | 89 // the resource file browserconfig.properties in the Firefox application |
87 // directory. | 90 // directory. |
88 bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path); | 91 bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path); |
89 | 92 |
90 // Parses the prefs found in the file |pref_file| and puts the key/value pairs | 93 // Parses the prefs found in the file |pref_file| and puts the key/value pairs |
91 // in |prefs|. Keys are strings, and values can be strings, booleans or | 94 // in |prefs|. Keys are strings, and values can be strings, booleans or |
92 // integers. Returns true if it succeeded, false otherwise (in which case | 95 // integers. Returns true if it succeeded, false otherwise (in which case |
93 // |prefs| is not filled). | 96 // |prefs| is not filled). |
94 // Note: for strings, only valid UTF-8 string values are supported. If a | 97 // Note: for strings, only valid UTF-8 string values are supported. If a |
95 // key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|. | 98 // key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|. |
96 bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs); | 99 bool ParsePrefFile(const FilePath& pref_file, base::DictionaryValue* prefs); |
97 | 100 |
98 // Parses the value of a particular firefox preference from a string that is the | 101 // Parses the value of a particular firefox preference from a string that is the |
99 // contents of the prefs file. | 102 // contents of the prefs file. |
100 std::string GetPrefsJsValue(const std::string& prefs, | 103 std::string GetPrefsJsValue(const std::string& prefs, |
101 const std::string& pref_key); | 104 const std::string& pref_key); |
102 | 105 |
103 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ | 106 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ |
OLD | NEW |