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

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

Issue 3847006: If default search is managed, we should not asked the user to choose it at Fi... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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/browser_main.cc ('k') | chrome/browser/first_run/first_run_mac.mm » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 // TODO(port): move more code in back from the first_run_win.cc module. 9 // TODO(port): move more code in back from the first_run_win.cc module.
10 10
11 #if defined(OS_WIN) 11 #if defined(OS_WIN)
12 #include "chrome/installer/util/google_update_settings.h" 12 #include "chrome/installer/util/google_update_settings.h"
13 #include "chrome/installer/util/install_util.h" 13 #include "chrome/installer/util/install_util.h"
14 #endif 14 #endif
15 15
16 #include "base/command_line.h" 16 #include "base/command_line.h"
17 #include "base/file_util.h" 17 #include "base/file_util.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/utf_string_conversions.h" 19 #include "base/utf_string_conversions.h"
20 #include "chrome/browser/importer/importer.h" 20 #include "chrome/browser/importer/importer.h"
21 #include "chrome/browser/metrics/user_metrics.h" 21 #include "chrome/browser/metrics/user_metrics.h"
22 #include "chrome/browser/prefs/pref_service.h" 22 #include "chrome/browser/prefs/pref_service.h"
23 #include "chrome/browser/process_singleton.h" 23 #include "chrome/browser/process_singleton.h"
24 #include "chrome/browser/profile_manager.h" 24 #include "chrome/browser/profile_manager.h"
25 #include "chrome/browser/search_engines/template_url_model.h"
25 #include "chrome/browser/shell_integration.h" 26 #include "chrome/browser/shell_integration.h"
26 #include "chrome/common/chrome_paths.h" 27 #include "chrome/common/chrome_paths.h"
27 #include "chrome/common/chrome_switches.h" 28 #include "chrome/common/chrome_switches.h"
28 #include "chrome/common/pref_names.h" 29 #include "chrome/common/pref_names.h"
29 #include "chrome/installer/util/master_preferences.h" 30 #include "chrome/installer/util/master_preferences.h"
30 #include "chrome/installer/util/util_constants.h" 31 #include "chrome/installer/util/util_constants.h"
31 32
32 namespace { 33 namespace {
33 34
34 // The kSentinelFile file absence will tell us it is a first run. 35 // The kSentinelFile file absence will tell us it is a first run.
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
557 // Bookmarks are never imported, unless turned on in master_preferences. 558 // Bookmarks are never imported, unless turned on in master_preferences.
558 if (import_items & importer::FAVORITES) 559 if (import_items & importer::FAVORITES)
559 items = items | importer::FAVORITES; 560 items = items | importer::FAVORITES;
560 561
561 ImportSettings(profile, importer_host, items); 562 ImportSettings(profile, importer_host, items);
562 } 563 }
563 564
564 UserMetrics::RecordAction(UserMetricsAction("FirstRunDef_Accept")); 565 UserMetrics::RecordAction(UserMetricsAction("FirstRunDef_Accept"));
565 566
566 // Launch the search engine dialog only if build is organic, and user has not 567 // Launch the search engine dialog only if build is organic, and user has not
567 // already set search preferences. 568 // already set preferences.
568 if (IsOrganic() && !local_state_file_exists) { 569 if (IsOrganic() && !local_state_file_exists) {
569 // The home page string may be set in the preferences, but the user should 570 // The home page string may be set in the preferences, but the user should
570 // initially use Chrome with the NTP as home page in organic builds. 571 // initially use Chrome with the NTP as home page in organic builds.
571 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true); 572 profile->GetPrefs()->SetBoolean(prefs::kHomePageIsNewTabPage, true);
572 ShowFirstRunDialog(profile, randomize_search_engine_experiment); 573 ShowFirstRunDialog(profile, randomize_search_engine_experiment);
573 } 574 }
574 575
575 if (make_chrome_default) 576 if (make_chrome_default)
576 ShellIntegration::SetAsDefaultBrowser(); 577 ShellIntegration::SetAsDefaultBrowser();
577 578
578 FirstRun::SetShowFirstRunBubblePref(true); 579 // Don't display the minimal bubble if there is no default search provider.
579 // Set the first run bubble to minimal. 580 TemplateURLModel* search_engines_model = profile->GetTemplateURLModel();
580 FirstRun::SetMinimalFirstRunBubblePref(); 581 if (search_engines_model &&
582 search_engines_model->GetDefaultSearchProvider()) {
583 FirstRun::SetShowFirstRunBubblePref(true);
584 // Set the first run bubble to minimal.
585 FirstRun::SetMinimalFirstRunBubblePref();
586 }
581 FirstRun::SetShowWelcomePagePref(); 587 FirstRun::SetShowWelcomePagePref();
582 FirstRun::SetPersonalDataManagerFirstRunPref(); 588 FirstRun::SetPersonalDataManagerFirstRunPref();
583 589
584 process_singleton->Unlock(); 590 process_singleton->Unlock();
585 FirstRun::CreateSentinel(); 591 FirstRun::CreateSentinel();
586 } 592 }
587 593
588 #if defined(OS_POSIX) 594 #if defined(OS_POSIX)
589 namespace { 595 namespace {
590 596
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 if (!observer->ended()) { 653 if (!observer->ended()) {
648 observer->set_should_quit_message_loop(); 654 observer->set_should_quit_message_loop();
649 MessageLoop::current()->Run(); 655 MessageLoop::current()->Run();
650 } 656 }
651 657
652 // Unfortunately there's no success/fail signal in ImporterHost. 658 // Unfortunately there's no success/fail signal in ImporterHost.
653 return true; 659 return true;
654 } 660 }
655 661
656 #endif // OS_POSIX 662 #endif // OS_POSIX
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.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