| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 // The order of these includes is important. | 5 // The order of these includes is important. |
| 6 #include <windows.h> | 6 #include <windows.h> |
| 7 #include <unknwn.h> | 7 #include <unknwn.h> |
| 8 #include <intshcut.h> | 8 #include <intshcut.h> |
| 9 #include <shlguid.h> | 9 #include <shlguid.h> |
| 10 #include <urlhist.h> | 10 #include <urlhist.h> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 23 #include "base/stl_util.h" | 23 #include "base/stl_util.h" |
| 24 #include "base/string16.h" | 24 #include "base/string16.h" |
| 25 #include "base/string_util.h" | 25 #include "base/string_util.h" |
| 26 #include "base/utf_string_conversions.h" | 26 #include "base/utf_string_conversions.h" |
| 27 #include "base/win/registry.h" | 27 #include "base/win/registry.h" |
| 28 #include "base/win/scoped_comptr.h" | 28 #include "base/win/scoped_comptr.h" |
| 29 #include "base/win/scoped_propvariant.h" | 29 #include "base/win/scoped_propvariant.h" |
| 30 #include "base/win/windows_version.h" | 30 #include "base/win/windows_version.h" |
| 31 #include "chrome/browser/history/history_types.h" | 31 #include "chrome/browser/history/history_types.h" |
| 32 #include "chrome/browser/importer/external_process_importer_host.h" |
| 32 #include "chrome/browser/importer/ie_importer.h" | 33 #include "chrome/browser/importer/ie_importer.h" |
| 33 #include "chrome/browser/importer/importer_bridge.h" | 34 #include "chrome/browser/importer/importer_bridge.h" |
| 34 #include "chrome/browser/importer/importer_data_types.h" | 35 #include "chrome/browser/importer/importer_data_types.h" |
| 35 #include "chrome/browser/importer/importer_host.h" | 36 #include "chrome/browser/importer/importer_host.h" |
| 36 #include "chrome/browser/importer/importer_progress_observer.h" | 37 #include "chrome/browser/importer/importer_progress_observer.h" |
| 37 #include "chrome/browser/importer/importer_unittest_utils.h" | 38 #include "chrome/browser/importer/importer_unittest_utils.h" |
| 38 #include "chrome/browser/importer/pstore_declarations.h" | 39 #include "chrome/browser/importer/pstore_declarations.h" |
| 39 #include "chrome/browser/search_engines/template_url.h" | 40 #include "chrome/browser/search_engines/template_url.h" |
| 40 #include "chrome/browser/ui/browser.h" | 41 #include "chrome/browser/ui/browser.h" |
| 41 #include "chrome/common/chrome_paths.h" | 42 #include "chrome/common/chrome_paths.h" |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 503 | 504 |
| 504 // Sets up a special history link. | 505 // Sets up a special history link. |
| 505 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2; | 506 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2; |
| 506 res = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL, | 507 res = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL, |
| 507 CLSCTX_INPROC_SERVER); | 508 CLSCTX_INPROC_SERVER); |
| 508 ASSERT_TRUE(res == S_OK); | 509 ASSERT_TRUE(res == S_OK); |
| 509 res = url_history_stg2->AddUrl(kIEIdentifyUrl, kIEIdentifyTitle, 0); | 510 res = url_history_stg2->AddUrl(kIEIdentifyUrl, kIEIdentifyTitle, 0); |
| 510 ASSERT_TRUE(res == S_OK); | 511 ASSERT_TRUE(res == S_OK); |
| 511 | 512 |
| 512 // Starts to import the above settings. | 513 // Starts to import the above settings. |
| 513 // TODO(gab): Use ExternalProcessImporterHost on Windows. | 514 scoped_refptr<ImporterHost> host(new ExternalProcessImporterHost); |
| 514 scoped_refptr<ImporterHost> host(new ImporterHost); | |
| 515 TestObserver* observer = new TestObserver(); | 515 TestObserver* observer = new TestObserver(); |
| 516 host->SetObserver(observer); | 516 host->SetObserver(observer); |
| 517 | 517 |
| 518 importer::SourceProfile source_profile; | 518 importer::SourceProfile source_profile; |
| 519 source_profile.importer_type = importer::TYPE_IE; | 519 source_profile.importer_type = importer::TYPE_IE; |
| 520 source_profile.source_path = temp_dir_.path(); | 520 source_profile.source_path = temp_dir_.path(); |
| 521 | 521 |
| 522 // IUrlHistoryStg2::AddUrl seems to reset the override. Ensure it here. | 522 // IUrlHistoryStg2::AddUrl seems to reset the override. Ensure it here. |
| 523 StartRegistryOverride(); | 523 StartRegistryOverride(); |
| 524 | 524 |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 // sort is performed. | 581 // sort is performed. |
| 582 for (size_t i = 0; i < arraysize(kBadBinary); ++i) { | 582 for (size_t i = 0; i < arraysize(kBadBinary); ++i) { |
| 583 base::win::RegKey key; | 583 base::win::RegKey key; |
| 584 ASSERT_EQ(ERROR_SUCCESS, | 584 ASSERT_EQ(ERROR_SUCCESS, |
| 585 key.Create(HKEY_CURRENT_USER, kIEFavoritesOrderKey, KEY_WRITE)); | 585 key.Create(HKEY_CURRENT_USER, kIEFavoritesOrderKey, KEY_WRITE)); |
| 586 ASSERT_EQ(ERROR_SUCCESS, | 586 ASSERT_EQ(ERROR_SUCCESS, |
| 587 key.WriteValue(L"Order", kBadBinary[i].data, kBadBinary[i].length, | 587 key.WriteValue(L"Order", kBadBinary[i].data, kBadBinary[i].length, |
| 588 REG_BINARY)); | 588 REG_BINARY)); |
| 589 | 589 |
| 590 // Starts to import the above settings. | 590 // Starts to import the above settings. |
| 591 // TODO(gab): Use ExternalProcessImporterHost on Windows. | 591 scoped_refptr<ImporterHost> host(new ExternalProcessImporterHost); |
| 592 scoped_refptr<ImporterHost> host(new ImporterHost); | |
| 593 MalformedFavoritesRegistryTestObserver* observer = | 592 MalformedFavoritesRegistryTestObserver* observer = |
| 594 new MalformedFavoritesRegistryTestObserver(); | 593 new MalformedFavoritesRegistryTestObserver(); |
| 595 host->SetObserver(observer); | 594 host->SetObserver(observer); |
| 596 | 595 |
| 597 importer::SourceProfile source_profile; | 596 importer::SourceProfile source_profile; |
| 598 source_profile.importer_type = importer::TYPE_IE; | 597 source_profile.importer_type = importer::TYPE_IE; |
| 599 source_profile.source_path = temp_dir_.path(); | 598 source_profile.source_path = temp_dir_.path(); |
| 600 | 599 |
| 601 host->StartImportSettings( | 600 host->StartImportSettings( |
| 602 source_profile, | 601 source_profile, |
| 603 browser()->profile(), | 602 browser()->profile(), |
| 604 importer::FAVORITES, | 603 importer::FAVORITES, |
| 605 observer); | 604 observer); |
| 606 MessageLoop::current()->Run(); | 605 MessageLoop::current()->Run(); |
| 607 } | 606 } |
| 608 } | 607 } |
| OLD | NEW |