summaryrefslogtreecommitdiffstats
path: root/chrome/browser/importer
diff options
context:
space:
mode:
authorIain Merrick <husky@google.com>2010-11-01 12:19:54 +0000
committerIain Merrick <husky@google.com>2010-11-03 10:21:10 +0000
commit731df977c0511bca2206b5f333555b1205ff1f43 (patch)
tree0e750b949b3f00a1ac11fda25d3c2de512f2b465 /chrome/browser/importer
parent5add15e10e7bb80512f2c597ca57221314abe577 (diff)
downloadexternal_chromium-731df977c0511bca2206b5f333555b1205ff1f43.zip
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.gz
external_chromium-731df977c0511bca2206b5f333555b1205ff1f43.tar.bz2
Merge Chromium at r63472 : Initial merge by git.
Change-Id: Ifb9ee821af006a5f2211e81471be93ae440a1f5a
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r--chrome/browser/importer/firefox2_importer.cc4
-rw-r--r--chrome/browser/importer/firefox3_importer.cc15
-rw-r--r--chrome/browser/importer/firefox3_importer.h11
-rw-r--r--chrome/browser/importer/firefox_importer_unittest.cc4
-rw-r--r--chrome/browser/importer/firefox_importer_unittest_utils_mac.cc13
-rw-r--r--chrome/browser/importer/firefox_importer_utils.cc14
-rw-r--r--chrome/browser/importer/firefox_importer_utils_win.cc12
-rw-r--r--chrome/browser/importer/ie_importer.cc17
-rw-r--r--chrome/browser/importer/importer.cc32
-rw-r--r--chrome/browser/importer/importer.h2
-rw-r--r--chrome/browser/importer/importer_bridge.cc54
-rw-r--r--chrome/browser/importer/importer_bridge.h10
-rw-r--r--chrome/browser/importer/importer_data_types.cc17
-rw-r--r--chrome/browser/importer/importer_data_types.h4
-rw-r--r--chrome/browser/importer/importer_list.cc3
-rw-r--r--chrome/browser/importer/importer_unittest.cc10
-rw-r--r--chrome/browser/importer/nss_decryptor.cc2
-rw-r--r--chrome/browser/importer/profile_writer.cc8
-rw-r--r--chrome/browser/importer/profile_writer.h22
-rw-r--r--chrome/browser/importer/toolbar_importer.cc15
20 files changed, 160 insertions, 109 deletions
diff --git a/chrome/browser/importer/firefox2_importer.cc b/chrome/browser/importer/firefox2_importer.cc
index d7932b8..a6b6534 100644
--- a/chrome/browser/importer/firefox2_importer.cc
+++ b/chrome/browser/importer/firefox2_importer.cc
@@ -105,7 +105,7 @@ void Firefox2Importer::LoadDefaultBookmarks(const FilePath& app_path,
std::string content;
file_util::ReadFileToString(file, &content);
std::vector<std::string> lines;
- SplitString(content, '\n', &lines);
+ base::SplitString(content, '\n', &lines);
std::string charset;
for (size_t i = 0; i < lines.size(); ++i) {
@@ -160,7 +160,7 @@ void Firefox2Importer::ImportBookmarksFile(
std::string content;
file_util::ReadFileToString(file_path, &content);
std::vector<std::string> lines;
- SplitString(content, '\n', &lines);
+ base::SplitString(content, '\n', &lines);
std::vector<ProfileWriter::BookmarkEntry> toolbar_bookmarks;
std::wstring last_folder = first_folder_name;
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc
index 110f2b6..92637d0 100644
--- a/chrome/browser/importer/firefox3_importer.cc
+++ b/chrome/browser/importer/firefox3_importer.cc
@@ -35,9 +35,20 @@ using importer::ProfileInfo;
using importer::SEARCH_ENGINES;
using webkit_glue::PasswordForm;
+struct Firefox3Importer::BookmarkItem {
+ int parent;
+ int id;
+ GURL url;
+ std::wstring title;
+ int type;
+ std::string keyword;
+ base::Time date_added;
+ int64 favicon;
+};
+
Firefox3Importer::Firefox3Importer() {
#if defined(OS_LINUX)
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
locale_ = g_browser_process->GetApplicationLocale();
#endif
}
@@ -49,7 +60,7 @@ void Firefox3Importer::StartImport(importer::ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge) {
#if defined(OS_LINUX)
- DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE));
#endif
bridge_ = bridge;
source_path_ = profile_info.source_path;
diff --git a/chrome/browser/importer/firefox3_importer.h b/chrome/browser/importer/firefox3_importer.h
index 592d4da..362f710 100644
--- a/chrome/browser/importer/firefox3_importer.h
+++ b/chrome/browser/importer/firefox3_importer.h
@@ -46,16 +46,7 @@ class Firefox3Importer : public Importer {
void GetSearchEnginesXMLFiles(std::vector<FilePath>* files);
// The struct stores the information about a bookmark item.
- struct BookmarkItem {
- int parent;
- int id;
- GURL url;
- std::wstring title;
- int type;
- std::string keyword;
- base::Time date_added;
- int64 favicon;
- };
+ struct BookmarkItem;
typedef std::vector<BookmarkItem*> BookmarkList;
// Gets the specific IDs of bookmark root node from |db|.
diff --git a/chrome/browser/importer/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc
index 060015d..73c70a4 100644
--- a/chrome/browser/importer/firefox_importer_unittest.cc
+++ b/chrome/browser/importer/firefox_importer_unittest.cc
@@ -93,7 +93,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) {
charset, &folder_name, &is_toolbar_folder);
EXPECT_TRUE(result);
EXPECT_EQ(L"< > & \" ' \\ /", folder_name);
- EXPECT_EQ(false, is_toolbar_folder);
+ EXPECT_FALSE(is_toolbar_folder);
// Empty name and toolbar folder attribute.
result = Firefox2Importer::ParseFolderNameFromLine(
@@ -101,7 +101,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) {
charset, &folder_name, &is_toolbar_folder);
EXPECT_TRUE(result);
EXPECT_EQ(L"", folder_name);
- EXPECT_EQ(true, is_toolbar_folder);
+ EXPECT_TRUE(is_toolbar_folder);
// Unicode characters in title and shortcut.
std::wstring title;
diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
index f9958fb..e35f7a7 100644
--- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
+++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc
@@ -9,6 +9,7 @@
#include "base/debug_on_start.h"
#include "base/file_path.h"
#include "base/message_loop.h"
+#include "base/test/test_timeouts.h"
#include "chrome/browser/importer/firefox_importer_utils.h"
#include "ipc/ipc_channel.h"
#include "ipc/ipc_descriptors.h"
@@ -136,7 +137,7 @@ bool FFUnitTestDecryptorProxy::Setup(const std::wstring& nss_path) {
channel_.reset(new IPC::Channel(kTestChannelID,
IPC::Channel::MODE_SERVER,
listener_.get()));
- channel_->Connect();
+ CHECK(channel_->Connect());
listener_->SetSender(channel_.get());
// Spawn child and set up sync IPC connection.
@@ -170,8 +171,6 @@ class CancellableQuitMsgLoop : public base::RefCounted<CancellableQuitMsgLoop> {
// Spin until either a client response arrives or a timeout occurs.
bool FFUnitTestDecryptorProxy::WaitForClientResponse() {
- const int64 kLoopTimeoutMS = 10 * 1000; // 10 seconds.
-
// What we're trying to do here is to wait for an RPC message to go over the
// wire and the client to reply. If the client does not replyy by a given
// timeout we kill the message loop.
@@ -181,8 +180,10 @@ bool FFUnitTestDecryptorProxy::WaitForClientResponse() {
// a message comes in.
scoped_refptr<CancellableQuitMsgLoop> quit_task =
new CancellableQuitMsgLoop();
- MessageLoop::current()->PostDelayedTask(FROM_HERE, NewRunnableMethod(
- quit_task.get(), &CancellableQuitMsgLoop::QuitNow), kLoopTimeoutMS);
+ MessageLoop::current()->PostDelayedTask(
+ FROM_HERE,
+ NewRunnableMethod(quit_task.get(), &CancellableQuitMsgLoop::QuitNow),
+ TestTimeouts::action_max_timeout_ms());
message_loop_->Run();
bool ret = !quit_task->cancelled_;
@@ -261,7 +262,7 @@ MULTIPROCESS_TEST_MAIN(NSSDecrypterChildProcess) {
FFDecryptorClientChannelListener listener;
IPC::Channel channel(kTestChannelID, IPC::Channel::MODE_CLIENT, &listener);
- channel.Connect();
+ CHECK(channel.Connect());
listener.SetSender(&channel);
// run message loop
diff --git a/chrome/browser/importer/firefox_importer_utils.cc b/chrome/browser/importer/firefox_importer_utils.cc
index 6ff1798..e223491 100644
--- a/chrome/browser/importer/firefox_importer_utils.cc
+++ b/chrome/browser/importer/firefox_importer_utils.cc
@@ -99,7 +99,7 @@ bool GetFirefoxVersionAndPathFromProfile(const FilePath& profile_path,
file_util::ReadFileToString(compatibility_file, &content);
ReplaceSubstringsAfterOffset(&content, 0, "\r\n", "\n");
std::vector<std::string> lines;
- SplitString(content, '\n', &lines);
+ base::SplitString(content, '\n', &lines);
for (size_t i = 0; i < lines.size(); ++i) {
const std::string& line = lines[i];
@@ -130,7 +130,7 @@ void ParseProfileINI(const FilePath& file, DictionaryValue* root) {
file_util::ReadFileToString(file, &content);
ReplaceSubstringsAfterOffset(&content, 0, "\r\n", "\n");
std::vector<std::string> lines;
- SplitString(content, '\n', &lines);
+ base::SplitString(content, '\n', &lines);
// Parses the file.
root->Clear();
@@ -345,7 +345,7 @@ bool IsDefaultHomepage(const GURL& homepage, const FilePath& app_path) {
// Crack the string into separate homepage urls.
std::vector<std::string> urls;
- SplitString(default_homepages, '|', &urls);
+ base::SplitString(default_homepages, '|', &urls);
for (size_t i = 0; i < urls.size(); ++i) {
if (homepage.spec() == GURL(urls[i]).spec())
@@ -410,7 +410,7 @@ bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs) {
if (IsStringUTF8(value))
prefs->SetString(key, value);
else
- LOG(INFO) << "Non UTF8 value for key " << key << ", ignored.";
+ VLOG(1) << "Non UTF8 value for key " << key << ", ignored.";
continue;
}
@@ -421,8 +421,8 @@ bool ParsePrefFile(const FilePath& pref_file, DictionaryValue* prefs) {
continue;
}
- LOG(ERROR) << "Invalid value found in Firefox pref file '" <<
- pref_file.value() << "' value is '" << value << "'.";
+ LOG(ERROR) << "Invalid value found in Firefox pref file '"
+ << pref_file.value() << "' value is '" << value << "'.";
}
return true;
}
@@ -434,7 +434,7 @@ std::string GetPrefsJsValue(const std::string& content,
std::string("\", ");
size_t prop_index = content.find(search_for);
if (prop_index == std::string::npos)
- return "";
+ return std::string();
size_t start = prop_index + search_for.length();
size_t stop = std::string::npos;
diff --git a/chrome/browser/importer/firefox_importer_utils_win.cc b/chrome/browser/importer/firefox_importer_utils_win.cc
index 3200eb1..7fc2a41 100644
--- a/chrome/browser/importer/firefox_importer_utils_win.cc
+++ b/chrome/browser/importer/firefox_importer_utils_win.cc
@@ -7,7 +7,7 @@
#include <shlobj.h>
#include "base/file_util.h"
-#include "base/registry.h"
+#include "base/win/registry.h"
// NOTE: Keep these in order since we need test all those paths according
// to priority. For example. One machine has multiple users. One non-admin
@@ -28,8 +28,8 @@ int GetCurrentFirefoxMajorVersionFromRegistry() {
// written under HKLM\Mozilla. Otherwise it the keys will be written under
// HKCU\Mozilla.
for (int i = 0; i < arraysize(kFireFoxRegistryPaths); ++i) {
- RegKey reg_key(kFireFoxRegistryPaths[i],
- L"Software\\Mozilla\\Mozilla Firefox", KEY_READ);
+ base::win::RegKey reg_key(kFireFoxRegistryPaths[i],
+ L"Software\\Mozilla\\Mozilla Firefox", KEY_READ);
bool result = reg_key.ReadValue(L"CurrentVersion", ver_buffer,
&ver_buffer_length, NULL);
@@ -45,14 +45,16 @@ std::wstring GetFirefoxInstallPathFromRegistry() {
std::wstring registry_path = L"Software\\Mozilla\\Mozilla Firefox";
wchar_t buffer[MAX_PATH];
DWORD buffer_length = sizeof(buffer);
- RegKey reg_key(HKEY_LOCAL_MACHINE, registry_path.c_str(), KEY_READ);
+ base::win::RegKey reg_key(HKEY_LOCAL_MACHINE, registry_path.c_str(),
+ KEY_READ);
bool result = reg_key.ReadValue(L"CurrentVersion", buffer,
&buffer_length, NULL);
if (!result)
return std::wstring();
registry_path += L"\\" + std::wstring(buffer) + L"\\Main";
buffer_length = sizeof(buffer);
- RegKey reg_key_directory(HKEY_LOCAL_MACHINE, registry_path.c_str(), KEY_READ);
+ base::win::RegKey reg_key_directory(HKEY_LOCAL_MACHINE,
+ registry_path.c_str(), KEY_READ);
result = reg_key_directory.ReadValue(L"Install Directory", buffer,
&buffer_length, NULL);
if (!result)
diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc
index cbea511..f2905dd 100644
--- a/chrome/browser/importer/ie_importer.cc
+++ b/chrome/browser/importer/ie_importer.cc
@@ -19,14 +19,14 @@
#include "app/win_util.h"
#include "base/file_path.h"
#include "base/file_util.h"
-#include "base/registry.h"
#include "base/scoped_comptr_win.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/time.h"
#include "base/values.h"
#include "base/utf_string_conversions.h"
-#include "base/win_util.h"
+#include "base/win/registry.h"
+#include "base/win/windows_version.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/browser/importer/importer_data_types.h"
@@ -40,6 +40,8 @@
#include "webkit/glue/password_form.h"
using base::Time;
+using base::win::RegKey;
+using base::win::RegistryValueIterator;
using webkit_glue::PasswordForm;
namespace {
@@ -190,7 +192,7 @@ void IEImporter::ImportPasswordsIE6() {
ac.key.erase(i);
ac.is_url = (ac.key.find(L"://") != std::wstring::npos);
ac_list.push_back(ac);
- SplitString(data, L'\0', &ac_list[ac_list.size() - 1].data);
+ base::SplitString(data, L'\0', &ac_list[ac_list.size() - 1].data);
}
CoTaskMemFree(buffer);
}
@@ -354,14 +356,15 @@ void IEImporter::ImportSearchEngines() {
const TemplateURL* default_search_engine = NULL;
std::map<std::string, TemplateURL*> search_engines_map;
key.ReadValue(L"DefaultScope", &default_search_engine_name);
- RegistryKeyIterator key_iterator(HKEY_CURRENT_USER, kSearchScopePath);
+ base::win::RegistryKeyIterator key_iterator(HKEY_CURRENT_USER,
+ kSearchScopePath);
while (key_iterator.Valid()) {
std::wstring sub_key_name = kSearchScopePath;
sub_key_name.append(L"\\").append(key_iterator.Name());
RegKey sub_key(HKEY_CURRENT_USER, sub_key_name.c_str(), KEY_READ);
std::wstring wide_url;
if (!sub_key.ReadValue(L"URL", &wide_url) || wide_url.empty()) {
- LOG(INFO) << "No URL for IE search engine at " << key_iterator.Name();
+ VLOG(1) << "No URL for IE search engine at " << key_iterator.Name();
++key_iterator;
continue;
}
@@ -372,7 +375,7 @@ void IEImporter::ImportSearchEngines() {
if (!sub_key.ReadValue(NULL, &name) || name.empty()) {
// Try the displayable name.
if (!sub_key.ReadValue(L"DisplayName", &name) || name.empty()) {
- LOG(INFO) << "No name for IE search engine at " << key_iterator.Name();
+ VLOG(1) << "No name for IE search engine at " << key_iterator.Name();
++key_iterator;
continue;
}
@@ -463,7 +466,7 @@ bool IEImporter::GetFavoritesInfo(IEImporter::FavoritesInfo *info) {
// is not recording in Vista's registry. So in Vista, we assume the Links
// folder is under Favorites folder since it looks like there is not name
// different in every language version of Windows Vista.
- if (win_util::GetWinVersion() < win_util::WINVERSION_VISTA) {
+ if (base::win::GetVersion() < base::win::VERSION_VISTA) {
// The Link folder name is stored in the registry.
DWORD buffer_length = sizeof(buffer);
RegKey reg_key(HKEY_CURRENT_USER,
diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc
index 2ca7425..9a40471 100644
--- a/chrome/browser/importer/importer.cc
+++ b/chrome/browser/importer/importer.cc
@@ -10,8 +10,8 @@
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/browsing_instance.h"
-#include "chrome/browser/chrome_thread.h"
#include "chrome/browser/importer/firefox_profile_lock.h"
#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/browser/renderer_host/site_instance.h"
@@ -200,12 +200,12 @@ void ImporterHost::StartImportSettings(
MB_OK | MB_TOPMOST);
GURL url("https://www.google.com/accounts/ServiceLogin");
- BrowsingInstance* instance = new BrowsingInstance(writer_->profile());
- SiteInstance* site = instance->GetSiteInstanceForURL(url);
Browser* browser = BrowserList::GetLastActive();
- browser->AddTabWithURL(url, GURL(), PageTransition::TYPED, -1,
- TabStripModel::ADD_SELECTED, site, std::string(),
- NULL);
+ Browser::AddTabWithURLParams params(url, PageTransition::TYPED);
+ // BrowsingInstance is refcounted.
+ BrowsingInstance* instance = new BrowsingInstance(writer_->profile());
+ params.instance = instance->GetSiteInstanceForURL(url);
+ browser->AddTabWithURL(&params);
MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod(
this, &ImporterHost::OnLockViewEnd, false));
@@ -233,7 +233,7 @@ void ImporterHost::InvokeTaskIfDone() {
if (waiting_for_bookmarkbar_model_ || !registrar_.IsEmpty() ||
!is_source_readable_)
return;
- ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, task_);
+ BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, task_);
}
void ImporterHost::ImportItemStarted(importer::ImportItem item) {
@@ -396,10 +396,10 @@ ExternalProcessImporterClient::~ExternalProcessImporterClient() {
void ExternalProcessImporterClient::Start() {
AddRef(); // balanced in Cleanup.
- ChromeThread::ID thread_id;
- CHECK(ChromeThread::GetCurrentThreadIdentifier(&thread_id));
- ChromeThread::PostTask(
- ChromeThread::IO, FROM_HERE,
+ BrowserThread::ID thread_id;
+ CHECK(BrowserThread::GetCurrentThreadIdentifier(&thread_id));
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this,
&ExternalProcessImporterClient::StartProcessOnIOThread,
g_browser_process->resource_dispatcher_host(), thread_id));
@@ -407,7 +407,7 @@ void ExternalProcessImporterClient::Start() {
void ExternalProcessImporterClient::StartProcessOnIOThread(
ResourceDispatcherHost* rdh,
- ChromeThread::ID thread_id) {
+ BrowserThread::ID thread_id) {
profile_import_process_host_ =
new ProfileImportProcessHost(rdh, this, thread_id);
profile_import_process_host_->StartProfileImportProcess(profile_info_,
@@ -420,8 +420,8 @@ void ExternalProcessImporterClient::Cancel() {
cancelled_ = true;
if (profile_import_process_host_) {
- ChromeThread::PostTask(
- ChromeThread::IO, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this,
&ExternalProcessImporterClient::CancelImportProcessOnIOThread));
}
@@ -484,8 +484,8 @@ void ExternalProcessImporterClient::OnImportItemFinished(int item_data) {
importer::ImportItem import_item =
static_cast<importer::ImportItem>(item_data);
bridge_->NotifyItemEnded(import_item);
- ChromeThread::PostTask(
- ChromeThread::IO, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::IO, FROM_HERE,
NewRunnableMethod(this,
&ExternalProcessImporterClient::NotifyItemFinishedOnIOThread,
import_item));
diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h
index 14be8c2..4887138 100644
--- a/chrome/browser/importer/importer.h
+++ b/chrome/browser/importer/importer.h
@@ -315,7 +315,7 @@ class ExternalProcessImporterClient
// Creates a new ProfileImportProcessHost, which launches the import process.
virtual void StartProcessOnIOThread(ResourceDispatcherHost* rdh,
- ChromeThread::ID thread_id);
+ BrowserThread::ID thread_id);
// Called by the ExternalProcessImporterHost on import cancel.
virtual void Cancel();
diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc
index 079ebe3..f4fce91 100644
--- a/chrome/browser/importer/importer_bridge.cc
+++ b/chrome/browser/importer/importer_bridge.cc
@@ -10,7 +10,7 @@
#include "base/string16.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/importer/importer.h"
#if defined(OS_WIN)
@@ -21,6 +21,10 @@
#include "chrome/profile_import/profile_import_thread.h"
#include "webkit/glue/password_form.h"
+ImporterBridge::ImporterBridge() { }
+
+ImporterBridge::~ImporterBridge() { }
+
InProcessImporterBridge::InProcessImporterBridge(ProfileWriter* writer,
ImporterHost* host)
: writer_(writer), host_(host) {
@@ -30,24 +34,24 @@ void InProcessImporterBridge::AddBookmarkEntries(
const std::vector<ProfileWriter::BookmarkEntry>& bookmarks,
const std::wstring& first_folder_name,
int options) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(
writer_, &ProfileWriter::AddBookmarkEntry, bookmarks,
first_folder_name, options));
}
void InProcessImporterBridge::AddHomePage(const GURL &home_page) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddHomepage, home_page));
}
#if defined(OS_WIN)
void InProcessImporterBridge::AddIE7PasswordInfo(
const IE7PasswordInfo password_info) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddIE7PasswordInfo,
password_info));
}
@@ -55,16 +59,16 @@ void InProcessImporterBridge::AddIE7PasswordInfo(
void InProcessImporterBridge::SetFavIcons(
const std::vector<history::ImportedFavIconUsage>& fav_icons) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddFavicons, fav_icons));
}
void InProcessImporterBridge::SetHistoryItems(
const std::vector<history::URLRow> &rows,
history::VisitSource visit_source) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddHistoryPage,
rows, visit_source));
}
@@ -73,8 +77,8 @@ void InProcessImporterBridge::SetKeywords(
const std::vector<TemplateURL*>& template_urls,
int default_keyword_index,
bool unique_on_host_and_path) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(
writer_, &ProfileWriter::AddKeywords, template_urls,
default_keyword_index, unique_on_host_and_path));
@@ -83,32 +87,32 @@ void InProcessImporterBridge::SetKeywords(
void InProcessImporterBridge::SetPasswordForm(
const webkit_glue::PasswordForm& form) {
LOG(ERROR) << "IPImporterBridge::SetPasswordForm";
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(writer_, &ProfileWriter::AddPasswordForm, form));
}
void InProcessImporterBridge::NotifyItemStarted(importer::ImportItem item) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::ImportItemStarted, item));
}
void InProcessImporterBridge::NotifyItemEnded(importer::ImportItem item) {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::ImportItemEnded, item));
}
void InProcessImporterBridge::NotifyStarted() {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::ImportStarted));
}
void InProcessImporterBridge::NotifyEnded() {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(host_, &ImporterHost::ImportEnded));
}
@@ -116,6 +120,8 @@ std::wstring InProcessImporterBridge::GetLocalizedString(int message_id) {
return l10n_util::GetString(message_id);
}
+InProcessImporterBridge::~InProcessImporterBridge() {}
+
ExternalProcessImporterBridge::ExternalProcessImporterBridge(
ProfileImportThread* profile_import_thread,
const DictionaryValue& localized_strings)
@@ -194,3 +200,5 @@ std::wstring ExternalProcessImporterBridge::GetLocalizedString(
localized_strings_->GetString(base::IntToString(message_id), &message);
return UTF16ToWideHack(message);
}
+
+ExternalProcessImporterBridge::~ExternalProcessImporterBridge() {}
diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h
index 8b57ab0..186821e 100644
--- a/chrome/browser/importer/importer_bridge.h
+++ b/chrome/browser/importer/importer_bridge.h
@@ -13,7 +13,7 @@
#include "base/basictypes.h"
#include "base/ref_counted.h"
#include "base/scoped_ptr.h"
-#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/importer/importer_data_types.h"
// TODO: remove this, see friend declaration in ImporterBridge.
#include "chrome/browser/importer/toolbar_importer.h"
@@ -24,7 +24,7 @@ class ImporterHost;
class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> {
public:
- ImporterBridge() { }
+ ImporterBridge();
virtual void AddBookmarkEntries(
const std::vector<ProfileWriter::BookmarkEntry>& bookmarks,
@@ -72,7 +72,7 @@ class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> {
// the abstraction here and assume import is in-process.
friend class Toolbar5Importer;
- virtual ~ImporterBridge() {}
+ virtual ~ImporterBridge();
DISALLOW_COPY_AND_ASSIGN(ImporterBridge);
};
@@ -110,7 +110,7 @@ class InProcessImporterBridge : public ImporterBridge {
virtual std::wstring GetLocalizedString(int message_id);
private:
- ~InProcessImporterBridge() {}
+ virtual ~InProcessImporterBridge();
ProfileWriter* const writer_; // weak
ImporterHost* const host_; // weak
@@ -156,7 +156,7 @@ class ExternalProcessImporterBridge : public ImporterBridge {
virtual std::wstring GetLocalizedString(int message_id);
private:
- ~ExternalProcessImporterBridge() {}
+ ~ExternalProcessImporterBridge();
// Call back to send data and messages across IPC.
ProfileImportThread* const profile_import_thread_;
diff --git a/chrome/browser/importer/importer_data_types.cc b/chrome/browser/importer/importer_data_types.cc
new file mode 100644
index 0000000..c7be206
--- /dev/null
+++ b/chrome/browser/importer/importer_data_types.cc
@@ -0,0 +1,17 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/importer/importer_data_types.h"
+
+namespace importer {
+
+ProfileInfo::ProfileInfo()
+ : browser_type(NO_PROFILE_TYPE),
+ services_supported(0) {
+}
+
+ProfileInfo::~ProfileInfo() {
+}
+
+} // namespace importer
diff --git a/chrome/browser/importer/importer_data_types.h b/chrome/browser/importer/importer_data_types.h
index e4af8fb..51376c8 100644
--- a/chrome/browser/importer/importer_data_types.h
+++ b/chrome/browser/importer/importer_data_types.h
@@ -31,6 +31,7 @@ enum ImportItem {
// settings and data from them. Numbers added so that data can be
// reliably cast to ints and passed across IPC.
enum ProfileType {
+ NO_PROFILE_TYPE = -1,
#if defined(OS_WIN)
MS_IE = 0,
#endif
@@ -46,6 +47,9 @@ enum ProfileType {
// Information about a profile needed by an importer to do import work.
struct ProfileInfo {
+ ProfileInfo();
+ ~ProfileInfo();
+
std::wstring description;
importer::ProfileType browser_type;
FilePath source_path;
diff --git a/chrome/browser/importer/importer_list.cc b/chrome/browser/importer/importer_list.cc
index ba2bf83..f529284 100644
--- a/chrome/browser/importer/importer_list.cc
+++ b/chrome/browser/importer/importer_list.cc
@@ -72,6 +72,9 @@ Importer* ImporterList::CreateImporterByType(importer::ProfileType type) {
case importer::SAFARI:
return new SafariImporter(mac_util::GetUserLibraryPath());
#endif // OS_MACOSX
+ case importer::NO_PROFILE_TYPE:
+ NOTREACHED();
+ return NULL;
}
NOTREACHED();
return NULL;
diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc
index 879d7cb..2bad8ee 100644
--- a/chrome/browser/importer/importer_unittest.cc
+++ b/chrome/browser/importer/importer_unittest.cc
@@ -24,7 +24,7 @@
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/importer/importer.h"
#include "chrome/browser/importer/importer_bridge.h"
@@ -63,8 +63,8 @@ using webkit_glue::PasswordForm;
class ImporterTest : public testing::Test {
public:
ImporterTest()
- : ui_thread_(ChromeThread::UI, &message_loop_),
- file_thread_(ChromeThread::FILE, &message_loop_) {}
+ : ui_thread_(BrowserThread::UI, &message_loop_),
+ file_thread_(BrowserThread::FILE, &message_loop_) {}
protected:
virtual void SetUp() {
// Creates a new profile in a new subdirectory in the temp directory.
@@ -127,8 +127,8 @@ class ImporterTest : public testing::Test {
}
MessageLoopForUI message_loop_;
- ChromeThread ui_thread_;
- ChromeThread file_thread_;
+ BrowserThread ui_thread_;
+ BrowserThread file_thread_;
FilePath test_path_;
FilePath profile_path_;
FilePath app_path_;
diff --git a/chrome/browser/importer/nss_decryptor.cc b/chrome/browser/importer/nss_decryptor.cc
index 98522c6..2a95d0e 100644
--- a/chrome/browser/importer/nss_decryptor.cc
+++ b/chrome/browser/importer/nss_decryptor.cc
@@ -119,7 +119,7 @@ void NSSDecryptor::ParseSignons(const std::string& content,
// Splits the file content into lines.
std::vector<std::string> lines;
- SplitString(content, '\n', &lines);
+ base::SplitString(content, '\n', &lines);
// The first line is the file version. We skip the unknown versions.
if (lines.empty())
diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc
index 93d6248..57ddffc 100644
--- a/chrome/browser/importer/profile_writer.cc
+++ b/chrome/browser/importer/profile_writer.cc
@@ -19,6 +19,12 @@
using webkit_glue::PasswordForm;
+ProfileWriter::BookmarkEntry::BookmarkEntry() : in_toolbar(false) {}
+
+ProfileWriter::BookmarkEntry::~BookmarkEntry() {}
+
+ProfileWriter::ProfileWriter(Profile* profile) : profile_(profile) {}
+
bool ProfileWriter::BookmarkModelIsLoaded() const {
return profile_->GetBookmarkModel()->IsLoaded();
}
@@ -277,6 +283,8 @@ void ProfileWriter::ShowBookmarkBar() {
}
}
+ProfileWriter::~ProfileWriter() {}
+
std::wstring ProfileWriter::GenerateUniqueFolderName(
BookmarkModel* model,
const std::wstring& folder_name) {
diff --git a/chrome/browser/importer/profile_writer.h b/chrome/browser/importer/profile_writer.h
index a8571cb..5c0e25c 100644
--- a/chrome/browser/importer/profile_writer.h
+++ b/chrome/browser/importer/profile_writer.h
@@ -48,19 +48,13 @@ class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> {
BOOKMARK_BAR_DISABLED = 1 << 2
};
- explicit ProfileWriter(Profile* profile) : profile_(profile) {}
-
- // These functions return true if the corresponding model has been loaded.
- // If the models haven't been loaded, the importer waits to run until they've
- // completed.
- virtual bool BookmarkModelIsLoaded() const;
- virtual bool TemplateURLModelIsLoaded() const;
-
// A bookmark entry.
// TODO(mirandac): remove instances of wstring from ProfileWriter
// (http://crbug.com/43460).
struct BookmarkEntry {
- BookmarkEntry() : in_toolbar(false) {}
+ BookmarkEntry();
+ ~BookmarkEntry();
+
bool in_toolbar;
GURL url;
std::vector<std::wstring> path;
@@ -68,6 +62,14 @@ class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> {
base::Time creation_time;
};
+ explicit ProfileWriter(Profile* profile);
+
+ // These functions return true if the corresponding model has been loaded.
+ // If the models haven't been loaded, the importer waits to run until they've
+ // completed.
+ virtual bool BookmarkModelIsLoaded() const;
+ virtual bool TemplateURLModelIsLoaded() const;
+
// Helper methods for adding data to local stores.
virtual void AddPasswordForm(const webkit_glue::PasswordForm& form);
#if defined(OS_WIN)
@@ -115,7 +117,7 @@ class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> {
protected:
friend class base::RefCountedThreadSafe<ProfileWriter>;
- virtual ~ProfileWriter() {}
+ virtual ~ProfileWriter();
private:
// Generates a unique folder name. If folder_name is not unique, then this
diff --git a/chrome/browser/importer/toolbar_importer.cc b/chrome/browser/importer/toolbar_importer.cc
index ad9ad61..0aabcc6 100644
--- a/chrome/browser/importer/toolbar_importer.cc
+++ b/chrome/browser/importer/toolbar_importer.cc
@@ -12,7 +12,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
-#include "chrome/browser/chrome_thread.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/first_run/first_run.h"
#include "chrome/browser/importer/importer_bridge.h"
#include "chrome/browser/importer/importer_data_types.h"
@@ -43,7 +43,7 @@ bool toolbar_importer_utils::IsGoogleGAIACookieInstalled() {
options.set_include_httponly(); // The SID cookie might be httponly.
std::string cookies = store->GetCookiesWithOptions(url, options);
std::vector<std::string> cookie_list;
- SplitString(cookies, kSplitStringToken, &cookie_list);
+ base::SplitString(cookies, kSplitStringToken, &cookie_list);
for (std::vector<std::string>::iterator current = cookie_list.begin();
current != cookie_list.end();
++current) {
@@ -123,11 +123,11 @@ void Toolbar5Importer::Cancel() {
// If we are conducting network operations, post a message to the importer
// thread for synchronization.
- if (ChromeThread::CurrentlyOn(ChromeThread::UI)) {
+ if (BrowserThread::CurrentlyOn(BrowserThread::UI)) {
EndImport();
} else {
- ChromeThread::PostTask(
- ChromeThread::UI, FROM_HERE,
+ BrowserThread::PostTask(
+ BrowserThread::UI, FROM_HERE,
NewRunnableMethod(this, &Toolbar5Importer::Cancel));
}
}
@@ -206,7 +206,8 @@ void Toolbar5Importer::EndImport() {
data_fetcher_ = NULL;
}
- bridge_->NotifyEnded();
+ if (bridge_)
+ bridge_->NotifyEnded();
}
}
@@ -580,7 +581,7 @@ bool Toolbar5Importer::ExtractFoldersFromXmlReader(
// IE or Firefox folder. We undo the label creation and recreate the
// correct folder.
std::vector<std::wstring> folder_names;
- SplitString(label_vector[index], L':', &folder_names);
+ base::SplitString(label_vector[index], L':', &folder_names);
(*bookmark_folders)[index].insert((*bookmark_folders)[index].end(),
folder_names.begin(), folder_names.end());
}