| 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 #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 <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 #if defined(OS_MACOSX) | 30 #if defined(OS_MACOSX) |
| 31 | 31 |
| 32 // Get the directory in which the Firefox .dylibs live, we need to load these | 32 // Get the directory in which the Firefox .dylibs live, we need to load these |
| 33 // in order to decoded FF profile passwords. | 33 // in order to decoded FF profile passwords. |
| 34 // The Path is usuall FF App Bundle/Contents/Mac OS/ | 34 // The Path is usuall FF App Bundle/Contents/Mac OS/ |
| 35 // Returns empty path on failure. | 35 // Returns empty path on failure. |
| 36 FilePath GetFirefoxDylibPath(); | 36 FilePath GetFirefoxDylibPath(); |
| 37 #endif // OS_MACOSX | 37 #endif // OS_MACOSX |
| 38 | 38 |
| 39 // Detects version of Firefox and installation path from given Firefox profile | 39 // Detects version of Firefox and installation path from given Firefox profile |
| 40 bool GetFirefoxVersionAndPathFromProfile(const std::wstring& profile_path, | 40 bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path, |
| 41 int* version, | 41 int* version, |
| 42 std::wstring* app_path); | 42 FilePath* app_path); |
| 43 | 43 |
| 44 // Gets the full path of the profiles.ini file. This file records | 44 // Gets the full path of the profiles.ini file. This file records |
| 45 // the profiles that can be used by Firefox. Returns an empty | 45 // the profiles that can be used by Firefox. Returns an empty |
| 46 // string if failed. | 46 // string if failed. |
| 47 FilePath GetProfilesINI(); | 47 FilePath GetProfilesINI(); |
| 48 | 48 |
| 49 // Parses the profile.ini file, and stores its information in |root|. | 49 // Parses the profile.ini file, and stores its information in |root|. |
| 50 // This file is a plain-text file. Key/value pairs are stored one per | 50 // This file is a plain-text file. Key/value pairs are stored one per |
| 51 // line, and they are separeated in different sections. For example: | 51 // line, and they are separeated in different sections. For example: |
| 52 // [General] | 52 // [General] |
| 53 // StartWithLastProfile=1 | 53 // StartWithLastProfile=1 |
| 54 // | 54 // |
| 55 // [Profile0] | 55 // [Profile0] |
| 56 // Name=default | 56 // Name=default |
| 57 // IsRelative=1 | 57 // IsRelative=1 |
| 58 // Path=Profiles/abcdefeg.default | 58 // Path=Profiles/abcdefeg.default |
| 59 // We set "[value]" in path "<Section>.<Key>". For example, the path | 59 // We set "[value]" in path "<Section>.<Key>". For example, the path |
| 60 // "Genenral.StartWithLastProfile" has the value "1". | 60 // "Genenral.StartWithLastProfile" has the value "1". |
| 61 void ParseProfileINI(std::wstring file, DictionaryValue* root); | 61 void ParseProfileINI(const FilePath& file, DictionaryValue* root); |
| 62 | 62 |
| 63 // Returns true if we want to add the URL to the history. We filter | 63 // Returns true if we want to add the URL to the history. We filter |
| 64 // out the URL with a unsupported scheme. | 64 // out the URL with a unsupported scheme. |
| 65 bool CanImportURL(const GURL& url); | 65 bool CanImportURL(const GURL& url); |
| 66 | 66 |
| 67 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| | 67 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| |
| 68 // with the resulting TemplateURLs. | 68 // with the resulting TemplateURLs. |
| 69 void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files, | 69 void ParseSearchEnginesFromXMLFiles(const std::vector<std::wstring>& xml_files, |
| 70 std::vector<TemplateURL*>* search_engines); | 70 std::vector<TemplateURL*>* search_engines); |
| 71 | 71 |
| 72 // Returns the index of the default search engine in the |search_engines| list. | 72 // Returns the index of the default search engine in the |search_engines| list. |
| 73 // If none is found, -1 is returned. | 73 // If none is found, -1 is returned. |
| 74 int GetFirefoxDefaultSearchEngineIndex( | 74 int GetFirefoxDefaultSearchEngineIndex( |
| 75 const std::vector<TemplateURL*>& search_engines, | 75 const std::vector<TemplateURL*>& search_engines, |
| 76 const std::wstring& profile_path); | 76 const std::wstring& profile_path); |
| 77 | 77 |
| 78 // Returns the home page set in Firefox in a particular profile. | 78 // Returns the home page set in Firefox in a particular profile. |
| 79 GURL GetHomepage(const std::wstring& profile_path); | 79 GURL GetHomepage(const std::wstring& profile_path); |
| 80 | 80 |
| 81 // Checks to see if this home page is a default home page, as specified by | 81 // Checks to see if this home page is a default home page, as specified by |
| 82 // the resource file browserconfig.properties in the Firefox application | 82 // the resource file browserconfig.properties in the Firefox application |
| 83 // directory. | 83 // directory. |
| 84 bool IsDefaultHomepage(const GURL& homepage, const std::wstring& app_path); | 84 bool IsDefaultHomepage(const GURL& homepage, const std::wstring& app_path); |
| 85 | 85 |
| 86 | 86 |
| 87 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ | 87 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ |
| OLD | NEW |