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

Side by Side Diff: chrome/browser/first_run/first_run.cc

Issue 9285002: Remove the first-run search engine dialog/ballot. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Sync and merge. Created 8 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/browser/first_run/first_run_dialog.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/first_run/first_run.h" 5 #include "chrome/browser/first_run/first_run.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 } 154 }
155 #endif 155 #endif
156 156
157 #if !defined(USE_AURA) 157 #if !defined(USE_AURA)
158 void AutoImportPlatformCommon( 158 void AutoImportPlatformCommon(
159 scoped_refptr<ImporterHost> importer_host, 159 scoped_refptr<ImporterHost> importer_host,
160 Profile* profile, 160 Profile* profile,
161 bool homepage_defined, 161 bool homepage_defined,
162 int import_items, 162 int import_items,
163 int dont_import_items, 163 int dont_import_items,
164 bool search_engine_experiment,
165 bool randomize_search_engine_experiment,
166 bool make_chrome_default) { 164 bool make_chrome_default) {
167 FilePath local_state_path; 165 FilePath local_state_path;
168 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path); 166 PathService::Get(chrome::FILE_LOCAL_STATE, &local_state_path);
169 bool local_state_file_exists = file_util::PathExists(local_state_path); 167 bool local_state_file_exists = file_util::PathExists(local_state_path);
170 168
171 scoped_refptr<ImporterList> importer_list(new ImporterList(NULL)); 169 scoped_refptr<ImporterList> importer_list(new ImporterList(NULL));
172 importer_list->DetectSourceProfilesHack(); 170 importer_list->DetectSourceProfilesHack();
173 171
174 // Do import if there is an available profile for us to import. 172 // Do import if there is an available profile for us to import.
175 if (importer_list->count() > 0) { 173 if (importer_list->count() > 0) {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 import_items, 217 import_items,
220 dont_import_items, 218 dont_import_items,
221 importer::FAVORITES, 219 importer::FAVORITES,
222 items); 220 items);
223 221
224 ImportSettings(profile, importer_host, importer_list, items); 222 ImportSettings(profile, importer_host, importer_list, items);
225 } 223 }
226 224
227 content::RecordAction(UserMetricsAction("FirstRunDef_Accept")); 225 content::RecordAction(UserMetricsAction("FirstRunDef_Accept"));
228 226
229 // Launch the search engine dialog only for certain builds, and only if the 227 // Launch the first run dialog only for certain builds, and only if the user
230 // user has not already set preferences. 228 // has not already set preferences.
231 if (IsOrganicFirstRun() && !local_state_file_exists) { 229 if (IsOrganicFirstRun() && !local_state_file_exists) {
232 // The home page string may be set in the preferences, but the user should 230 // The home page string may be set in the preferences, but the user should
233 // initially use Chrome with the NTP as home page in organic builds. 231 // initially use Chrome with the NTP as home page in organic builds.
234 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true); 232 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true);
235 ShowFirstRunDialog(profile, randomize_search_engine_experiment); 233 ShowFirstRunDialog(profile);
236 } 234 }
237 235
238 if (make_chrome_default) 236 if (make_chrome_default)
239 ShellIntegration::SetAsDefaultBrowser(); 237 ShellIntegration::SetAsDefaultBrowser();
240 238
241 // Display the first run bubble if there is a default search provider. 239 // Display the first run bubble if there is a default search provider.
242 TemplateURLService* template_url = 240 TemplateURLService* template_url =
243 TemplateURLServiceFactory::GetForProfile(profile); 241 TemplateURLServiceFactory::GetForProfile(profile);
244 if (template_url && template_url->GetDefaultSearchProvider()) 242 if (template_url && template_url->GetDefaultSearchProvider())
245 SetShowFirstRunBubblePref(true); 243 SetShowFirstRunBubblePref(true);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 return false; 315 return false;
318 if (!local_state->FindPreference( 316 if (!local_state->FindPreference(
319 prefs::kAutofillPersonalDataManagerFirstRun)) { 317 prefs::kAutofillPersonalDataManagerFirstRun)) {
320 local_state->RegisterBooleanPref( 318 local_state->RegisterBooleanPref(
321 prefs::kAutofillPersonalDataManagerFirstRun, false); 319 prefs::kAutofillPersonalDataManagerFirstRun, false);
322 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true); 320 local_state->SetBoolean(prefs::kAutofillPersonalDataManagerFirstRun, true);
323 } 321 }
324 return true; 322 return true;
325 } 323 }
326 324
327 bool ShouldShowSearchEngineSelector(const TemplateURLService* model) {
328 return model && !model->is_default_search_managed();
329 }
330
331 } // namespace first_run 325 } // namespace first_run
332 326
333 // FirstRun ------------------------------------------------------------------- 327 // FirstRun -------------------------------------------------------------------
334 328
335 FirstRun::MasterPrefs::MasterPrefs() 329 FirstRun::MasterPrefs::MasterPrefs()
336 : ping_delay(0), 330 : ping_delay(0),
337 homepage_defined(false), 331 homepage_defined(false),
338 do_import_items(0), 332 do_import_items(0),
339 dont_import_items(0), 333 dont_import_items(0),
340 run_search_engine_experiment(false),
341 randomize_search_engine_experiment(false),
342 make_chrome_default(false) { 334 make_chrome_default(false) {
343 } 335 }
344 336
345 FirstRun::MasterPrefs::~MasterPrefs() {} 337 FirstRun::MasterPrefs::~MasterPrefs() {}
346 338
347 // static 339 // static
348 bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir, 340 bool FirstRun::ProcessMasterPreferences(const FilePath& user_data_dir,
349 MasterPrefs* out_prefs) { 341 MasterPrefs* out_prefs) {
350 DCHECK(!user_data_dir.empty()); 342 DCHECK(!user_data_dir.empty());
351 343
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 410
419 if (prefs.GetBool(installer::master_preferences::kDistroImportSearchPref, 411 if (prefs.GetBool(installer::master_preferences::kDistroImportSearchPref,
420 &value)) { 412 &value)) {
421 if (value) { 413 if (value) {
422 out_prefs->do_import_items |= importer::SEARCH_ENGINES; 414 out_prefs->do_import_items |= importer::SEARCH_ENGINES;
423 } else { 415 } else {
424 out_prefs->dont_import_items |= importer::SEARCH_ENGINES; 416 out_prefs->dont_import_items |= importer::SEARCH_ENGINES;
425 } 417 }
426 } 418 }
427 419
428 // Check to see if search engine logos should be randomized.
429 if (prefs.GetBool(
430 installer::master_preferences::
431 kSearchEngineExperimentRandomizePref,
432 &value) && value) {
433 out_prefs->randomize_search_engine_experiment = true;
434 }
435
436 // If we're suppressing the first-run bubble, set that preference now. 420 // If we're suppressing the first-run bubble, set that preference now.
437 // Otherwise, wait until the user has completed first run to set it, so the 421 // Otherwise, wait until the user has completed first run to set it, so the
438 // user is guaranteed to see the bubble iff he or she has completed the first 422 // user is guaranteed to see the bubble iff he or she has completed the first
439 // run process. 423 // run process.
440 if (prefs.GetBool( 424 if (prefs.GetBool(
441 installer::master_preferences::kDistroSuppressFirstRunBubble, 425 installer::master_preferences::kDistroSuppressFirstRunBubble,
442 &value) && value) 426 &value) && value)
443 first_run::SetShowFirstRunBubblePref(false); 427 first_run::SetShowFirstRunBubblePref(false);
444 428
445 if (prefs.GetBool( 429 if (prefs.GetBool(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 } 550 }
567 } else { 551 } else {
568 if (g_browser_process->local_state()->GetBoolean( 552 if (g_browser_process->local_state()->GetBoolean(
569 prefs::kDefaultBrowserSettingEnabled)) { 553 prefs::kDefaultBrowserSettingEnabled)) {
570 ShellIntegration::SetAsDefaultBrowser(); 554 ShellIntegration::SetAsDefaultBrowser();
571 } 555 }
572 } 556 }
573 557
574 return false; 558 return false;
575 } 559 }
OLDNEW
« no previous file with comments | « chrome/browser/first_run/first_run.h ('k') | chrome/browser/first_run/first_run_dialog.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698