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

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

Issue 204051: Fix crash during import by checking for errors and exiting early. (Closed)
Patch Set: Created 11 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
« no previous file with comments | « no previous file | chrome/browser/importer/importer.cc » ('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) 2006-2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2009 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 std::wstring EncodeImportParams(int browser_type, int options, HWND window) { 513 std::wstring EncodeImportParams(int browser_type, int options, HWND window) {
514 return StringPrintf(L"%d@%d@%d", browser_type, options, window); 514 return StringPrintf(L"%d@%d@%d", browser_type, options, window);
515 } 515 }
516 516
517 bool DecodeImportParams(const std::wstring& encoded, 517 bool DecodeImportParams(const std::wstring& encoded,
518 int* browser_type, int* options, HWND* window) { 518 int* browser_type, int* options, HWND* window) {
519 std::vector<std::wstring> v; 519 std::vector<std::wstring> v;
520 SplitString(encoded, L'@', &v); 520 SplitString(encoded, L'@', &v);
521 if (v.size() != 3) 521 if (v.size() != 3)
522 return false; 522 return false;
523 *browser_type = static_cast<int>(StringToInt64(v[0])); 523
524 *options = static_cast<int>(StringToInt64(v[1])); 524 if (!StringToInt(v[0], browser_type))
525 return false;
526
527 if (!StringToInt(v[1], options))
528 return false;
529
cpu_(ooo_6.6-7.5) 2009/09/21 21:28:54 the originals have '64' in them...
525 *window = reinterpret_cast<HWND>(StringToInt64(v[2])); 530 *window = reinterpret_cast<HWND>(StringToInt64(v[2]));
526 return true; 531 return true;
527 } 532 }
528 533
529 } // namespace 534 } // namespace
530 535
531 bool FirstRun::ImportSettings(Profile* profile, int browser_type, 536 bool FirstRun::ImportSettings(Profile* profile, int browser_type,
532 int items_to_import, HWND parent_window) { 537 int items_to_import, HWND parent_window) {
533 const CommandLine& cmdline = *CommandLine::ForCurrentProcess(); 538 const CommandLine& cmdline = *CommandLine::ForCurrentProcess();
534 CommandLine import_cmd(cmdline.program()); 539 CommandLine import_cmd(cmdline.program());
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 922
918 DISALLOW_COPY_AND_ASSIGN(TryChromeDialog); 923 DISALLOW_COPY_AND_ASSIGN(TryChromeDialog);
919 }; 924 };
920 925
921 } // namespace 926 } // namespace
922 927
923 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) { 928 Upgrade::TryResult Upgrade::ShowTryChromeDialog(size_t version) {
924 TryChromeDialog td(version); 929 TryChromeDialog td(version);
925 return td.ShowModal(); 930 return td.ShowModal();
926 } 931 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/importer/importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698