diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 21:14:50 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-19 21:14:50 +0000 |
commit | c96d2673e03f87d0a39efe047df517a87fdd9ec7 (patch) | |
tree | 75e2362bcae09b90598fa2c17a19c6ad5c9306bf /chrome/browser/importer | |
parent | 041591e177a759271eaf6b334a87f678bb2e9d62 (diff) | |
download | chromium_src-c96d2673e03f87d0a39efe047df517a87fdd9ec7.zip chromium_src-c96d2673e03f87d0a39efe047df517a87fdd9ec7.tar.gz chromium_src-c96d2673e03f87d0a39efe047df517a87fdd9ec7.tar.bz2 |
Revert 56742 - A new field to describe the sources of history urls(visits) is added. This field is recorded in visit_database.
So far, it can tell imported, synchronized, entension added or other(mainly testing) entries from user browsed entries.
In the future, history extension API may allow queries to combinate with this criterion.
BUG=none
TEST=Unit tests are already included. Please test the web browser with history from previous
versions to make sure the migration could be done properly. Also try to import or sync some history and inspect the
sources added to the visit_source table in hitory database are correct.
Original review=http://codereview.chromium.org/2906004/show
Patch by weili@google.com
TBR=brettw@chromium.org
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@56754 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer')
-rw-r--r-- | chrome/browser/importer/firefox3_importer.cc | 2 | ||||
-rw-r--r-- | chrome/browser/importer/ie_importer.cc | 2 | ||||
-rw-r--r-- | chrome/browser/importer/importer.cc | 6 | ||||
-rw-r--r-- | chrome/browser/importer/importer.h | 4 | ||||
-rw-r--r-- | chrome/browser/importer/importer_bridge.cc | 11 | ||||
-rw-r--r-- | chrome/browser/importer/importer_bridge.h | 9 | ||||
-rw-r--r-- | chrome/browser/importer/importer_messages_internal.h | 6 | ||||
-rw-r--r-- | chrome/browser/importer/importer_unittest.cc | 15 | ||||
-rw-r--r-- | chrome/browser/importer/mork_reader.cc | 2 | ||||
-rw-r--r-- | chrome/browser/importer/profile_writer.cc | 5 | ||||
-rw-r--r-- | chrome/browser/importer/profile_writer.h | 4 | ||||
-rw-r--r-- | chrome/browser/importer/safari_importer.mm | 2 |
12 files changed, 23 insertions, 45 deletions
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 76613b6..4bac89a 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -119,7 +119,7 @@ void Firefox3Importer::ImportHistory() { rows.push_back(row); } if (!rows.empty() && !cancelled()) { - bridge_->SetHistoryItems(rows, history::SOURCE_FIREFOX_IMPORTED); + bridge_->SetHistoryItems(rows); } } diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 5f0adca..ab0a61c 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -330,7 +330,7 @@ void IEImporter::ImportHistory() { } if (!rows.empty() && !cancelled()) { - bridge_->SetHistoryItems(rows, history::SOURCE_IE_IMPORTED); + bridge_->SetHistoryItems(rows); } } } diff --git a/chrome/browser/importer/importer.cc b/chrome/browser/importer/importer.cc index 3c840f0..4217a80 100644 --- a/chrome/browser/importer/importer.cc +++ b/chrome/browser/importer/importer.cc @@ -505,16 +505,14 @@ void ExternalProcessImporterClient::OnHistoryImportStart( } void ExternalProcessImporterClient::OnHistoryImportGroup( - const std::vector<history::URLRow>& history_rows_group, - int visit_source) { + const std::vector<history::URLRow> &history_rows_group) { if (cancelled_) return; history_rows_.insert(history_rows_.end(), history_rows_group.begin(), history_rows_group.end()); if (history_rows_.size() == total_history_rows_count_) - bridge_->SetHistoryItems(history_rows_, - static_cast<history::VisitSource>(visit_source)); + bridge_->SetHistoryItems(history_rows_); } void ExternalProcessImporterClient::OnHomePageImportReady( diff --git a/chrome/browser/importer/importer.h b/chrome/browser/importer/importer.h index e9197ad..8dc42fd 100644 --- a/chrome/browser/importer/importer.h +++ b/chrome/browser/importer/importer.h @@ -344,10 +344,8 @@ class ExternalProcessImporterClient virtual void OnHistoryImportStart(size_t total_history_rows_count); // Called when a group of URLRows has been received. - // The source is passed with history::VisitSource type. virtual void OnHistoryImportGroup( - const std::vector<history::URLRow> &history_rows_group, - int visit_source); + const std::vector<history::URLRow> &history_rows_group); // Called when the home page has been received. virtual void OnHomePageImportReady(const GURL& home_page); diff --git a/chrome/browser/importer/importer_bridge.cc b/chrome/browser/importer/importer_bridge.cc index 079ebe3..5ab94da 100644 --- a/chrome/browser/importer/importer_bridge.cc +++ b/chrome/browser/importer/importer_bridge.cc @@ -61,12 +61,10 @@ void InProcessImporterBridge::SetFavIcons( } void InProcessImporterBridge::SetHistoryItems( - const std::vector<history::URLRow> &rows, - history::VisitSource visit_source) { + const std::vector<history::URLRow> &rows) { ChromeThread::PostTask( ChromeThread::UI, FROM_HERE, - NewRunnableMethod(writer_, &ProfileWriter::AddHistoryPage, - rows, visit_source)); + NewRunnableMethod(writer_, &ProfileWriter::AddHistoryPage, rows)); } void InProcessImporterBridge::SetKeywords( @@ -152,9 +150,8 @@ void ExternalProcessImporterBridge::SetFavIcons( } void ExternalProcessImporterBridge::SetHistoryItems( - const std::vector<history::URLRow> &rows, - history::VisitSource visit_source) { - profile_import_thread_->NotifyHistoryImportReady(rows, visit_source); + const std::vector<history::URLRow> &rows) { + profile_import_thread_->NotifyHistoryImportReady(rows); } void ExternalProcessImporterBridge::SetKeywords( diff --git a/chrome/browser/importer/importer_bridge.h b/chrome/browser/importer/importer_bridge.h index 8b57ab0..3d7d62b 100644 --- a/chrome/browser/importer/importer_bridge.h +++ b/chrome/browser/importer/importer_bridge.h @@ -38,8 +38,7 @@ class ImporterBridge : public base::RefCountedThreadSafe<ImporterBridge> { virtual void SetFavIcons( const std::vector<history::ImportedFavIconUsage>& fav_icons) = 0; - virtual void SetHistoryItems(const std::vector<history::URLRow> &rows, - history::VisitSource visit_source) = 0; + virtual void SetHistoryItems(const std::vector<history::URLRow> &rows) = 0; virtual void SetKeywords(const std::vector<TemplateURL*> &template_urls, int default_keyword_index, bool unique_on_host_and_path) = 0; @@ -96,8 +95,7 @@ class InProcessImporterBridge : public ImporterBridge { virtual void SetFavIcons( const std::vector<history::ImportedFavIconUsage>& fav_icons); - virtual void SetHistoryItems(const std::vector<history::URLRow> &rows, - history::VisitSource visit_source); + virtual void SetHistoryItems(const std::vector<history::URLRow> &rows); virtual void SetKeywords(const std::vector<TemplateURL*>& template_urls, int default_keyword_index, bool unique_on_host_and_path); @@ -142,8 +140,7 @@ class ExternalProcessImporterBridge : public ImporterBridge { virtual void SetFavIcons( const std::vector<history::ImportedFavIconUsage>& fav_icons); - virtual void SetHistoryItems(const std::vector<history::URLRow> &rows, - history::VisitSource visit_source); + virtual void SetHistoryItems(const std::vector<history::URLRow> &rows); virtual void SetKeywords(const std::vector<TemplateURL*>& template_urls, int default_keyword_index, bool unique_on_host_and_path); diff --git a/chrome/browser/importer/importer_messages_internal.h b/chrome/browser/importer/importer_messages_internal.h index 980e397b..b247237 100644 --- a/chrome/browser/importer/importer_messages_internal.h +++ b/chrome/browser/importer/importer_messages_internal.h @@ -49,10 +49,8 @@ IPC_BEGIN_MESSAGES(ProfileImportProcessHost) IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyHistoryImportStart, int /* total number of history::URLRow items */) - IPC_MESSAGE_CONTROL2(ProfileImportProcessHostMsg_NotifyHistoryImportGroup, - std::vector<history::URLRow>, - int /* the source of URLs as in history::VisitSource.*/ - /* To simplify IPC call, pass as an integer */) + IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyHistoryImportGroup, + std::vector<history::URLRow>) IPC_MESSAGE_CONTROL1(ProfileImportProcessHostMsg_NotifyHomePageImportReady, GURL /* GURL of home page */) diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index 879d7cb..930d57d 100644 --- a/chrome/browser/importer/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -259,15 +259,12 @@ class TestObserver : public ProfileWriter, ++password_count_; } - virtual void AddHistoryPage(const std::vector<history::URLRow>& page, - history::VisitSource visit_source) { + virtual void AddHistoryPage(const std::vector<history::URLRow>& page) { // Importer should read the specified URL. - for (size_t i = 0; i < page.size(); ++i) { + for (size_t i = 0; i < page.size(); ++i) if (page[i].title() == kIEIdentifyTitle && page[i].url() == GURL(kIEIdentifyUrl)) ++history_count_; - } - EXPECT_EQ(history::SOURCE_IE_IMPORTED, visit_source); } virtual void AddBookmarkEntry(const std::vector<BookmarkEntry>& bookmark, @@ -613,12 +610,10 @@ class FirefoxObserver : public ProfileWriter, ++password_count_; } - virtual void AddHistoryPage(const std::vector<history::URLRow>& page, - history::VisitSource visit_source) { + virtual void AddHistoryPage(const std::vector<history::URLRow>& page) { ASSERT_EQ(1U, page.size()); EXPECT_EQ("http://en-us.www.mozilla.com/", page[0].url().spec()); EXPECT_EQ(ASCIIToUTF16("Firefox Updated"), page[0].title()); - EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); ++history_count_; } @@ -811,8 +806,7 @@ class Firefox3Observer : public ProfileWriter, ++password_count_; } - virtual void AddHistoryPage(const std::vector<history::URLRow>& page, - history::VisitSource visit_source) { + virtual void AddHistoryPage(const std::vector<history::URLRow>& page) { ASSERT_EQ(3U, page.size()); EXPECT_EQ("http://www.google.com/", page[0].url().spec()); EXPECT_EQ(ASCIIToUTF16("Google"), page[0].title()); @@ -821,7 +815,6 @@ class Firefox3Observer : public ProfileWriter, EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/form1-POST.html", page[2].url().spec()); EXPECT_EQ(ASCIIToUTF16("example form (POST)"), page[2].title()); - EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); ++history_count_; } diff --git a/chrome/browser/importer/mork_reader.cc b/chrome/browser/importer/mork_reader.cc index ce1ffe8..4207ad6 100644 --- a/chrome/browser/importer/mork_reader.cc +++ b/chrome/browser/importer/mork_reader.cc @@ -584,5 +584,5 @@ void ImportHistoryFromFirefox2(const FilePath& file, ImporterBridge* bridge) { for (MorkReader::iterator i = reader.begin(); i != reader.end(); ++i) AddToHistory(i->second, data, &rows); if (!rows.empty()) - bridge->SetHistoryItems(rows, history::SOURCE_FIREFOX_IMPORTED); + bridge->SetHistoryItems(rows); } diff --git a/chrome/browser/importer/profile_writer.cc b/chrome/browser/importer/profile_writer.cc index 0cd9a77..32f183d 100644 --- a/chrome/browser/importer/profile_writer.cc +++ b/chrome/browser/importer/profile_writer.cc @@ -36,10 +36,9 @@ void ProfileWriter::AddIE7PasswordInfo(const IE7PasswordInfo& info) { } #endif -void ProfileWriter::AddHistoryPage(const std::vector<history::URLRow>& page, - history::VisitSource visit_source) { +void ProfileWriter::AddHistoryPage(const std::vector<history::URLRow>& page) { profile_->GetHistoryService(Profile::EXPLICIT_ACCESS)-> - AddPagesWithDetails(page, visit_source); + AddPagesWithDetails(page); } void ProfileWriter::AddHomepage(const GURL& home_page) { diff --git a/chrome/browser/importer/profile_writer.h b/chrome/browser/importer/profile_writer.h index a8571cb..44d4a87 100644 --- a/chrome/browser/importer/profile_writer.h +++ b/chrome/browser/importer/profile_writer.h @@ -12,7 +12,6 @@ #include "base/ref_counted.h" #include "base/time.h" #include "chrome/browser/bookmarks/bookmark_model_observer.h" -#include "chrome/browser/history/history_types.h" #include "googleurl/src/gurl.h" class Profile; @@ -73,8 +72,7 @@ class ProfileWriter : public base::RefCountedThreadSafe<ProfileWriter> { #if defined(OS_WIN) virtual void AddIE7PasswordInfo(const IE7PasswordInfo& info); #endif - virtual void AddHistoryPage(const std::vector<history::URLRow>& page, - history::VisitSource visit_source); + virtual void AddHistoryPage(const std::vector<history::URLRow>& page); virtual void AddHomepage(const GURL& homepage); // Adds the bookmarks to the BookmarkModel. // |options| is a bitmask of BookmarkOptions and dictates how and diff --git a/chrome/browser/importer/safari_importer.mm b/chrome/browser/importer/safari_importer.mm index 3ff4676..43e7c28 100644 --- a/chrome/browser/importer/safari_importer.mm +++ b/chrome/browser/importer/safari_importer.mm @@ -317,7 +317,7 @@ void SafariImporter::ImportHistory() { ParseHistoryItems(&rows); if (!rows.empty() && !cancelled()) { - bridge_->SetHistoryItems(rows, history::SOURCE_SAFARI_IMPORTED); + bridge_->SetHistoryItems(rows); } } |