diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 23:34:21 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-15 23:34:21 +0000 |
commit | ef0d04ca01d4db521fb15100269bbfab3805e505 (patch) | |
tree | 2065802454ed8e1ba198f7c6e845df5f3c375171 /chrome/browser/history | |
parent | 34bcdb9489c1af2fb2f324b6c21859f75760b89a (diff) | |
download | chromium_src-ef0d04ca01d4db521fb15100269bbfab3805e505.zip chromium_src-ef0d04ca01d4db521fb15100269bbfab3805e505.tar.gz chromium_src-ef0d04ca01d4db521fb15100269bbfab3805e505.tar.bz2 |
Make us save favicon in incognito mode if the url is bookmarked. This
way the bookmark bar/manager have a favicon for the page.
BUG=22670
TEST=see bug
Review URL: http://codereview.chromium.org/5753007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@69345 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/history')
-rw-r--r-- | chrome/browser/history/history.cc | 8 | ||||
-rw-r--r-- | chrome/browser/history/history.h | 5 | ||||
-rw-r--r-- | chrome/browser/history/history_backend.cc | 17 | ||||
-rw-r--r-- | chrome/browser/history/history_backend.h | 1 | ||||
-rw-r--r-- | chrome/browser/history/history_types.cc | 4 |
5 files changed, 33 insertions, 2 deletions
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc index 73efc91..0736fc2 100644 --- a/chrome/browser/history/history.cc +++ b/chrome/browser/history/history.cc @@ -357,6 +357,14 @@ void HistoryService::AddPage(const history::HistoryAddPageArgs& add_page_args) { add_page_args.Clone())); } +void HistoryService::AddPageNoVisitForBookmark(const GURL& url) { + if (!CanAddURL(url)) + return; + + ScheduleAndForget(PRIORITY_NORMAL, + &HistoryBackend::AddPageNoVisitForBookmark, url); +} + void HistoryService::SetPageTitle(const GURL& url, const string16& title) { ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::SetPageTitle, url, title); diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h index 3fe34ba..3e604e6 100644 --- a/chrome/browser/history/history.h +++ b/chrome/browser/history/history.h @@ -212,6 +212,11 @@ class HistoryService : public CancelableRequestProvider, // All AddPage variants end up here. void AddPage(const history::HistoryAddPageArgs& add_page_args); + // Adds an entry for the specified url without creating a visit. This should + // only be used when bookmarking a page, otherwise the row leaks in the + // history db (it never gets cleaned). + void AddPageNoVisitForBookmark(const GURL& url); + // Sets the title for the given page. The page should be in history. If it // is not, this operation is ignored. This call will not update the full // text index. The last title set when the page is indexed will be the diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc index 0bf6045..cd0a40b 100644 --- a/chrome/browser/history/history_backend.cc +++ b/chrome/browser/history/history_backend.cc @@ -870,6 +870,23 @@ void HistoryBackend::SetPageTitle(const GURL& url, ScheduleCommit(); } +void HistoryBackend::AddPageNoVisitForBookmark(const GURL& url) { + if (!db_.get()) + return; + + URLRow url_info(url); + URLID url_id = db_->GetRowForURL(url, &url_info); + if (url_id) { + // URL is already known, nothing to do. + return; + } + url_info.set_last_visit(Time::Now()); + // Mark the page hidden. If the user types it in, it'll unhide. + url_info.set_hidden(true); + + db_->AddURL(url_info); +} + void HistoryBackend::IterateURLs(HistoryService::URLEnumerator* iterator) { if (db_.get()) { HistoryDatabase::URLEnumerator e; diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h index b8c27d6..4ce7aea 100644 --- a/chrome/browser/history/history_backend.h +++ b/chrome/browser/history/history_backend.h @@ -121,6 +121,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>, void AddPage(scoped_refptr<HistoryAddPageArgs> request); virtual void SetPageTitle(const GURL& url, const string16& title); + void AddPageNoVisitForBookmark(const GURL& url); // Indexing ------------------------------------------------------------------ diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc index 8a41ae8..05d9a72 100644 --- a/chrome/browser/history/history_types.cc +++ b/chrome/browser/history/history_types.cc @@ -60,8 +60,8 @@ void URLRow::Swap(URLRow* other) { void URLRow::Initialize() { id_ = 0; - visit_count_ = false; - typed_count_ = false; + visit_count_ = 0; + typed_count_ = 0; last_visit_ = Time(); hidden_ = false; favicon_id_ = 0; |