#include "chrome/common/importer/firefox_importer_utils.h"
#include <stddef.h>
#include <algorithm>
#include <map>
#include <string>
#include <string_view>
#include "base/files/file_util.h"
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/common/ini_parser.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
namespace {
base::FilePath GetProfilePath(const base::Value::Dict& root,
const std::string& profile_name) { … }
}
std::vector<FirefoxDetail> GetFirefoxDetails(
const std::string& firefox_install_id) { … }
std::vector<FirefoxDetail> GetFirefoxDetailsFromDictionary(
const base::Value::Dict& root,
const std::string& firefox_install_id) { … }
#if BUILDFLAG(IS_MAC)
bool ComposeMacAppPath(const std::string& path_from_file,
base::FilePath* output) {
std::vector<base::FilePath::StringType> path_components =
base::FilePath(path_from_file).GetComponents();
if (path_components.empty())
return false;
*output = base::FilePath(path_components[0]);
for (size_t i = 1; i < path_components.size(); ++i) {
*output = output->Append(path_components[i]);
if (base::EndsWith(path_components[i], ".app",
base::CompareCase::SENSITIVE)) {
*output = output->Append("Contents");
*output = output->Append("MacOS");
return true;
}
}
LOG(ERROR) << path_from_file << " doesn't look like a valid Firefox "
<< "installation path: missing /*.app/ directory.";
return false;
}
#endif
bool GetFirefoxVersionAndPathFromProfile(const base::FilePath& profile_path,
int* version,
base::FilePath* app_path) { … }
bool ReadPrefFile(const base::FilePath& path, std::string* content) { … }
std::string ReadBrowserConfigProp(const base::FilePath& app_path,
const std::string& pref_key) { … }
std::string ReadPrefsJsValue(const base::FilePath& profile_path,
const std::string& pref_key) { … }
GURL GetHomepage(const base::FilePath& profile_path) { … }
bool IsDefaultHomepage(const GURL& homepage, const base::FilePath& app_path) { … }
std::string GetPrefsJsValue(const std::string& content,
const std::string& pref_key) { … }
std::u16string GetFirefoxImporterName(const base::FilePath& app_path) { … }