diff options
author | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 17:48:40 +0000 |
---|---|---|
committer | agl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-11-14 17:48:40 +0000 |
commit | 405ed122f92ca9248de2a65103edba9b02471a9f (patch) | |
tree | 9d8cb957ff47ba6790107feec65acdfa592d9747 /chrome/browser/history | |
parent | 296d61e24b5a5311f120a767a59ac006176f6f9a (diff) | |
download | chromium_src-405ed122f92ca9248de2a65103edba9b02471a9f.zip chromium_src-405ed122f92ca9248de2a65103edba9b02471a9f.tar.gz chromium_src-405ed122f92ca9248de2a65103edba9b02471a9f.tar.bz2 |
Port some files in chrome/browser/
#ifdef out windows-specific portion of chrome/common/l10n_util.h,
which allows me to port some other files.
I also extracted parts of chrome/views/tree_view.h to tree_model.h,
so that ATL/WTL-specific parts stay in tree_view.h, but tree_model.h
is platform-independent and can be included in files using it as base class.
Review URL: http://codereview.chromium.org/8618
Patch from Paweł Hajdan jr.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5483 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/expire_history_backend.cc | 19 | ||||
-rw-r--r-- | chrome/browser/history/expire_history_backend.h | 2 | ||||
-rw-r--r-- | chrome/browser/history/history_backend.cc | 33 | ||||
-rw-r--r-- | chrome/browser/history/history_backend.h | 3 |
4 files changed, 16 insertions, 41 deletions
diff --git a/chrome/browser/history/expire_history_backend.cc b/chrome/browser/history/expire_history_backend.cc index 0944b87..955b837 100644 --- a/chrome/browser/history/expire_history_backend.cc +++ b/chrome/browser/history/expire_history_backend.cc @@ -7,6 +7,7 @@ #include <algorithm> #include <limits> +#include "base/compiler_specific.h" #include "base/file_util.h" #include "chrome/browser/bookmarks/bookmark_service.h" #include "chrome/browser/history/archived_database.h" @@ -74,8 +75,7 @@ ExpireHistoryBackend::ExpireHistoryBackend( archived_db_(NULL), thumb_db_(NULL), text_db_(NULL), -#pragma warning(suppress: 4355) // Okay to pass "this" here. - factory_(this), + ALLOW_THIS_IN_INITIALIZER_LIST(factory_(this)), bookmark_service_(bookmark_service) { } @@ -297,16 +297,21 @@ URLID ExpireHistoryBackend::ArchiveOneURL(const URLRow& url_row) { return archived_db_->AddURL(url_row); } +namespace { + +struct ChangedURL { + ChangedURL() : visit_count(0), typed_count(0) {} + int visit_count; + int typed_count; +}; + +} // namespace + void ExpireHistoryBackend::ExpireURLsForVisits( const VisitVector& visits, DeleteDependencies* dependencies) { // First find all unique URLs and the number of visits we're deleting for // each one. - struct ChangedURL { - ChangedURL() : visit_count(0), typed_count(0) {} - int visit_count; - int typed_count; - }; std::map<URLID, ChangedURL> changed_urls; for (size_t i = 0; i < visits.size(); i++) { ChangedURL& cur = changed_urls[visits[i].url_id]; diff --git a/chrome/browser/history/expire_history_backend.h b/chrome/browser/history/expire_history_backend.h index 55c72c3..5d26ddc 100644 --- a/chrome/browser/history/expire_history_backend.h +++ b/chrome/browser/history/expire_history_backend.h @@ -13,11 +13,11 @@ #include "base/time.h" #include "chrome/browser/history/history_types.h" #include "chrome/browser/history/text_database_manager.h" +#include "chrome/common/notification_types.h" #include "testing/gtest/include/gtest/gtest_prod.h" class BookmarkService; class GURL; -enum NotificationType; namespace history { diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index d904148..fd7d465 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -6,6 +6,7 @@ #include <set> +#include "base/compiler_specific.h" #include "base/file_util.h" #include "base/histogram.h" #include "base/message_loop.h" @@ -78,32 +79,6 @@ static const int kMaxRedirectCount = 32; // and is archived. static const int kArchiveDaysThreshold = 90; -// Comparison used when inserting entries into visits vector. -static bool VisitOccursAfter(const PageVisit& elem1, - const PageVisit& elem2) { - return elem1.visit_time > elem2.visit_time; -} - -static bool IsMatchingHost(const URLRow& row, - const std::string& host_name) { - const GURL& url = row.url(); - if (!url.is_valid() || !url.IsStandard()) - return false; - - const std::string& spec = url.spec(); - url_parse::Parsed parsed = url.parsed_for_possibly_invalid_spec(); - if (!parsed.host.is_nonempty()) - return false; // Empty host. - - if (parsed.host.len != host_name.size()) - return false; // Hosts are different lengths, can not match. - - // TODO(brettw) we may want to also match hosts ending with a period, since - // these will typically be the same. - return strncmp(&spec[parsed.host.begin], host_name.c_str(), - host_name.size()) == 0; -} - // This task is run on a timer so that commits happen at regular intervals // so they are batched together. The important thing about this class is that // it supports canceling of the task so the reference to the backend will be @@ -195,10 +170,9 @@ HistoryBackend::HistoryBackend(const std::wstring& history_dir, BookmarkService* bookmark_service) : delegate_(delegate), history_dir_(history_dir), -#pragma warning(suppress: 4355) // OK to pass "this" here. - expirer_(this, bookmark_service), - backend_destroy_message_loop_(NULL), + ALLOW_THIS_IN_INITIALIZER_LIST(expirer_(this, bookmark_service)), recent_redirects_(kMaxRedirectCount), + backend_destroy_message_loop_(NULL), backend_destroy_task_(NULL), segment_queried_(false), bookmark_service_(bookmark_service) { @@ -620,7 +594,6 @@ std::pair<URLID, VisitID> HistoryBackend::AddPageVisit( // Update of an existing row. if (PageTransition::StripQualifier(transition) != PageTransition::RELOAD) url_info.set_visit_count(url_info.visit_count() + 1); - int old_typed_count = url_info.typed_count(); if (typed_increment) url_info.set_typed_count(url_info.typed_count() + typed_increment); url_info.set_last_visit(time); diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index a7c9310..8918742 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -262,9 +262,6 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, FRIEND_TEST(HistoryBackendTest, URLsNoLongerBookmarked); friend class TestingProfile; - // For invoking methods that circumvent requests. - friend class HistoryTest; - // Computes the name of the specified database on disk. std::wstring GetThumbnailFileName() const; std::wstring GetArchivedFileName() const; |