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

Side by Side Diff: chrome/utility/importer/ie_importer_win.cc

Issue 254763005: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address some style nits. Created 6 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
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/utility/importer/ie_importer_win.h" 5 #include "chrome/utility/importer/ie_importer_win.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 22 matching lines...) Expand all
33 #include "chrome/common/importer/imported_bookmark_entry.h" 33 #include "chrome/common/importer/imported_bookmark_entry.h"
34 #include "chrome/common/importer/imported_favicon_usage.h" 34 #include "chrome/common/importer/imported_favicon_usage.h"
35 #include "chrome/common/importer/importer_bridge.h" 35 #include "chrome/common/importer/importer_bridge.h"
36 #include "chrome/common/importer/importer_data_types.h" 36 #include "chrome/common/importer/importer_data_types.h"
37 #include "chrome/common/importer/importer_url_row.h" 37 #include "chrome/common/importer/importer_url_row.h"
38 #include "chrome/common/importer/pstore_declarations.h" 38 #include "chrome/common/importer/pstore_declarations.h"
39 #include "chrome/common/url_constants.h" 39 #include "chrome/common/url_constants.h"
40 #include "chrome/utility/importer/favicon_reencode.h" 40 #include "chrome/utility/importer/favicon_reencode.h"
41 #include "components/autofill/core/common/password_form.h" 41 #include "components/autofill/core/common/password_form.h"
42 #include "grit/generated_resources.h" 42 #include "grit/generated_resources.h"
43 #include "net/base/url_constants.h"
43 #include "ui/base/l10n/l10n_util.h" 44 #include "ui/base/l10n/l10n_util.h"
44 #include "url/gurl.h" 45 #include "url/gurl.h"
45 46
46 namespace { 47 namespace {
47 48
48 // Registry key paths from which we import IE settings. 49 // Registry key paths from which we import IE settings.
49 const base::char16 kSearchScopePath[] = 50 const base::char16 kSearchScopePath[] =
50 L"Software\\Microsoft\\Internet Explorer\\SearchScopes"; 51 L"Software\\Microsoft\\Internet Explorer\\SearchScopes";
51 const base::char16 kIEVersionKey[] = 52 const base::char16 kIEVersionKey[] =
52 L"Software\\Microsoft\\Internet Explorer"; 53 L"Software\\Microsoft\\Internet Explorer";
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 if (!bookmarks.empty() && !cancelled()) { 462 if (!bookmarks.empty() && !cancelled()) {
462 const base::string16& first_folder_name = 463 const base::string16& first_folder_name =
463 l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE); 464 l10n_util::GetStringUTF16(IDS_BOOKMARK_GROUP_FROM_IE);
464 bridge_->AddBookmarks(bookmarks, first_folder_name); 465 bridge_->AddBookmarks(bookmarks, first_folder_name);
465 } 466 }
466 if (!favicons.empty() && !cancelled()) 467 if (!favicons.empty() && !cancelled())
467 bridge_->SetFavicons(favicons); 468 bridge_->SetFavicons(favicons);
468 } 469 }
469 470
470 void IEImporter::ImportHistory() { 471 void IEImporter::ImportHistory() {
471 const std::string kSchemes[] = {content::kHttpScheme, 472 const std::string kSchemes[] = {net::kHttpScheme, net::kHttpsScheme,
472 content::kHttpsScheme, 473 content::kFtpScheme, content::kFileScheme};
473 content::kFtpScheme,
474 content::kFileScheme};
475 int total_schemes = arraysize(kSchemes); 474 int total_schemes = arraysize(kSchemes);
476 475
477 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2; 476 base::win::ScopedComPtr<IUrlHistoryStg2> url_history_stg2;
478 HRESULT result; 477 HRESULT result;
479 result = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL, 478 result = url_history_stg2.CreateInstance(CLSID_CUrlHistory, NULL,
480 CLSCTX_INPROC_SERVER); 479 CLSCTX_INPROC_SERVER);
481 if (FAILED(result)) 480 if (FAILED(result))
482 return; 481 return;
483 base::win::ScopedComPtr<IEnumSTATURL> enum_url; 482 base::win::ScopedComPtr<IEnumSTATURL> enum_url;
484 if (SUCCEEDED(result = url_history_stg2->EnumUrls(enum_url.Receive()))) { 483 if (SUCCEEDED(result = url_history_stg2->EnumUrls(enum_url.Receive()))) {
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 item.Release(); 594 item.Release();
596 pstore.Release(); 595 pstore.Release();
597 FreeLibrary(pstorec_dll); 596 FreeLibrary(pstorec_dll);
598 597
599 size_t i; 598 size_t i;
600 for (i = 0; i < ac_list.size(); i++) { 599 for (i = 0; i < ac_list.size(); i++) {
601 if (!ac_list[i].is_url || ac_list[i].data.size() < 2) 600 if (!ac_list[i].is_url || ac_list[i].data.size() < 2)
602 continue; 601 continue;
603 602
604 GURL url(ac_list[i].key.c_str()); 603 GURL url(ac_list[i].key.c_str());
605 if (!(LowerCaseEqualsASCII(url.scheme(), content::kHttpScheme) || 604 if (!(LowerCaseEqualsASCII(url.scheme(), net::kHttpScheme) ||
606 LowerCaseEqualsASCII(url.scheme(), content::kHttpsScheme))) { 605 LowerCaseEqualsASCII(url.scheme(), net::kHttpsScheme))) {
607 continue; 606 continue;
608 } 607 }
609 608
610 autofill::PasswordForm form; 609 autofill::PasswordForm form;
611 GURL::Replacements rp; 610 GURL::Replacements rp;
612 rp.ClearUsername(); 611 rp.ClearUsername();
613 rp.ClearPassword(); 612 rp.ClearPassword();
614 rp.ClearQuery(); 613 rp.ClearQuery();
615 rp.ClearRef(); 614 rp.ClearRef();
616 form.origin = url.ReplaceComponents(rp); 615 form.origin = url.ReplaceComponents(rp);
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
872 static int version = -1; 871 static int version = -1;
873 if (version < 0) { 872 if (version < 0) {
874 wchar_t buffer[128]; 873 wchar_t buffer[128];
875 DWORD buffer_length = sizeof(buffer); 874 DWORD buffer_length = sizeof(buffer);
876 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ); 875 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, kIEVersionKey, KEY_READ);
877 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 876 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
878 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 877 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
879 } 878 }
880 return version; 879 return version;
881 } 880 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698