Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(339)

Side by Side Diff: chrome/browser/importer/firefox_importer_utils.h

Issue 12163003: Add FilePath to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/icon_manager_linux.cc ('k') | chrome/browser/importer/firefox_proxy_settings.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 14
15 class FilePath;
16 class GURL; 15 class GURL;
17 class TemplateURL; 16 class TemplateURL;
18 17
19 namespace base { 18 namespace base {
20 class DictionaryValue; 19 class DictionaryValue;
20 class FilePath;
21 } 21 }
22 22
23 #if defined(OS_WIN) 23 #if defined(OS_WIN)
24 // Detects which version of Firefox is installed from registry. Returns its 24 // Detects which version of Firefox is installed from registry. Returns its
25 // 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
26 // 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
27 // version. 27 // version.
28 int GetCurrentFirefoxMajorVersionFromRegistry(); 28 int GetCurrentFirefoxMajorVersionFromRegistry();
29 29
30 // 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
31 // installed. 31 // installed.
32 FilePath GetFirefoxInstallPathFromRegistry(); 32 base::FilePath GetFirefoxInstallPathFromRegistry();
33 #endif // OS_WIN 33 #endif // OS_WIN
34 34
35 #if defined(OS_MACOSX) 35 #if defined(OS_MACOSX)
36 // Get the directory in which the Firefox .dylibs live, we need to load these 36 // Get the directory in which the Firefox .dylibs live, we need to load these
37 // in order to decoded FF profile passwords. 37 // in order to decoded FF profile passwords.
38 // The Path is usuall FF App Bundle/Contents/Mac OS/ 38 // The Path is usuall FF App Bundle/Contents/Mac OS/
39 // Returns empty path on failure. 39 // Returns empty path on failure.
40 FilePath GetFirefoxDylibPath(); 40 base::FilePath GetFirefoxDylibPath();
41 #endif // OS_MACOSX 41 #endif // OS_MACOSX
42 42
43 // Returns the path to the Firefox profile. 43 // Returns the path to the Firefox profile.
44 FilePath GetFirefoxProfilePath(); 44 base::FilePath GetFirefoxProfilePath();
45 45
46 // Detects version of Firefox and installation path for the given Firefox 46 // Detects version of Firefox and installation path for the given Firefox
47 // profile. 47 // profile.
48 bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path, 48 bool GetFirefoxVersionAndPathFromProfile(const base::FilePath& profile_path,
49 int* version, 49 int* version,
50 FilePath* app_path); 50 base::FilePath* app_path);
51 51
52 // Gets the full path of the profiles.ini file. This file records the profiles 52 // Gets the full path of the profiles.ini file. This file records the profiles
53 // that can be used by Firefox. Returns an empty path if failed. 53 // that can be used by Firefox. Returns an empty path if failed.
54 FilePath GetProfilesINI(); 54 base::FilePath GetProfilesINI();
55 55
56 // Parses the profile.ini file, and stores its information in |root|. 56 // Parses the profile.ini file, and stores its information in |root|.
57 // This file is a plain-text file. Key/value pairs are stored one per line, and 57 // This file is a plain-text file. Key/value pairs are stored one per line, and
58 // they are separated in different sections. For example: 58 // they are separated in different sections. For example:
59 // [General] 59 // [General]
60 // StartWithLastProfile=1 60 // StartWithLastProfile=1
61 // 61 //
62 // [Profile0] 62 // [Profile0]
63 // Name=default 63 // Name=default
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 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| 74 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines|
75 // with the resulting TemplateURLs. 75 // with the resulting TemplateURLs.
76 void ParseSearchEnginesFromXMLFiles(const std::vector<FilePath>& xml_files, 76 void ParseSearchEnginesFromXMLFiles(const std::vector<base::FilePath>& xml_files ,
77 std::vector<TemplateURL*>* search_engines); 77 std::vector<TemplateURL*>* search_engines);
78 78
79 // Returns the home page set in Firefox in a particular profile. 79 // Returns the home page set in Firefox in a particular profile.
80 GURL GetHomepage(const FilePath& profile_path); 80 GURL GetHomepage(const base::FilePath& profile_path);
81 81
82 // Checks to see if this home page is a default home page, as specified by 82 // 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 83 // the resource file browserconfig.properties in the Firefox application
84 // directory. 84 // directory.
85 bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path); 85 bool IsDefaultHomepage(const GURL& homepage, const base::FilePath& app_path);
86 86
87 // Parses the prefs found in the file |pref_file| and puts the key/value pairs 87 // 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 88 // in |prefs|. Keys are strings, and values can be strings, booleans or
89 // integers. Returns true if it succeeded, false otherwise (in which case 89 // integers. Returns true if it succeeded, false otherwise (in which case
90 // |prefs| is not filled). 90 // |prefs| is not filled).
91 // Note: for strings, only valid UTF-8 string values are supported. If a 91 // 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|. 92 // key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|.
93 bool ParsePrefFile(const FilePath& pref_file, base::DictionaryValue* prefs); 93 bool ParsePrefFile(const base::FilePath& pref_file, base::DictionaryValue* prefs );
94 94
95 // Parses the value of a particular firefox preference from a string that is the 95 // Parses the value of a particular firefox preference from a string that is the
96 // contents of the prefs file. 96 // contents of the prefs file.
97 std::string GetPrefsJsValue(const std::string& prefs, 97 std::string GetPrefsJsValue(const std::string& prefs,
98 const std::string& pref_key); 98 const std::string& pref_key);
99 99
100 // Returns the localized Firefox branding name. 100 // Returns the localized Firefox branding name.
101 // This is useful to differentiate between Firefox and Iceweasel. 101 // This is useful to differentiate between Firefox and Iceweasel.
102 // If anything goes wrong while trying to obtain the branding name, 102 // If anything goes wrong while trying to obtain the branding name,
103 // the function assumes it's Firefox. 103 // the function assumes it's Firefox.
104 string16 GetFirefoxImporterName(const FilePath& app_path); 104 string16 GetFirefoxImporterName(const base::FilePath& app_path);
105 105
106 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_ 106 #endif // CHROME_BROWSER_IMPORTER_FIREFOX_IMPORTER_UTILS_H_
OLDNEW
« no previous file with comments | « chrome/browser/icon_manager_linux.cc ('k') | chrome/browser/importer/firefox_proxy_settings.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698