summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/chrome_browser_main.cc12
-rw-r--r--chrome/browser/first_run/first_run.cc4
-rw-r--r--chrome/browser/first_run/first_run.h5
-rw-r--r--chrome/browser/prefs/browser_prefs.cc2
-rw-r--r--chrome/browser/ui/startup/default_browser_prompt.cc28
-rw-r--r--chrome/browser/ui/startup/default_browser_prompt.h3
-rw-r--r--chrome/common/pref_names.cc5
-rw-r--r--chrome/common/pref_names.h2
-rw-r--r--chrome/installer/util/master_preferences_constants.cc2
-rw-r--r--chrome/installer/util/master_preferences_constants.h3
10 files changed, 65 insertions, 1 deletions
diff --git a/chrome/browser/chrome_browser_main.cc b/chrome/browser/chrome_browser_main.cc
index 10481af..7c8c0a1 100644
--- a/chrome/browser/chrome_browser_main.cc
+++ b/chrome/browser/chrome_browser_main.cc
@@ -932,6 +932,12 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
if (do_first_run_tasks_) {
AddFirstRunNewTabs(browser_creator_.get(), master_prefs_->new_tabs);
+ // TODO(macourteau): refactor preferences that are copied from
+ // master_preferences into local_state, as a "local_state" section in
+ // master preferences. If possible, a generic solution would be prefered
+ // over a copy one-by-one of specific preferences. Also see related TODO
+ // in first_run.h.
+
// Store the initial VariationsService seed in local state, if it exists
// in master prefs.
if (!master_prefs_->variations_seed.empty()) {
@@ -944,6 +950,12 @@ int ChromeBrowserMainParts::PreCreateThreadsImpl() {
local_state_->SetInt64(prefs::kVariationsSeedDate,
base::Time::Now().ToInternalValue());
}
+
+ if (!master_prefs_->suppress_default_browser_prompt_for_version.empty()) {
+ local_state_->SetString(
+ prefs::kBrowserSuppressDefaultBrowserPrompt,
+ master_prefs_->suppress_default_browser_prompt_for_version);
+ }
} else if (parsed_command_line().HasSwitch(switches::kNoFirstRun)) {
// Create the First Run beacon anyways if --no-first-run was passed on the
// command line.
diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc
index bada01d..255a6da 100644
--- a/chrome/browser/first_run/first_run.cc
+++ b/chrome/browser/first_run/first_run.cc
@@ -339,6 +339,10 @@ void SetupMasterPrefsFromInstallPrefs(
}
out_prefs->variations_seed = install_prefs.GetVariationsSeed();
+
+ install_prefs.GetString(
+ installer::master_preferences::kDistroSuppressDefaultBrowserPromptPref,
+ &out_prefs->suppress_default_browser_prompt_for_version);
}
void SetDefaultBrowser(installer::MasterPreferences* install_prefs){
diff --git a/chrome/browser/first_run/first_run.h b/chrome/browser/first_run/first_run.h
index 0867b3a..2bebc46 100644
--- a/chrome/browser/first_run/first_run.h
+++ b/chrome/browser/first_run/first_run.h
@@ -63,6 +63,10 @@ struct MasterPrefs {
MasterPrefs();
~MasterPrefs();
+ // TODO(macourteau): as part of the master preferences refactoring effort,
+ // remove items from here which are being stored temporarily only to be later
+ // dumped into local_state. Also see related TODO in chrome_browser_main.cc.
+
int ping_delay;
bool homepage_defined;
int do_import_items;
@@ -72,6 +76,7 @@ struct MasterPrefs {
std::vector<GURL> new_tabs;
std::vector<GURL> bookmarks;
std::string variations_seed;
+ std::string suppress_default_browser_prompt_for_version;
};
// Returns true if this is the first time chrome is run for this user.
diff --git a/chrome/browser/prefs/browser_prefs.cc b/chrome/browser/prefs/browser_prefs.cc
index 66d83ec..db51151 100644
--- a/chrome/browser/prefs/browser_prefs.cc
+++ b/chrome/browser/prefs/browser_prefs.cc
@@ -77,6 +77,7 @@
#include "chrome/browser/ui/prefs/prefs_tab_helper.h"
#include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
#include "chrome/browser/ui/startup/autolaunch_prompt.h"
+#include "chrome/browser/ui/startup/default_browser_prompt.h"
#include "chrome/browser/ui/tabs/pinned_tab_codec.h"
#include "chrome/browser/ui/webui/extensions/extension_settings_handler.h"
#include "chrome/browser/ui/webui/flags_ui.h"
@@ -231,6 +232,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) {
BackgroundModeManager::RegisterPrefs(registry);
chrome_variations::VariationsService::RegisterPrefs(registry);
RegisterBrowserPrefs(registry);
+ RegisterDefaultBrowserPromptPrefs(registry);
ManagedMode::RegisterPrefs(registry);
#endif
diff --git a/chrome/browser/ui/startup/default_browser_prompt.cc b/chrome/browser/ui/startup/default_browser_prompt.cc
index a4b783d..8a33e7c 100644
--- a/chrome/browser/ui/startup/default_browser_prompt.cc
+++ b/chrome/browser/ui/startup/default_browser_prompt.cc
@@ -7,7 +7,9 @@
#include "base/memory/weak_ptr.h"
#include "base/message_loop.h"
#include "base/metrics/histogram.h"
+#include "base/prefs/pref_registry_simple.h"
#include "base/prefs/pref_service.h"
+#include "base/version.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
@@ -17,7 +19,10 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
+#include "chrome/common/chrome_version_info.h"
#include "chrome/common/pref_names.h"
+#include "chrome/installer/util/master_preferences.h"
+#include "chrome/installer/util/master_preferences_constants.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/navigation_details.h"
#include "content/public/browser/web_contents.h"
@@ -210,10 +215,17 @@ void CheckDefaultBrowserCallback(chrome::HostDesktopType desktop_type) {
namespace chrome {
+void RegisterDefaultBrowserPromptPrefs(PrefRegistrySimple* registry) {
+ registry->RegisterStringPref(
+ prefs::kBrowserSuppressDefaultBrowserPrompt, std::string());
+}
+
void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type) {
// We do not check if we are the default browser if:
- // - the user said "don't ask me again" on the infobar earlier.
+ // - The user said "don't ask me again" on the infobar earlier.
// - There is a policy in control of this setting.
+ // - The "suppress_default_browser_prompt_for_version" master preference is
+ // set to the current version.
if (!profile->GetPrefs()->GetBoolean(prefs::kCheckDefaultBrowser))
return;
@@ -231,6 +243,20 @@ void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type) {
}
return;
}
+
+ const std::string disable_version_string =
+ g_browser_process->local_state()->GetString(
+ prefs::kBrowserSuppressDefaultBrowserPrompt);
+ const Version disable_version(disable_version_string);
+
+ DCHECK(disable_version_string.empty() || disable_version.IsValid());
+ if (disable_version.IsValid()) {
+ const chrome::VersionInfo version_info;
+ const Version chrome_version(version_info.Version());
+ if (disable_version.Equals(chrome_version))
+ return;
+ }
+
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
base::Bind(&CheckDefaultBrowserCallback,
desktop_type));
diff --git a/chrome/browser/ui/startup/default_browser_prompt.h b/chrome/browser/ui/startup/default_browser_prompt.h
index e75cfd6..6cd7c57 100644
--- a/chrome/browser/ui/startup/default_browser_prompt.h
+++ b/chrome/browser/ui/startup/default_browser_prompt.h
@@ -7,10 +7,13 @@
#include "chrome/browser/ui/host_desktop.h"
+class PrefRegistrySimple;
class Profile;
namespace chrome {
+void RegisterDefaultBrowserPromptPrefs(PrefRegistrySimple* registry);
+
// Shows a prompt UI to set the default browser if necessary.
void ShowDefaultBrowserPrompt(Profile* profile, HostDesktopType desktop_type);
diff --git a/chrome/common/pref_names.cc b/chrome/common/pref_names.cc
index fbd98ad..ec300112 100644
--- a/chrome/common/pref_names.cc
+++ b/chrome/common/pref_names.cc
@@ -1411,6 +1411,11 @@ const char kUninstallLastLaunchTimeSec[] =
const char kUninstallLastObservedRunTimeSec[] =
"uninstall_metrics.last_observed_running_time_sec";
+// String containing the version of Chrome for which Chrome will not prompt the
+// user about setting Chrome as the default browser.
+const char kBrowserSuppressDefaultBrowserPrompt[] =
+ "browser.suppress_default_browser_prompt_for_version";
+
// A collection of position, size, and other data relating to the browser
// window to restore on startup.
const char kBrowserWindowPlacement[] = "browser.window_placement";
diff --git a/chrome/common/pref_names.h b/chrome/common/pref_names.h
index 5b44e9b..5ce6894 100644
--- a/chrome/common/pref_names.h
+++ b/chrome/common/pref_names.h
@@ -498,6 +498,8 @@ extern const char kUninstallMetricsUptimeSec[];
extern const char kUninstallLastLaunchTimeSec[];
extern const char kUninstallLastObservedRunTimeSec[];
+extern const char kBrowserSuppressDefaultBrowserPrompt[];
+
extern const char kBrowserWindowPlacement[];
extern const char kTaskManagerWindowPlacement[];
extern const char kKeywordEditorWindowPlacement[];
diff --git a/chrome/installer/util/master_preferences_constants.cc b/chrome/installer/util/master_preferences_constants.cc
index cfcf3f9..c24bfcd 100644
--- a/chrome/installer/util/master_preferences_constants.cc
+++ b/chrome/installer/util/master_preferences_constants.cc
@@ -25,6 +25,8 @@ namespace master_preferences {
const char kDistroImportHomePagePref[] = "import_home_page";
const char kDistroImportSearchPref[] = "import_search_engine";
const char kDistroPingDelay[] = "ping_delay";
+ const char kDistroSuppressDefaultBrowserPromptPref[] =
+ "suppress_default_browser_prompt_for_version";
const char kDistroSuppressFirstRunBubble[] = "suppress_first_run_bubble";
const char kDoNotCreateAnyShortcuts[] = "do_not_create_any_shortcuts";
const char kDoNotCreateDesktopShortcut[] = "do_not_create_desktop_shortcut";
diff --git a/chrome/installer/util/master_preferences_constants.h b/chrome/installer/util/master_preferences_constants.h
index c4ae615..02f2c97 100644
--- a/chrome/installer/util/master_preferences_constants.h
+++ b/chrome/installer/util/master_preferences_constants.h
@@ -55,6 +55,9 @@ extern const char kDistroImportHomePagePref[];
extern const char kDistroImportSearchPref[];
// Integer. RLZ ping delay in seconds.
extern const char kDistroPingDelay[];
+// String of Chrome version for which the "set as default browser" infobar will
+// never be shown.
+extern const char kDistroSuppressDefaultBrowserPromptPref[];
// Boolean. Do not show first run bubble, even if it would otherwise be shown.
extern const char kDistroSuppressFirstRunBubble[];
// Boolean. Prevent creation of all shortcuts to chrome, including the