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

Side by Side Diff: chrome/browser/importer/ie_importer.cc

Issue 14143010: Introduce IEImporterTestRegistryOverrider to be able to override the registry for a test and flag t… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge Created 7 years, 7 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
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/importer/ie_importer.h" 5 #include "chrome/browser/importer/ie_importer.h"
6 6
7 #include <ole2.h> 7 #include <ole2.h>
8 #include <intshcut.h> 8 #include <intshcut.h>
9 #include <shlobj.h> 9 #include <shlobj.h>
10 #include <urlhist.h> 10 #include <urlhist.h>
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 412
413 IEImporter::IEImporter() { 413 IEImporter::IEImporter() {
414 } 414 }
415 415
416 void IEImporter::StartImport(const importer::SourceProfile& source_profile, 416 void IEImporter::StartImport(const importer::SourceProfile& source_profile,
417 uint16 items, 417 uint16 items,
418 ImporterBridge* bridge) { 418 ImporterBridge* bridge) {
419 bridge_ = bridge; 419 bridge_ = bridge;
420 source_path_ = source_profile.source_path; 420 source_path_ = source_profile.source_path;
421 421
422 // If there is indication that an override is required, but we fail to set it,
423 // prefer returning early to running the test with whatever is in the real
424 // registry.
425 if (!test_registry_overrider_.StartRegistryOverrideIfNeeded()) {
426 NOTREACHED();
427 return;
428 }
429
422 bridge_->NotifyStarted(); 430 bridge_->NotifyStarted();
423 431
424 if ((items & importer::HOME_PAGE) && !cancelled()) 432 if ((items & importer::HOME_PAGE) && !cancelled())
425 ImportHomepage(); // Doesn't have a UI item. 433 ImportHomepage(); // Doesn't have a UI item.
426 // The order here is important! 434 // The order here is important!
427 if ((items & importer::HISTORY) && !cancelled()) { 435 if ((items & importer::HISTORY) && !cancelled()) {
428 bridge_->NotifyItemStarted(importer::HISTORY); 436 bridge_->NotifyItemStarted(importer::HISTORY);
429 ImportHistory(); 437 ImportHistory();
430 bridge_->NotifyItemEnded(importer::HISTORY); 438 bridge_->NotifyItemEnded(importer::HISTORY);
431 } 439 }
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 static int version = -1; 892 static int version = -1;
885 if (version < 0) { 893 if (version < 0) {
886 wchar_t buffer[128]; 894 wchar_t buffer[128];
887 DWORD buffer_length = sizeof(buffer); 895 DWORD buffer_length = sizeof(buffer);
888 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 896 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
889 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 897 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
890 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 898 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
891 } 899 }
892 return version; 900 return version;
893 } 901 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/ie_importer.h ('k') | chrome/browser/importer/ie_importer_browsertest_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698