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

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

Issue 3343001: Merge r58176: Set default browser after import (OS Win).... (Closed) Base URL: svn://svn.chromium.org/chrome/branches/472/src/
Patch Set: '' Created 10 years, 3 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.h ('k') | no next file » | 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.h" 5 #include "chrome/browser/first_run.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 10
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 // Bookmarks are never imported unless specifically turned on. 353 // Bookmarks are never imported unless specifically turned on.
354 if (installer_util::GetDistroBooleanPreference(prefs.get(), 354 if (installer_util::GetDistroBooleanPreference(prefs.get(),
355 installer_util::master_preferences::kDistroImportBookmarksPref, &value) 355 installer_util::master_preferences::kDistroImportBookmarksPref, &value)
356 && value) { 356 && value) {
357 out_prefs->do_import_items |= importer::FAVORITES; 357 out_prefs->do_import_items |= importer::FAVORITES;
358 } 358 }
359 359
360 if (installer_util::GetDistroBooleanPreference(prefs.get(), 360 if (installer_util::GetDistroBooleanPreference(prefs.get(),
361 installer_util::master_preferences::kMakeChromeDefaultForUser, &value) && 361 installer_util::master_preferences::kMakeChromeDefaultForUser, &value) &&
362 value) 362 value)
363 ShellIntegration::SetAsDefaultBrowser(); 363 out_prefs->make_chrome_default = true;
364 364
365 // TODO(mirandac): Refactor skip-first-run-ui process into regular first run 365 // TODO(mirandac): Refactor skip-first-run-ui process into regular first run
366 // import process. http://crbug.com/49647 366 // import process. http://crbug.com/49647
367 // Note we are skipping all other master preferences if skip-first-run-ui 367 // Note we are skipping all other master preferences if skip-first-run-ui
368 // is *not* specified. (That is, we continue only if skipping first run ui.) 368 // is *not* specified. (That is, we continue only if skipping first run ui.)
369 if (!installer_util::GetDistroBooleanPreference(prefs.get(), 369 if (!installer_util::GetDistroBooleanPreference(prefs.get(),
370 installer_util::master_preferences::kDistroSkipFirstRunPref, &value) || 370 installer_util::master_preferences::kDistroSkipFirstRunPref, &value) ||
371 !value) 371 !value)
372 return true; 372 return true;
373 373
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 // There is something to import from the default browser. This launches 410 // There is something to import from the default browser. This launches
411 // the importer process and blocks until done or until it fails. 411 // the importer process and blocks until done or until it fails.
412 scoped_refptr<ImporterHost> importer_host = new ImporterHost(); 412 scoped_refptr<ImporterHost> importer_host = new ImporterHost();
413 if (!FirstRun::ImportSettings(NULL, 413 if (!FirstRun::ImportSettings(NULL,
414 importer_host->GetSourceProfileInfoAt(0).browser_type, 414 importer_host->GetSourceProfileInfoAt(0).browser_type,
415 out_prefs->do_import_items, import_bookmarks_path, true, NULL)) { 415 out_prefs->do_import_items, import_bookmarks_path, true, NULL)) {
416 LOG(WARNING) << "silent import failed"; 416 LOG(WARNING) << "silent import failed";
417 } 417 }
418 } 418 }
419 419
420 if (installer_util::GetDistroBooleanPreference(prefs.get(),
421 installer_util::master_preferences::kMakeChromeDefaultForUser, &value) &&
422 value)
423 ShellIntegration::SetAsDefaultBrowser();
424
420 return false; 425 return false;
421 } 426 }
422 427
423 bool Upgrade::IsBrowserAlreadyRunning() { 428 bool Upgrade::IsBrowserAlreadyRunning() {
424 static HANDLE handle = NULL; 429 static HANDLE handle = NULL;
425 std::wstring exe; 430 std::wstring exe;
426 PathService::Get(base::FILE_EXE, &exe); 431 PathService::Get(base::FILE_EXE, &exe);
427 std::replace(exe.begin(), exe.end(), '\\', '!'); 432 std::replace(exe.begin(), exe.end(), '\\', '!');
428 std::transform(exe.begin(), exe.end(), exe.begin(), tolower); 433 std::transform(exe.begin(), exe.end(), exe.begin(), tolower);
429 exe = L"Global\\" + exe; 434 exe = L"Global\\" + exe;
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 } 626 }
622 627
623 } // namespace 628 } // namespace
624 629
625 void FirstRun::AutoImport(Profile* profile, 630 void FirstRun::AutoImport(Profile* profile,
626 bool homepage_defined, 631 bool homepage_defined,
627 int import_items, 632 int import_items,
628 int dont_import_items, 633 int dont_import_items,
629 bool search_engine_experiment, 634 bool search_engine_experiment,
630 bool randomize_search_engine_experiment, 635 bool randomize_search_engine_experiment,
636 bool make_chrome_default,
631 ProcessSingleton* process_singleton) { 637 ProcessSingleton* process_singleton) {
632 FirstRun::CreateChromeDesktopShortcut(); 638 FirstRun::CreateChromeDesktopShortcut();
633 // Windows 7 has deprecated the quick launch bar. 639 // Windows 7 has deprecated the quick launch bar.
634 if (win_util::GetWinVersion() < win_util::WINVERSION_WIN7) 640 if (win_util::GetWinVersion() < win_util::WINVERSION_WIN7)
635 CreateChromeQuickLaunchShortcut(); 641 CreateChromeQuickLaunchShortcut();
636 642
637 scoped_refptr<ImporterHost> importer_host; 643 scoped_refptr<ImporterHost> importer_host;
638 importer_host = new ImporterHost(); 644 importer_host = new ImporterHost();
639 int items = 0; 645 int items = 0;
640 646
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
699 new FirstRunSearchEngineView(profile, 705 new FirstRunSearchEngineView(profile,
700 randomize_search_engine_experiment)); 706 randomize_search_engine_experiment));
701 DCHECK(search_engine_dialog); 707 DCHECK(search_engine_dialog);
702 708
703 search_engine_dialog->Show(); 709 search_engine_dialog->Show();
704 views::AcceleratorHandler accelerator_handler; 710 views::AcceleratorHandler accelerator_handler;
705 MessageLoopForUI::current()->Run(&accelerator_handler); 711 MessageLoopForUI::current()->Run(&accelerator_handler);
706 search_engine_dialog->Close(); 712 search_engine_dialog->Close();
707 } 713 }
708 714
715 if (make_chrome_default)
716 ShellIntegration::SetAsDefaultBrowser();
717
709 FirstRun::SetShowFirstRunBubblePref(true); 718 FirstRun::SetShowFirstRunBubblePref(true);
710 // Set the first run bubble to minimal. 719 // Set the first run bubble to minimal.
711 FirstRun::SetMinimalFirstRunBubblePref(); 720 FirstRun::SetMinimalFirstRunBubblePref();
712 FirstRun::SetShowWelcomePagePref(); 721 FirstRun::SetShowWelcomePagePref();
713 722
714 process_singleton->Unlock(); 723 process_singleton->Unlock();
715 FirstRun::CreateSentinel(); 724 FirstRun::CreateSentinel();
716 } 725 }
717 726
718 bool FirstRun::ImportSettings(Profile* profile, int browser_type, 727 bool FirstRun::ImportSettings(Profile* profile, int browser_type,
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
1103 1112
1104 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { 1113 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
1105 if (version > 10000) { 1114 if (version > 10000) {
1106 // This is a test value. We want to make sure we exercise 1115 // This is a test value. We want to make sure we exercise
1107 // returning this early. See EarlyReturnTest test harness. 1116 // returning this early. See EarlyReturnTest test harness.
1108 return Upgrade::TD_NOT_NOW; 1117 return Upgrade::TD_NOT_NOW;
1109 } 1118 }
1110 TryChromeDialog td; 1119 TryChromeDialog td;
1111 return td.ShowModal(); 1120 return td.ShowModal();
1112 } 1121 }
OLDNEW
« no previous file with comments | « chrome/browser/first_run.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698