OLD | NEW |
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/in_process_importer_bridge.h" | 5 #include "chrome/browser/importer/in_process_importer_bridge.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/importer/external_process_importer_host.h" | 10 #include "chrome/browser/importer/external_process_importer_host.h" |
11 #include "chrome/browser/search_engines/template_url.h" | 11 #include "chrome/browser/search_engines/template_url.h" |
12 #include "chrome/browser/search_engines/template_url_parser.h" | 12 #include "chrome/browser/search_engines/template_url_parser.h" |
13 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" | 13 #include "chrome/browser/search_engines/template_url_prepopulate_data.h" |
14 #include "chrome/browser/search_engines/template_url_service.h" | |
15 #include "chrome/common/importer/imported_bookmark_entry.h" | 14 #include "chrome/common/importer/imported_bookmark_entry.h" |
16 #include "chrome/common/importer/imported_favicon_usage.h" | 15 #include "chrome/common/importer/imported_favicon_usage.h" |
17 #include "components/autofill/core/common/password_form.h" | 16 #include "components/autofill/core/common/password_form.h" |
18 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
19 #include "ui/base/l10n/l10n_util.h" | 18 #include "ui/base/l10n/l10n_util.h" |
20 | 19 |
21 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
22 #include "components/os_crypt/ie7_password_win.h" | 21 #include "components/os_crypt/ie7_password_win.h" |
23 #endif | 22 #endif |
24 | 23 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // This function transfers ownership of the created TemplateURL to the caller. | 91 // This function transfers ownership of the created TemplateURL to the caller. |
93 TemplateURL* CreateTemplateURL(const base::string16& title, | 92 TemplateURL* CreateTemplateURL(const base::string16& title, |
94 const base::string16& keyword, | 93 const base::string16& keyword, |
95 const GURL& url) { | 94 const GURL& url) { |
96 // Skip if the url is invalid. | 95 // Skip if the url is invalid. |
97 if (!url.is_valid()) | 96 if (!url.is_valid()) |
98 return NULL; | 97 return NULL; |
99 | 98 |
100 TemplateURLData data; | 99 TemplateURLData data; |
101 if (keyword.empty()) | 100 if (keyword.empty()) |
102 data.SetKeyword(TemplateURLService::GenerateKeyword(url)); | 101 data.SetKeyword(TemplateURL::GenerateKeyword(url)); |
103 else | 102 else |
104 data.SetKeyword(keyword); | 103 data.SetKeyword(keyword); |
105 // We set short name by using the title if it exists. | 104 // We set short name by using the title if it exists. |
106 // Otherwise, we use the shortcut. | 105 // Otherwise, we use the shortcut. |
107 data.short_name = title.empty() ? keyword : title; | 106 data.short_name = title.empty() ? keyword : title; |
108 data.SetURL( | 107 data.SetURL( |
109 TemplateURLRef::DisplayURLToURLRef(base::UTF8ToUTF16(url.spec()))); | 108 TemplateURLRef::DisplayURLToURLRef(base::UTF8ToUTF16(url.spec()))); |
110 return new TemplateURL(data); | 109 return new TemplateURL(data); |
111 } | 110 } |
112 | 111 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 BrowserThread::PostTask( | 275 BrowserThread::PostTask( |
277 BrowserThread::UI, FROM_HERE, | 276 BrowserThread::UI, FROM_HERE, |
278 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); | 277 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); |
279 } | 278 } |
280 | 279 |
281 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { | 280 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { |
282 return l10n_util::GetStringUTF16(message_id); | 281 return l10n_util::GetStringUTF16(message_id); |
283 } | 282 } |
284 | 283 |
285 InProcessImporterBridge::~InProcessImporterBridge() {} | 284 InProcessImporterBridge::~InProcessImporterBridge() {} |
OLD | NEW |