1// Copyright (c) 2011 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#include "chrome/browser/first_run/first_run.h" 6 7#include "base/command_line.h" 8#include "base/file_path.h" 9#include "base/file_util.h" 10#include "base/path_service.h" 11#include "base/process_util.h" 12#include "base/string_piece.h" 13#include "base/string_util.h" 14#include "base/utf_string_conversions.h" 15#include "chrome/browser/browser_process.h" 16#include "chrome/browser/shell_integration.h" 17#include "chrome/common/chrome_switches.h" 18#include "chrome/installer/util/google_update_settings.h" 19#include "content/common/result_codes.h" 20#include "googleurl/src/gurl.h" 21#include "ui/base/ui_base_switches.h" 22 23// TODO(port): This is just a piece of the silent import functionality from 24// ImportSettings for Windows. It would be nice to get the rest of it ported. 25bool FirstRun::ImportBookmarks(const FilePath& import_bookmarks_path) { 26 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); 27 CommandLine import_cmd(cmdline.GetProgram()); 28 29 // Propagate user data directory switch. 30 if (cmdline.HasSwitch(switches::kUserDataDir)) { 31 import_cmd.AppendSwitchPath(switches::kUserDataDir, 32 cmdline.GetSwitchValuePath(switches::kUserDataDir)); 33 } 34 // Since ImportSettings is called before the local state is stored on disk 35 // we pass the language as an argument. GetApplicationLocale checks the 36 // current command line as fallback. 37 import_cmd.AppendSwitchASCII(switches::kLang, 38 g_browser_process->GetApplicationLocale()); 39 40 import_cmd.CommandLine::AppendSwitchPath(switches::kImportFromFile, 41 import_bookmarks_path); 42 // Time to launch the process that is going to do the import. We'll wait 43 // for the process to return. 44 return base::LaunchApp(import_cmd, true, false, NULL); 45} 46 47// static 48bool FirstRun::IsOrganicFirstRun() { 49 // We treat all installs as organic. 50 return true; 51} 52 53// static 54void FirstRun::PlatformSetup() { 55 // Things that Windows does here (creating a desktop icon, for example) are 56 // handled at install time on Linux. 57} 58