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

Unified Diff: chrome/browser/chromeos/first_run/goodies_displayer.cc

Issue 2519173003: Do not display goodies with --no-first-run. (Closed)
Patch Set: rename Created 4 years, 1 month 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 | « no previous file | chrome/browser/chromeos/first_run/goodies_displayer_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/first_run/goodies_displayer.cc
diff --git a/chrome/browser/chromeos/first_run/goodies_displayer.cc b/chrome/browser/chromeos/first_run/goodies_displayer.cc
index 94c1d44eb35305189fcc24068bdf380b18fd3be3..01b02d74119ddbfff0ce46a4517d6fea601bd999 100644
--- a/chrome/browser/chromeos/first_run/goodies_displayer.cc
+++ b/chrome/browser/chromeos/first_run/goodies_displayer.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/chromeos/first_run/goodies_displayer.h"
+#include "base/command_line.h"
#include "base/location.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -14,6 +15,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_tabstrip.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "components/prefs/pref_service.h"
#include "content/public/browser/browser_thread.h"
@@ -116,9 +118,17 @@ void GoodiesDisplayer::OnBrowserSetLastActive(Browser* browser) {
// 3. Not previously shown, or otherwise marked as unavailable.
if (local_state->GetBoolean(prefs::kCanShowOobeGoodiesPage)) {
// 4. Device not enterprise enrolled.
- if (!g_browser_process->platform_part()
- ->browser_policy_connector_chromeos()
- ->IsEnterpriseManaged())
+ const bool enterprise_managed = g_browser_process->platform_part()
+ ->browser_policy_connector_chromeos()
+ ->IsEnterpriseManaged();
+ // 5. --no-first-run not specified, as it is for tests. --force-run takes
+ // precedence over --no-first-run.
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ const bool first_run_permitted =
+ command_line->HasSwitch(switches::kForceFirstRun) ||
+ !command_line->HasSwitch(switches::kNoFirstRun);
+
+ if (!enterprise_managed && first_run_permitted)
chrome::AddTabAt(browser, GURL(kGoodiesURL), 2, false);
// Set to |false| whether enterprise enrolled or Goodies shown.
« no previous file with comments | « no previous file | chrome/browser/chromeos/first_run/goodies_displayer_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698