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

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

Issue 7231016: Move app/win/* files to base/win/, ui/base/win and chrome/common/ directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: brettw review Created 9 years, 6 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/browser_main.cc ('k') | chrome/browser/importer/importer_unittest.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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <pstore.h> 9 #include <pstore.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
11 #include <urlhist.h> 11 #include <urlhist.h>
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <map> 14 #include <map>
15 #include <string> 15 #include <string>
16 #include <vector> 16 #include <vector>
17 17
18 #include "app/win/scoped_co_mem.h"
19 #include "app/win/scoped_com_initializer.h"
20 #include "base/file_path.h" 18 #include "base/file_path.h"
21 #include "base/file_util.h" 19 #include "base/file_util.h"
22 #include "base/string_split.h" 20 #include "base/string_split.h"
23 #include "base/string_util.h" 21 #include "base/string_util.h"
24 #include "base/time.h" 22 #include "base/time.h"
25 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
26 #include "base/win/registry.h" 24 #include "base/win/registry.h"
25 #include "base/win/scoped_com_initializer.h"
27 #include "base/win/scoped_comptr.h" 26 #include "base/win/scoped_comptr.h"
28 #include "base/win/scoped_handle.h" 27 #include "base/win/scoped_handle.h"
29 #include "base/win/windows_version.h" 28 #include "base/win/windows_version.h"
30 #include "chrome/browser/importer/importer_bridge.h" 29 #include "chrome/browser/importer/importer_bridge.h"
31 #include "chrome/browser/importer/importer_data_types.h" 30 #include "chrome/browser/importer/importer_data_types.h"
32 #include "chrome/browser/password_manager/ie7_password.h" 31 #include "chrome/browser/password_manager/ie7_password.h"
33 #include "chrome/browser/search_engines/template_url.h" 32 #include "chrome/browser/search_engines/template_url.h"
33 #include "chrome/browser/search_engines/template_url_prepopulate_data.h"
34 #include "chrome/browser/search_engines/template_url_service.h" 34 #include "chrome/browser/search_engines/template_url_service.h"
35 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" 35 #include "chrome/common/scoped_co_mem.h"
36 #include "chrome/common/time_format.h" 36 #include "chrome/common/time_format.h"
37 #include "chrome/common/url_constants.h" 37 #include "chrome/common/url_constants.h"
38 #include "googleurl/src/gurl.h" 38 #include "googleurl/src/gurl.h"
39 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
40 #include "ui/base/l10n/l10n_util.h" 40 #include "ui/base/l10n/l10n_util.h"
41 #include "webkit/glue/password_form.h" 41 #include "webkit/glue/password_form.h"
42 42
43 namespace { 43 namespace {
44 44
45 // A struct that hosts the information of AutoComplete data in PStore. 45 // A struct that hosts the information of AutoComplete data in PStore.
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 82
83 void IEImporter::StartImport(const importer::SourceProfile& source_profile, 83 void IEImporter::StartImport(const importer::SourceProfile& source_profile,
84 uint16 items, 84 uint16 items,
85 ImporterBridge* bridge) { 85 ImporterBridge* bridge) {
86 bridge_ = bridge; 86 bridge_ = bridge;
87 source_path_ = source_profile.source_path; 87 source_path_ = source_profile.source_path;
88 88
89 bridge_->NotifyStarted(); 89 bridge_->NotifyStarted();
90 90
91 // Some IE settings (such as Protected Storage) are obtained via COM APIs. 91 // Some IE settings (such as Protected Storage) are obtained via COM APIs.
92 app::win::ScopedCOMInitializer com_initializer; 92 base::win::ScopedCOMInitializer com_initializer;
93 93
94 if ((items & importer::HOME_PAGE) && !cancelled()) 94 if ((items & importer::HOME_PAGE) && !cancelled())
95 ImportHomepage(); // Doesn't have a UI item. 95 ImportHomepage(); // Doesn't have a UI item.
96 // The order here is important! 96 // The order here is important!
97 if ((items & importer::HISTORY) && !cancelled()) { 97 if ((items & importer::HISTORY) && !cancelled()) {
98 bridge_->NotifyItemStarted(importer::HISTORY); 98 bridge_->NotifyItemStarted(importer::HISTORY);
99 ImportHistory(); 99 ImportHistory();
100 bridge_->NotifyItemEnded(importer::HISTORY); 100 bridge_->NotifyItemEnded(importer::HISTORY);
101 } 101 }
102 if ((items & importer::FAVORITES) && !cancelled()) { 102 if ((items & importer::FAVORITES) && !cancelled()) {
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 LONG result = keyDefault.ReadValue(kIEDefaultHomepage, &default_homepage_url); 456 LONG result = keyDefault.ReadValue(kIEDefaultHomepage, &default_homepage_url);
457 if (result == ERROR_SUCCESS && !default_homepage_url.empty()) { 457 if (result == ERROR_SUCCESS && !default_homepage_url.empty()) {
458 if (homepage.spec() == GURL(default_homepage_url).spec()) 458 if (homepage.spec() == GURL(default_homepage_url).spec())
459 return; 459 return;
460 } 460 }
461 461
462 bridge_->AddHomePage(homepage); 462 bridge_->AddHomePage(homepage);
463 } 463 }
464 464
465 std::wstring IEImporter::ResolveInternetShortcut(const std::wstring& file) { 465 std::wstring IEImporter::ResolveInternetShortcut(const std::wstring& file) {
466 app::win::ScopedCoMem<wchar_t> url; 466 chrome::common::ScopedCoMem<wchar_t> url;
467 base::win::ScopedComPtr<IUniformResourceLocator> url_locator; 467 base::win::ScopedComPtr<IUniformResourceLocator> url_locator;
468 HRESULT result = url_locator.CreateInstance(CLSID_InternetShortcut, NULL, 468 HRESULT result = url_locator.CreateInstance(CLSID_InternetShortcut, NULL,
469 CLSCTX_INPROC_SERVER); 469 CLSCTX_INPROC_SERVER);
470 if (FAILED(result)) 470 if (FAILED(result))
471 return std::wstring(); 471 return std::wstring();
472 472
473 base::win::ScopedComPtr<IPersistFile> persist_file; 473 base::win::ScopedComPtr<IPersistFile> persist_file;
474 result = persist_file.QueryFrom(url_locator); 474 result = persist_file.QueryFrom(url_locator);
475 if (FAILED(result)) 475 if (FAILED(result))
476 return std::wstring(); 476 return std::wstring();
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
588 if (version < 0) { 588 if (version < 0) {
589 wchar_t buffer[128]; 589 wchar_t buffer[128];
590 DWORD buffer_length = sizeof(buffer); 590 DWORD buffer_length = sizeof(buffer);
591 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, 591 base::win::RegKey reg_key(HKEY_LOCAL_MACHINE,
592 L"Software\\Microsoft\\Internet Explorer", KEY_READ); 592 L"Software\\Microsoft\\Internet Explorer", KEY_READ);
593 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL); 593 LONG result = reg_key.ReadValue(L"Version", buffer, &buffer_length, NULL);
594 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0); 594 version = ((result == ERROR_SUCCESS)? _wtoi(buffer) : 0);
595 } 595 }
596 return version; 596 return version;
597 } 597 }
OLDNEW
« no previous file with comments | « chrome/browser/browser_main.cc ('k') | chrome/browser/importer/importer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698