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

Unified Diff: chrome/browser/first_run/first_run_gtk.cc

Issue 3148001: Reworked Avi's patch for master prefs implemented on mac to work with new fir... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/first_run/first_run.cc ('k') | chrome/browser/first_run/first_run_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/first_run/first_run_gtk.cc
===================================================================
--- chrome/browser/first_run/first_run_gtk.cc (revision 57069)
+++ chrome/browser/first_run/first_run_gtk.cc (working copy)
@@ -5,6 +5,7 @@
#include "chrome/browser/first_run/first_run.h"
#include "app/app_switches.h"
+#include "base/command_line.h"
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
@@ -14,14 +15,11 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/gtk/first_run_dialog.h"
-#include "chrome/browser/profile_manager.h"
#include "chrome/browser/shell_integration.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/result_codes.h"
#include "chrome/installer/util/google_update_settings.h"
-#include "chrome/installer/util/master_preferences.h"
-#include "chrome/installer/util/util_constants.h"
#include "googleurl/src/gurl.h"
// TODO(estade): pay attention to the args between |profile| and
@@ -36,91 +34,6 @@
return FirstRunDialog::Show(profile, process_singleton);
}
-FilePath GetDefaultPrefFilePath(bool create_profile_dir,
- const FilePath& user_data_dir) {
- FilePath default_pref_dir =
- ProfileManager::GetDefaultProfileDir(user_data_dir);
- if (create_profile_dir) {
- if (!file_util::PathExists(default_pref_dir)) {
- if (!file_util::CreateDirectory(default_pref_dir))
- return FilePath();
- }
- }
- return ProfileManager::GetProfilePrefsPath(default_pref_dir);
-}
-
-bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
- MasterPrefs* out_prefs) {
- DCHECK(!user_data_dir.empty());
-
- // The standard location of the master prefs is next to the chrome binary.
- FilePath master_prefs;
- if (!PathService::Get(base::DIR_EXE, &master_prefs))
- return true;
- master_prefs = master_prefs.AppendASCII(installer_util::kDefaultMasterPrefs);
-
- scoped_ptr<DictionaryValue> prefs(
- installer_util::ParseDistributionPreferences(master_prefs));
- if (!prefs.get())
- return true;
-
- out_prefs->new_tabs = installer_util::GetFirstRunTabs(prefs.get());
-
- std::string not_used;
- out_prefs->homepage_defined = prefs->GetString(prefs::kHomePage, &not_used);
-
- bool value = false;
- if (installer_util::GetDistroBooleanPreference(prefs.get(),
- installer_util::master_preferences::kAltFirstRunBubble, &value) && value)
- FirstRun::SetOEMFirstRunBubblePref();
-
- FilePath user_prefs = GetDefaultPrefFilePath(true, user_data_dir);
- if (user_prefs.empty())
- return true;
-
- // The master prefs are regular prefs so we can just copy the file
- // to the default place and they just work.
- if (!file_util::CopyFile(master_prefs, user_prefs))
- return true;
-
- // Note we are skipping all other master preferences if skip-first-run-ui
- // is *not* specified.
- if (!installer_util::GetDistroBooleanPreference(prefs.get(),
- installer_util::master_preferences::kDistroSkipFirstRunPref, &value) ||
- !value)
- return true;
-
- // From here on we won't show first run so we need to do the work to set the
- // required state given that FirstRunView is not going to be called.
- FirstRun::SetShowFirstRunBubblePref(true);
-
- if (installer_util::GetDistroBooleanPreference(prefs.get(),
- installer_util::master_preferences::kDistroShowWelcomePage, &value) &&
- value)
- FirstRun::SetShowWelcomePagePref();
-
- // We need to be able to create the first run sentinel or else we cannot
- // proceed because ImportSettings will launch the importer process which
- // would end up here if the sentinel is not present.
- if (!FirstRun::CreateSentinel())
- return false;
-
- std::string import_bookmarks_path;
- installer_util::GetDistroStringPreference(prefs.get(),
- installer_util::master_preferences::kDistroImportBookmarksFromFilePref,
- &import_bookmarks_path);
-
- if (!import_bookmarks_path.empty()) {
- // There are bookmarks to import from a file.
- FilePath path = FilePath::FromWStringHack(
- UTF8ToWide(import_bookmarks_path));
- if (!FirstRun::ImportBookmarks(path)) {
- LOG(WARNING) << "silent bookmark import failed";
- }
- }
- return false;
-}
-
// TODO(port): This is just a piece of the silent import functionality from
// ImportSettings for Windows. It would be nice to get the rest of it ported.
bool FirstRun::ImportBookmarks(const FilePath& import_bookmarks_path) {
« no previous file with comments | « chrome/browser/first_run/first_run.cc ('k') | chrome/browser/first_run/first_run_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698