| 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/files/file_util.h" | 8 #include "base/files/file_util.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 // This function transfers ownership of the created TemplateURL to the caller. | 96 // This function transfers ownership of the created TemplateURL to the caller. |
| 97 TemplateURL* CreateTemplateURL(const base::string16& url, | 97 TemplateURL* CreateTemplateURL(const base::string16& url, |
| 98 const base::string16& keyword, | 98 const base::string16& keyword, |
| 99 const base::string16& title) { | 99 const base::string16& title) { |
| 100 if (url.empty() || keyword.empty()) | 100 if (url.empty() || keyword.empty()) |
| 101 return NULL; | 101 return NULL; |
| 102 TemplateURLData data; | 102 TemplateURLData data; |
| 103 data.SetKeyword(keyword); | 103 data.SetKeyword(keyword); |
| 104 // We set short name by using the title if it exists. | 104 // We set short name by using the title if it exists. |
| 105 // Otherwise, we use the shortcut. | 105 // Otherwise, we use the shortcut. |
| 106 data.short_name = title.empty() ? keyword : title; | 106 data.SetShortName(title.empty() ? keyword : title); |
| 107 data.SetURL(TemplateURLRef::DisplayURLToURLRef(url)); | 107 data.SetURL(TemplateURLRef::DisplayURLToURLRef(url)); |
| 108 return new TemplateURL(data); | 108 return new TemplateURL(data); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| | 111 // Parses the OpenSearch XML files in |xml_files| and populates |search_engines| |
| 112 // with the resulting TemplateURLs. | 112 // with the resulting TemplateURLs. |
| 113 void ParseSearchEnginesFromFirefoxXMLData( | 113 void ParseSearchEnginesFromFirefoxXMLData( |
| 114 const std::vector<std::string>& xml_data, | 114 const std::vector<std::string>& xml_data, |
| 115 std::vector<TemplateURL*>* search_engines) { | 115 std::vector<TemplateURL*>* search_engines) { |
| 116 DCHECK(search_engines); | 116 DCHECK(search_engines); |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 BrowserThread::PostTask( | 294 BrowserThread::PostTask( |
| 295 BrowserThread::UI, FROM_HERE, | 295 BrowserThread::UI, FROM_HERE, |
| 296 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); | 296 base::Bind(&ExternalProcessImporterHost::NotifyImportEnded, host_)); |
| 297 } | 297 } |
| 298 | 298 |
| 299 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { | 299 base::string16 InProcessImporterBridge::GetLocalizedString(int message_id) { |
| 300 return l10n_util::GetStringUTF16(message_id); | 300 return l10n_util::GetStringUTF16(message_id); |
| 301 } | 301 } |
| 302 | 302 |
| 303 InProcessImporterBridge::~InProcessImporterBridge() {} | 303 InProcessImporterBridge::~InProcessImporterBridge() {} |
| OLD | NEW |