OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
12 #include "webkit/glue/password_form.h" | 12 #include "webkit/glue/password_form.h" |
13 | 13 |
14 class GURL; | 14 class GURL; |
15 class TemplateURL; | 15 class TemplateURL; |
16 | 16 |
| 17 #if defined(OS_WIN) |
17 // Detects which version of Firefox is installed from registry. Returns its | 18 // Detects which version of Firefox is installed from registry. Returns its |
18 // major version, and drops the minor version. Returns 0 if | 19 // major version, and drops the minor version. Returns 0 if |
19 // failed. If there are indicators of both FF2 and FF3 it is | 20 // failed. If there are indicators of both FF2 and FF3 it is |
20 // biased to return the biggest version. | 21 // biased to return the biggest version. |
21 int GetCurrentFirefoxMajorVersion(); | 22 int GetCurrentFirefoxMajorVersionFromRegistry(); |
| 23 |
| 24 // Detects where Firefox lives. Returns a empty string if Firefox |
| 25 // is not installed. |
| 26 std::wstring GetFirefoxInstallPathFromRegistry(); |
| 27 #endif |
22 | 28 |
23 #if defined(OS_WIN) || defined(OS_LINUX) | 29 #if defined(OS_WIN) || defined(OS_LINUX) |
24 // Detects version of Firefox and installation path from given Firefox profile | 30 // Detects version of Firefox and installation path from given Firefox profile |
25 bool GetFirefoxVersionAndPathFromProfile(const std::wstring& profile_path, | 31 bool GetFirefoxVersionAndPathFromProfile(const std::wstring& profile_path, |
26 int* version, | 32 int* version, |
27 std::wstring* app_path); | 33 std::wstring* app_path); |
28 | 34 |
29 // Gets the full path of the profiles.ini file. This file records | 35 // Gets the full path of the profiles.ini file. This file records |
30 // the profiles that can be used by Firefox. Returns an empty | 36 // the profiles that can be used by Firefox. Returns an empty |
31 // string if failed. | 37 // string if failed. |
32 FilePath GetProfilesINI(); | 38 FilePath GetProfilesINI(); |
33 | 39 |
34 // Parses the profile.ini file, and stores its information in |root|. | 40 // Parses the profile.ini file, and stores its information in |root|. |
35 // This file is a plain-text file. Key/value pairs are stored one per | 41 // This file is a plain-text file. Key/value pairs are stored one per |
36 // line, and they are separeated in different sections. For example: | 42 // line, and they are separeated in different sections. For example: |
37 // [General] | 43 // [General] |
38 // StartWithLastProfile=1 | 44 // StartWithLastProfile=1 |
39 // | 45 // |
40 // [Profile0] | 46 // [Profile0] |
41 // Name=default | 47 // Name=default |
42 // IsRelative=1 | 48 // IsRelative=1 |
43 // Path=Profiles/abcdefeg.default | 49 // Path=Profiles/abcdefeg.default |
44 // We set "[value]" in path "<Section>.<Key>". For example, the path | 50 // We set "[value]" in path "<Section>.<Key>". For example, the path |
45 // "Genenral.StartWithLastProfile" has the value "1". | 51 // "Genenral.StartWithLastProfile" has the value "1". |
46 void ParseProfileINI(std::wstring file, DictionaryValue* root); | 52 void ParseProfileINI(std::wstring file, DictionaryValue* root); |
47 #endif | 53 #endif |
48 | 54 |
49 // Detects where Firefox lives. Returns a empty string if Firefox | |
50 // is not installed. | |
51 std::wstring GetFirefoxInstallPath(); | |
52 | |
53 // Returns true if we want to add the URL to the history. We filter | 55 // Returns true if we want to add the URL to the history. We filter |
54 // out the URL with a unsupported scheme. | 56 // out the URL with a unsupported scheme. |
55 bool CanImportURL(const GURL& url); | 57 bool CanImportURL(const GURL& url); |
56 | 58 |
57 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| | 59 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| |
58 // with the resulting TemplateURLs. | 60 // with the resulting TemplateURLs. |
59 void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files, | 61 void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files, |
60 std::vector<TemplateURL*>* search_engines); | 62 std::vector<TemplateURL*>* search_engines); |
61 | 63 |
62 // Returns the index of the default search engine in the |search_engines| list. | 64 // Returns the index of the default search engine in the |search_engines| list. |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 HMODULE softokn3_dll_; | 216 HMODULE softokn3_dll_; |
215 #endif | 217 #endif |
216 | 218 |
217 // True if NSS_Init() has been called | 219 // True if NSS_Init() has been called |
218 bool is_nss_initialized_; | 220 bool is_nss_initialized_; |
219 | 221 |
220 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); | 222 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); |
221 }; | 223 }; |
222 | 224 |
223 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ | 225 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ |
OLD | NEW |