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 #include "chrome/common/importer/firefox_importer_utils.h" | 5 #include "chrome/common/importer/firefox_importer_utils.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
108 for (size_t i = 0; i < lines.size(); ++i) { | 108 for (size_t i = 0; i < lines.size(); ++i) { |
109 const std::string& line = lines[i]; | 109 const std::string& line = lines[i]; |
110 if (line.empty() || line[0] == '#' || line[0] == ';') | 110 if (line.empty() || line[0] == '#' || line[0] == ';') |
111 continue; | 111 continue; |
112 size_t equal = line.find('='); | 112 size_t equal = line.find('='); |
113 if (equal != std::string::npos) { | 113 if (equal != std::string::npos) { |
114 std::string key = line.substr(0, equal); | 114 std::string key = line.substr(0, equal); |
115 if (key == "LastVersion") { | 115 if (key == "LastVersion") { |
116 base::StringToInt(line.substr(equal + 1), version); | 116 base::StringToInt(line.substr(equal + 1), version); |
117 ret = true; | 117 ret = true; |
118 } else if (key == "LastAppDir") { | 118 } else if (key == "LastPlatformDir") { |
Ilya Sherman
2013/12/17 23:04:14
Two questions:
(1) Does this work for all version
mpawlowski
2013/12/18 08:50:29
I've looked at Firefox's sources, and the code tha
Ilya Sherman
2013/12/18 20:04:21
Lovely. Thanks for doing the deep investigation t
jeremy
2013/12/18 20:16:08
I understand that this matches what we want and ha
| |
119 // TODO(evanm): If the path in question isn't convertible to | 119 // TODO(evanm): If the path in question isn't convertible to |
120 // UTF-8, what does Firefox do? If it puts raw bytes in the | 120 // UTF-8, what does Firefox do? If it puts raw bytes in the |
121 // file, we could go straight from bytes -> filepath; | 121 // file, we could go straight from bytes -> filepath; |
122 // otherwise, we're out of luck here. | 122 // otherwise, we're out of luck here. |
123 *app_path = base::FilePath::FromUTF8Unsafe(line.substr(equal + 1)); | 123 *app_path = base::FilePath::FromUTF8Unsafe(line.substr(equal + 1)); |
124 } | 124 } |
125 } | 125 } |
126 } | 126 } |
127 return ret; | 127 return ret; |
128 } | 128 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
277 } | 277 } |
278 } | 278 } |
279 } | 279 } |
280 } | 280 } |
281 | 281 |
282 StringToLowerASCII(&branding_name); | 282 StringToLowerASCII(&branding_name); |
283 if (branding_name.find("iceweasel") != std::string::npos) | 283 if (branding_name.find("iceweasel") != std::string::npos) |
284 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL); | 284 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_ICEWEASEL); |
285 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX); | 285 return l10n_util::GetStringUTF16(IDS_IMPORT_FROM_FIREFOX); |
286 } | 286 } |
OLD | NEW |