diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-27 14:26:24 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-27 14:26:24 +0000 |
commit | b57bd61fea33b77586bdae6b3599af0fc256d38e (patch) | |
tree | 1acab7e9bce43284e5d42935c1ffa932c14a8944 | |
parent | 56229141f03391ddf535ee3db8900ca11eac4902 (diff) | |
download | chromium_src-b57bd61fea33b77586bdae6b3599af0fc256d38e.zip chromium_src-b57bd61fea33b77586bdae6b3599af0fc256d38e.tar.gz chromium_src-b57bd61fea33b77586bdae6b3599af0fc256d38e.tar.bz2 |
importer: Cleanup, remove all remaining using declarations.
It's better without them.
BUG=None
TEST=None
R=avi@chromium.og
Review URL: http://codereview.chromium.org/6746014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79514 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/importer/firefox_importer_unittest.cc | 30 | ||||
-rw-r--r-- | chrome/browser/importer/ie_importer.cc | 17 | ||||
-rw-r--r-- | chrome/browser/importer/mork_reader.cc | 4 | ||||
-rw-r--r-- | chrome/browser/importer/nss_decryptor.cc | 25 | ||||
-rw-r--r-- | chrome/browser/importer/safari_importer.mm | 11 |
5 files changed, 37 insertions, 50 deletions
diff --git a/chrome/browser/importer/firefox_importer_unittest.cc b/chrome/browser/importer/firefox_importer_unittest.cc index c1033de..c071efe 100644 --- a/chrome/browser/importer/firefox_importer_unittest.cc +++ b/chrome/browser/importer/firefox_importer_unittest.cc @@ -15,8 +15,6 @@ #include "chrome/browser/importer/nss_decryptor.h" #include "chrome/common/chrome_paths.h" -using base::Time; - // The following 2 tests require the use of the NSSDecryptor, on OSX this needs // to run in a separate process, so we use a proxy object so we can share the // same test between platforms. @@ -85,7 +83,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { // Escaped characters in name. string16 folder_name; bool is_toolbar_folder; - Time folder_add_date; + base::Time folder_add_date; result = Firefox2Importer::ParseFolderNameFromLine( "<DT><H3 ADD_DATE=\"1207558707\" >< >" " & " ' \\ /</H3>", @@ -93,7 +91,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { EXPECT_TRUE(result); EXPECT_EQ(ASCIIToUTF16("< > & \" ' \\ /"), folder_name); EXPECT_FALSE(is_toolbar_folder); - EXPECT_TRUE(Time::FromTimeT(1207558707) == folder_add_date); + EXPECT_TRUE(base::Time::FromTimeT(1207558707) == folder_add_date); // Empty name and toolbar folder attribute. result = Firefox2Importer::ParseFolderNameFromLine( @@ -108,7 +106,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { GURL url, favicon; string16 shortcut; string16 post_data; - Time add_date; + base::Time add_date; result = Firefox2Importer::ParseBookmarkFromLine( "<DT><A HREF=\"http://chinese.site.cn/path?query=1#ref\" " "SHORTCUTURL=\"\xE4\xB8\xAD\">\xE4\xB8\xAD\xE6\x96\x87</A>", @@ -118,7 +116,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { EXPECT_EQ("http://chinese.site.cn/path?query=1#ref", url.spec()); EXPECT_EQ(L"\x4E2D", UTF16ToWide(shortcut)); EXPECT_EQ(ASCIIToUTF16(""), post_data); - EXPECT_TRUE(Time() == add_date); + EXPECT_TRUE(base::Time() == add_date); // No shortcut, and url contains %22 ('"' character). result = Firefox2Importer::ParseBookmarkFromLine( @@ -129,7 +127,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { EXPECT_EQ("http://domain.com/?q=%22%3C%3E%22", url.spec()); EXPECT_EQ(ASCIIToUTF16(""), shortcut); EXPECT_EQ(ASCIIToUTF16(""), post_data); - EXPECT_TRUE(Time() == add_date); + EXPECT_TRUE(base::Time() == add_date); result = Firefox2Importer::ParseBookmarkFromLine( "<DT><A HREF=\"http://domain.com/?g="\"\">name</A>", @@ -139,7 +137,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { EXPECT_EQ("http://domain.com/?g=%22", url.spec()); EXPECT_EQ(ASCIIToUTF16(""), shortcut); EXPECT_EQ(ASCIIToUTF16(""), post_data); - EXPECT_TRUE(Time() == add_date); + EXPECT_TRUE(base::Time() == add_date); // Creation date. result = Firefox2Importer::ParseBookmarkFromLine( @@ -150,7 +148,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { EXPECT_EQ(GURL("http://site/"), url); EXPECT_EQ(ASCIIToUTF16(""), shortcut); EXPECT_EQ(ASCIIToUTF16(""), post_data); - EXPECT_TRUE(Time::FromTimeT(1121301154) == add_date); + EXPECT_TRUE(base::Time::FromTimeT(1121301154) == add_date); // Post-data result = Firefox2Importer::ParseBookmarkFromLine( @@ -164,7 +162,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { EXPECT_EQ("http://localhost:8080/test/hello.html", url.spec()); EXPECT_EQ(ASCIIToUTF16("post"), shortcut); EXPECT_EQ(ASCIIToUTF16("lname%3D%25s"), post_data); - EXPECT_TRUE(Time::FromTimeT(1212447159) == add_date); + EXPECT_TRUE(base::Time::FromTimeT(1212447159) == add_date); // Invalid case. result = Firefox2Importer::ParseBookmarkFromLine( @@ -175,7 +173,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkParse) { EXPECT_EQ("", url.spec()); EXPECT_EQ(ASCIIToUTF16(""), shortcut); EXPECT_EQ(ASCIIToUTF16(""), post_data); - EXPECT_TRUE(Time() == add_date); + EXPECT_TRUE(base::Time() == add_date); // Epiphany format. result = Firefox2Importer::ParseMinimumBookmarkFromLine( @@ -210,7 +208,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { entry = *it++; EXPECT_EQ(ASCIIToUTF16("Empty"), entry.title); EXPECT_TRUE(entry.is_folder); - EXPECT_EQ(Time::FromTimeT(1295938143), entry.creation_time); + EXPECT_EQ(base::Time::FromTimeT(1295938143), entry.creation_time); EXPECT_EQ(2, static_cast<int>(entry.path.size())); if (entry.path.size() == 2) { path_it = entry.path.begin(); @@ -221,7 +219,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { entry = *it++; EXPECT_EQ(ASCIIToUTF16("[Tamura Yukari.com]"), entry.title); EXPECT_FALSE(entry.is_folder); - EXPECT_EQ(Time::FromTimeT(1234567890), entry.creation_time); + EXPECT_EQ(base::Time::FromTimeT(1234567890), entry.creation_time); EXPECT_EQ(2, static_cast<int>(entry.path.size())); if (entry.path.size() == 2) { path_it = entry.path.begin(); @@ -233,7 +231,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { entry = *it++; EXPECT_EQ(ASCIIToUTF16("Google"), entry.title); EXPECT_FALSE(entry.is_folder); - EXPECT_EQ(Time::FromTimeT(0000000000), entry.creation_time); + EXPECT_EQ(base::Time::FromTimeT(0000000000), entry.creation_time); EXPECT_EQ(2, static_cast<int>(entry.path.size())); if (entry.path.size() == 2) { path_it = entry.path.begin(); @@ -255,7 +253,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { entry = *it++; EXPECT_EQ(ASCIIToUTF16("Empty"), entry.title); EXPECT_TRUE(entry.is_folder); - EXPECT_EQ(Time::FromTimeT(1295938143), entry.creation_time); + EXPECT_EQ(base::Time::FromTimeT(1295938143), entry.creation_time); EXPECT_EQ(2, static_cast<int>(entry.path.size())); if (entry.path.size() == 2) { path_it = entry.path.begin(); @@ -266,7 +264,7 @@ TEST(FirefoxImporterTest, Firefox2BookmarkFileImport) { entry = *it++; EXPECT_EQ(ASCIIToUTF16("[Tamura Yukari.com]"), entry.title); EXPECT_FALSE(entry.is_folder); - EXPECT_EQ(Time::FromTimeT(1234567890), entry.creation_time); + EXPECT_EQ(base::Time::FromTimeT(1234567890), entry.creation_time); EXPECT_EQ(2, static_cast<int>(entry.path.size())); if (entry.path.size() == 2) { path_it = entry.path.begin(); diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index d051967..b690155 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -23,8 +23,8 @@ #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/values.h" #include "base/win/registry.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" @@ -42,14 +42,11 @@ #include "ui/base/l10n/l10n_util.h" #include "webkit/glue/password_form.h" -using base::Time; -using webkit_glue::PasswordForm; - namespace { // Gets the creation time of the given file or directory. -static Time GetFileCreationTime(const std::wstring& file) { - Time creation_time; +base::Time GetFileCreationTime(const std::wstring& file) { + base::Time creation_time; base::win::ScopedHandle file_handle( CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -57,7 +54,7 @@ static Time GetFileCreationTime(const std::wstring& file) { FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS, NULL)); FILETIME creation_filetime; if (GetFileTime(file_handle, &creation_filetime, NULL, NULL)) - creation_time = Time::FromFileTime(creation_filetime); + creation_time = base::Time::FromFileTime(creation_filetime); return creation_time; } @@ -221,7 +218,7 @@ void IEImporter::ImportPasswordsIE6() { continue; } - PasswordForm form; + webkit_glue::PasswordForm form; GURL::Replacements rp; rp.ClearUsername(); rp.ClearPassword(); @@ -281,7 +278,7 @@ void IEImporter::ImportPasswordsIE7() { &password_info.encrypted_data.front(), &value_len, NULL) == ERROR_SUCCESS) { password_info.url_hash = reg_iterator.Name(); - password_info.date_created = Time::Now(); + password_info.date_created = base::Time::Now(); bridge_->AddIE7PasswordInfo(password_info); } @@ -332,7 +329,7 @@ void IEImporter::ImportHistory() { history::URLRow row(url); row.set_title(title_string); - row.set_last_visit(Time::FromFileTime(stat_url.ftLastVisited)); + row.set_last_visit(base::Time::FromFileTime(stat_url.ftLastVisited)); if (stat_url.dwFlags == STATURL_QUERYFLAG_TOPLEVEL) { row.set_visit_count(1); row.set_hidden(false); diff --git a/chrome/browser/importer/mork_reader.cc b/chrome/browser/importer/mork_reader.cc index 7c6cca8..297cf3d 100644 --- a/chrome/browser/importer/mork_reader.cc +++ b/chrome/browser/importer/mork_reader.cc @@ -55,8 +55,6 @@ #include "chrome/browser/importer/firefox_importer_utils.h" #include "chrome/browser/importer/importer_bridge.h" -using base::Time; - namespace { // Convert a hex character (0-9, A-F) to its corresponding byte value. @@ -534,7 +532,7 @@ void AddToHistory(MorkReader::ColumnDataList* column_values, int64 date; base::StringToInt64(values[kLastVisitColumn], &date); if (date != 0) - row.set_last_visit(Time::FromTimeT(date / 1000000)); + row.set_last_visit(base::Time::FromTimeT(date / 1000000)); bool is_typed = (values[kTypedColumn] == "1"); if (is_typed) diff --git a/chrome/browser/importer/nss_decryptor.cc b/chrome/browser/importer/nss_decryptor.cc index 2a95d0e..19c235a 100644 --- a/chrome/browser/importer/nss_decryptor.cc +++ b/chrome/browser/importer/nss_decryptor.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 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. @@ -7,23 +7,20 @@ #include <string> #include <vector> +#include "base/base64.h" #include "base/scoped_ptr.h" +#include "base/string_split.h" +#include "base/string_util.h" +#include "base/utf_string_conversions.h" #include "build/build_config.h" #include "chrome/common/sqlite_utils.h" +#include "webkit/glue/password_form.h" #if defined(USE_NSS) #include <pk11pub.h> #include <pk11sdr.h> #endif // defined(USE_NSS) -#include "base/base64.h" -#include "base/string_split.h" -#include "base/string_util.h" -#include "base/utf_string_conversions.h" -#include "webkit/glue/password_form.h" - -using webkit_glue::PasswordForm; - // This method is based on some Firefox code in // security/manager/ssl/src/nsSDR.cpp // The license block is: @@ -114,7 +111,7 @@ string16 NSSDecryptor::Decrypt(const std::string& crypt) const { // http://kb.mozillazine.org/Signons2.txt // http://kb.mozillazine.org/Signons3.txt void NSSDecryptor::ParseSignons(const std::string& content, - std::vector<PasswordForm>* forms) { + std::vector<webkit_glue::PasswordForm>* forms) { forms->clear(); // Splits the file content into lines. @@ -143,7 +140,7 @@ void NSSDecryptor::ParseSignons(const std::string& content, // Reads never-saved list. Domains are stored one per line. size_t i; for (i = 1; i < lines.size() && lines[i].compare(".") != 0; ++i) { - PasswordForm form; + webkit_glue::PasswordForm form; form.origin = GURL(lines[i]).ReplaceComponents(rep); form.signon_realm = form.origin.GetOrigin().spec(); form.blacklisted_by_user = true; @@ -165,7 +162,7 @@ void NSSDecryptor::ParseSignons(const std::string& content, if (end - begin < 5) continue; - PasswordForm form; + webkit_glue::PasswordForm form; // The first line is the site URL. // For HTTP authentication logins, the URL may contain http realm, @@ -253,7 +250,7 @@ bool NSSDecryptor::ReadAndParseSignons(const FilePath& sqlite_file, rep.ClearPassword(); // Read domains for which passwords are never saved. while (s.step() == SQLITE_ROW) { - PasswordForm form; + webkit_glue::PasswordForm form; form.origin = GURL(s.column_string(0)).ReplaceComponents(rep); form.signon_realm = form.origin.GetOrigin().spec(); form.blacklisted_by_user = true; @@ -284,7 +281,7 @@ bool NSSDecryptor::ReadAndParseSignons(const FilePath& sqlite_file, if (!url.is_valid()) continue; - PasswordForm form; + webkit_glue::PasswordForm form; form.origin = url.ReplaceComponents(rep); form.signon_realm = form.origin.GetOrigin().spec(); if (!realm.empty()) diff --git a/chrome/browser/importer/safari_importer.mm b/chrome/browser/importer/safari_importer.mm index e67f083..5fc842ba 100644 --- a/chrome/browser/importer/safari_importer.mm +++ b/chrome/browser/importer/safari_importer.mm @@ -61,10 +61,9 @@ bool SafariImporter::CanImport(const FilePath& library_dir, FilePath bookmarks_path = safari_dir.Append("Bookmarks.plist"); FilePath history_path = safari_dir.Append("History.plist"); - using file_util::PathExists; - if (PathExists(bookmarks_path)) + if (file_util::PathExists(bookmarks_path)) *services_supported |= importer::FAVORITES; - if (PathExists(history_path)) + if (file_util::PathExists(history_path)) *services_supported |= importer::HISTORY; return *services_supported != importer::NONE; @@ -346,13 +345,11 @@ void SafariImporter::ParseHistoryItems( objectForKey:@"WebHistoryDates"]; for (NSDictionary* history_item in safari_history_items) { - using base::SysNSStringToUTF8; - using base::SysNSStringToUTF16; NSString* url_ns = [history_item objectForKey:@""]; if (!url_ns) continue; - GURL url(SysNSStringToUTF8(url_ns)); + GURL url(base::SysNSStringToUTF8(url_ns)); if (!CanImportSafariURL(url)) continue; @@ -365,7 +362,7 @@ void SafariImporter::ParseHistoryItems( if (!title_ns) title_ns = url_ns; - row.set_title(SysNSStringToUTF16(title_ns)); + row.set_title(base::SysNSStringToUTF16(title_ns)); int visit_count = [[history_item objectForKey:@"visitCount"] intValue]; row.set_visit_count(visit_count); |