summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-21 20:14:11 +0000
committerakalin@chromium.org <akalin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-21 20:14:11 +0000
commit853e01bca8ffa73b4dc2ebccee8e59977f9e615e (patch)
tree94d032772f49c28ec007b53bcf527e5a38b4e41f
parent75e313e16cd1b984f8661c657b8ae77d54201ff9 (diff)
downloadchromium_src-853e01bca8ffa73b4dc2ebccee8e59977f9e615e.zip
chromium_src-853e01bca8ffa73b4dc2ebccee8e59977f9e615e.tar.gz
chromium_src-853e01bca8ffa73b4dc2ebccee8e59977f9e615e.tar.bz2
Rework arguments of HistoryService::AddPage()
In preparation for adding a timestamp to NavigationEntry, explicitly add a time argument to all variants of HistoryService::AddPage(). Make HistoryAddPageArgs a regular struct (i.e., not ref-counted). Add a default constructor for it. Make arguments to AddPage() match HistoryAddPageArgs constructor. Make HistoryBackend::AddPage avoid mutating its parameter. BUG=128449 TBR=joi@chromium.org Review URL: https://codereview.chromium.org/10963018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@158063 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/autocomplete/history_contents_provider_unittest.cc2
-rw-r--r--chrome/browser/autocomplete/history_url_provider_unittest.cc7
-rw-r--r--chrome/browser/bookmarks/bookmark_html_writer_unittest.cc2
-rw-r--r--chrome/browser/bookmarks/bookmark_model_unittest.cc5
-rw-r--r--chrome/browser/browsing_data/browsing_data_remover_unittest.cc2
-rw-r--r--chrome/browser/history/history.cc33
-rw-r--r--chrome/browser/history/history.h26
-rw-r--r--chrome/browser/history/history_backend.cc85
-rw-r--r--chrome/browser/history/history_backend.h2
-rw-r--r--chrome/browser/history/history_backend_unittest.cc42
-rw-r--r--chrome/browser/history/history_extension_api.cc3
-rw-r--r--chrome/browser/history/history_querying_unittest.cc2
-rw-r--r--chrome/browser/history/history_tab_helper.cc30
-rw-r--r--chrome/browser/history/history_tab_helper.h6
-rw-r--r--chrome/browser/history/history_types.cc49
-rw-r--r--chrome/browser/history/history_types.h41
-rw-r--r--chrome/browser/history/history_unittest.cc121
-rw-r--r--chrome/browser/history/top_sites_unittest.cc16
-rw-r--r--chrome/browser/instant/instant_controller.cc12
-rw-r--r--chrome/browser/instant/instant_loader.cc4
-rw-r--r--chrome/browser/instant/instant_loader.h11
-rw-r--r--chrome/browser/prerender/prerender_contents.cc10
-rw-r--r--chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc30
-rw-r--r--chrome/browser/safe_browsing/malware_details_unittest.cc6
-rw-r--r--chrome/browser/search_engines/template_url_service.cc6
-rw-r--r--chrome/browser/search_engines/template_url_service_unittest.cc7
-rw-r--r--chrome/browser/sync/test/integration/typed_urls_helper.cc2
-rw-r--r--chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc3
-rw-r--r--chrome/browser/ui/views/external_tab_container_win.cc4
-rw-r--r--chrome/browser/ui/webui/bidi_checker_web_ui_test.cc6
-rw-r--r--chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc7
-rw-r--r--chrome/browser/visitedlink/visitedlink_unittest.cc4
-rw-r--r--chrome/tools/profiles/generate_profile.cc6
-rw-r--r--content/public/browser/web_contents_delegate.h2
34 files changed, 298 insertions, 296 deletions
diff --git a/chrome/browser/autocomplete/history_contents_provider_unittest.cc b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
index 67ac310..0252c18 100644
--- a/chrome/browser/autocomplete/history_contents_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_contents_provider_unittest.cc
@@ -83,8 +83,8 @@ class HistoryContentsProviderTest : public testing::Test,
Time t = Time::Now() - TimeDelta::FromDays(arraysize(test_entries) + i);
history_service->AddPage(url, t, id_scope, i, GURL(),
- content::PAGE_TRANSITION_LINK,
history::RedirectList(),
+ content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
history_service->SetPageTitle(url, UTF8ToUTF16(test_entries[i].title));
history_service->SetPageContents(url, UTF8ToUTF16(test_entries[i].body));
diff --git a/chrome/browser/autocomplete/history_url_provider_unittest.cc b/chrome/browser/autocomplete/history_url_provider_unittest.cc
index ea8776a..19f391d 100644
--- a/chrome/browser/autocomplete/history_url_provider_unittest.cc
+++ b/chrome/browser/autocomplete/history_url_provider_unittest.cc
@@ -10,6 +10,7 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/string_util.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete_match.h"
#include "chrome/browser/autocomplete/autocomplete_provider.h"
@@ -412,9 +413,9 @@ TEST_F(HistoryURLProviderTest, CullRedirects) {
redirects_to_a.push_back(GURL(test_cases[1].url));
redirects_to_a.push_back(GURL(test_cases[2].url));
redirects_to_a.push_back(GURL(test_cases[0].url));
- history_service_->AddPage(GURL(test_cases[0].url), NULL, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, redirects_to_a, history::SOURCE_BROWSED,
- true);
+ history_service_->AddPage(GURL(test_cases[0].url), base::Time::Now(),
+ NULL, 0, GURL(), redirects_to_a, content::PAGE_TRANSITION_TYPED,
+ history::SOURCE_BROWSED, true);
// Because all the results are part of a redirect chain with other results,
// all but the first one (A) should be culled. We should get the default
diff --git a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
index 008304a..0c863b2 100644
--- a/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_html_writer_unittest.cc
@@ -195,7 +195,7 @@ TEST_F(BookmarkHTMLWriterTest, Test) {
model->bookmark_bar_node(), 0, f1_title);
model->AddURLWithCreationTime(f1, 0, url1_title, url1, t1);
HistoryServiceFactory::GetForProfile(&profile, Profile::EXPLICIT_ACCESS)->
- AddPage(url1, history::SOURCE_BROWSED);
+ AddPage(url1, base::Time::Now(), history::SOURCE_BROWSED);
FaviconServiceFactory::GetForProfile(
&profile, Profile::EXPLICIT_ACCESS)->SetFavicons(
url1, url1_favicon, history::FAVICON, gfx::Image(bitmap));
diff --git a/chrome/browser/bookmarks/bookmark_model_unittest.cc b/chrome/browser/bookmarks/bookmark_model_unittest.cc
index be237ac..e323416 100644
--- a/chrome/browser/bookmarks/bookmark_model_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_model_unittest.cc
@@ -16,6 +16,7 @@
#include "base/string_number_conversions.h"
#include "base/string_split.h"
#include "base/string_util.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
@@ -945,8 +946,8 @@ TEST_F(BookmarkModelTestWithProfile, RemoveNotification) {
HistoryServiceFactory::GetForProfile(
profile_.get(), Profile::EXPLICIT_ACCESS)->AddPage(
- url, NULL, 1, GURL(), content::PAGE_TRANSITION_TYPED,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ url, base::Time::Now(), NULL, 1, GURL(), history::RedirectList(),
+ content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED, false);
// This won't actually delete the URL, rather it'll empty out the visits.
// This triggers blocking on the BookmarkModel.
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 0b15589..aeb99ff 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -327,7 +327,7 @@ class RemoveHistoryTester {
void AddHistory(const GURL& url, base::Time time) {
history_service_->AddPage(url, time, NULL, 0, GURL(),
- content::PAGE_TRANSITION_LINK, history::RedirectList(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
}
diff --git a/chrome/browser/history/history.cc b/chrome/browser/history/history.cc
index b28b2c4..d595717 100644
--- a/chrome/browser/history/history.cc
+++ b/chrome/browser/history/history.cc
@@ -344,31 +344,28 @@ void HistoryService::SetOnBackendDestroyTask(const base::Closure& task) {
}
void HistoryService::AddPage(const GURL& url,
+ Time time,
const void* id_scope,
int32 page_id,
const GURL& referrer,
- content::PageTransition transition,
const history::RedirectList& redirects,
+ content::PageTransition transition,
history::VisitSource visit_source,
bool did_replace_entry) {
- AddPage(url, Time::Now(), id_scope, page_id, referrer, transition, redirects,
- visit_source, did_replace_entry);
+ AddPage(
+ history::HistoryAddPageArgs(url, time, id_scope, page_id, referrer,
+ redirects, transition, visit_source,
+ did_replace_entry));
}
void HistoryService::AddPage(const GURL& url,
- Time time,
- const void* id_scope,
- int32 page_id,
- const GURL& referrer,
- content::PageTransition transition,
- const history::RedirectList& redirects,
- history::VisitSource visit_source,
- bool did_replace_entry) {
- scoped_refptr<history::HistoryAddPageArgs> request(
- new history::HistoryAddPageArgs(url, time, id_scope, page_id, referrer,
- redirects, transition, visit_source,
- did_replace_entry));
- AddPage(*request);
+ base::Time time,
+ history::VisitSource visit_source) {
+ AddPage(
+ history::HistoryAddPageArgs(url, time, NULL, 0, GURL(),
+ history::RedirectList(),
+ content::PAGE_TRANSITION_LINK,
+ visit_source, false));
}
void HistoryService::AddPage(const history::HistoryAddPageArgs& add_page_args) {
@@ -398,9 +395,7 @@ void HistoryService::AddPage(const history::HistoryAddPageArgs& add_page_args) {
}
}
- ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::AddPage,
- scoped_refptr<history::HistoryAddPageArgs>(
- add_page_args.Clone()));
+ ScheduleAndForget(PRIORITY_NORMAL, &HistoryBackend::AddPage, add_page_args);
}
void HistoryService::AddPageNoVisitForBookmark(const GURL& url,
diff --git a/chrome/browser/history/history.h b/chrome/browser/history/history.h
index 5a500ce..e819434 100644
--- a/chrome/browser/history/history.h
+++ b/chrome/browser/history/history.h
@@ -15,6 +15,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list_threadsafe.h"
#include "base/string16.h"
+#include "base/time.h"
#include "chrome/browser/cancelable_request.h"
#include "chrome/browser/common/url_database/template_url_id.h"
#include "chrome/browser/favicon/favicon_service.h"
@@ -42,7 +43,6 @@ class Profile;
namespace base {
class Thread;
-class Time;
}
namespace content {
@@ -53,7 +53,7 @@ namespace history {
class InMemoryHistoryBackend;
class InMemoryURLIndex;
class InMemoryURLIndexTest;
-class HistoryAddPageArgs;
+struct HistoryAddPageArgs;
class HistoryBackend;
class HistoryDatabase;
struct HistoryDetails;
@@ -165,7 +165,7 @@ class HistoryService : public CancelableRequestProvider,
// Navigation ----------------------------------------------------------------
- // Adds the given canonical URL to history with the current time as the visit
+ // Adds the given canonical URL to history with the given time as the visit
// time. Referrer may be the empty string.
//
// The supplied render process host is used to scope the given page ID. Page
@@ -188,31 +188,19 @@ class HistoryService : public CancelableRequestProvider,
//
// All "Add Page" functions will update the visited link database.
void AddPage(const GURL& url,
- const void* id_scope,
- int32 page_id,
- const GURL& referrer,
- content::PageTransition transition,
- const history::RedirectList& redirects,
- history::VisitSource visit_source,
- bool did_replace_entry);
-
- // For adding pages to history with a specific time. This is for testing
- // purposes. Call the previous one to use the current time.
- void AddPage(const GURL& url,
base::Time time,
const void* id_scope,
int32 page_id,
const GURL& referrer,
- content::PageTransition transition,
const history::RedirectList& redirects,
+ content::PageTransition transition,
history::VisitSource visit_source,
bool did_replace_entry);
// For adding pages to history where no tracking information can be done.
- void AddPage(const GURL& url, history::VisitSource visit_source) {
- AddPage(url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(), visit_source, false);
- }
+ void AddPage(const GURL& url,
+ base::Time time,
+ history::VisitSource visit_source);
// All AddPage variants end up here.
void AddPage(const history::HistoryAddPageArgs& add_page_args);
diff --git a/chrome/browser/history/history_backend.cc b/chrome/browser/history/history_backend.cc
index 5db34a6..c7998d5 100644
--- a/chrome/browser/history/history_backend.cc
+++ b/chrome/browser/history/history_backend.cc
@@ -412,59 +412,63 @@ void HistoryBackend::UpdateVisitDuration(VisitID visit_id, const Time end_ts) {
}
}
-void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
+void HistoryBackend::AddPage(const HistoryAddPageArgs& request) {
if (!db_.get())
return;
// Will be filled with the URL ID and the visit ID of the last addition.
std::pair<URLID, VisitID> last_ids(0, tracker_.GetLastVisit(
- request->id_scope, request->page_id, request->referrer));
+ request.id_scope, request.page_id, request.referrer));
VisitID from_visit_id = last_ids.second;
// If a redirect chain is given, we expect the last item in that chain to be
// the final URL.
- DCHECK(request->redirects.empty() ||
- request->redirects.back() == request->url);
+ DCHECK(request.redirects.empty() ||
+ request.redirects.back() == request.url);
// Avoid duplicating times in the database, at least as long as pages are
// added in order. However, we don't want to disallow pages from recording
// times earlier than our last_recorded_time_, because someone might set
// their machine's clock back.
- if (last_requested_time_ == request->time) {
+ if (last_requested_time_ == request.time) {
last_recorded_time_ = last_recorded_time_ + TimeDelta::FromMicroseconds(1);
} else {
- last_requested_time_ = request->time;
+ last_requested_time_ = request.time;
last_recorded_time_ = last_requested_time_;
}
// If the user is adding older history, we need to make sure our times
// are correct.
- if (request->time < first_recorded_time_)
- first_recorded_time_ = request->time;
+ if (request.time < first_recorded_time_)
+ first_recorded_time_ = request.time;
- content::PageTransition transition =
- content::PageTransitionStripQualifier(request->transition);
+ content::PageTransition request_transition = request.transition;
+ content::PageTransition stripped_transition =
+ content::PageTransitionStripQualifier(request_transition);
bool is_keyword_generated =
- (transition == content::PAGE_TRANSITION_KEYWORD_GENERATED);
+ (stripped_transition == content::PAGE_TRANSITION_KEYWORD_GENERATED);
// If the user is navigating to a not-previously-typed intranet hostname,
// change the transition to TYPED so that the omnibox will learn that this is
// a known host.
- bool has_redirects = request->redirects.size() > 1;
- if (content::PageTransitionIsMainFrame(request->transition) &&
- (transition != content::PAGE_TRANSITION_TYPED) && !is_keyword_generated) {
+ bool has_redirects = request.redirects.size() > 1;
+ if (content::PageTransitionIsMainFrame(request_transition) &&
+ (stripped_transition != content::PAGE_TRANSITION_TYPED) &&
+ !is_keyword_generated) {
const GURL& origin_url(has_redirects ?
- request->redirects[0] : request->url);
+ request.redirects[0] : request.url);
if (origin_url.SchemeIs(chrome::kHttpScheme) ||
origin_url.SchemeIs(chrome::kHttpsScheme) ||
origin_url.SchemeIs(chrome::kFtpScheme)) {
std::string host(origin_url.host());
if ((net::RegistryControlledDomainService::GetRegistryLength(
host, false) == 0) && !db_->IsTypedHost(host)) {
- transition = content::PAGE_TRANSITION_TYPED;
- request->transition = content::PageTransitionFromInt(transition |
- content::PageTransitionGetQualifier(request->transition));
+ stripped_transition = content::PAGE_TRANSITION_TYPED;
+ request_transition =
+ content::PageTransitionFromInt(
+ stripped_transition |
+ content::PageTransitionGetQualifier(request_transition));
}
}
}
@@ -472,19 +476,19 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
if (!has_redirects) {
// The single entry is both a chain start and end.
content::PageTransition t = content::PageTransitionFromInt(
- request->transition |
+ request_transition |
content::PAGE_TRANSITION_CHAIN_START |
content::PAGE_TRANSITION_CHAIN_END);
// No redirect case (one element means just the page itself).
- last_ids = AddPageVisit(request->url, last_recorded_time_,
- last_ids.second, t, request->visit_source);
+ last_ids = AddPageVisit(request.url, last_recorded_time_,
+ last_ids.second, t, request.visit_source);
// Update the segment for this visit. KEYWORD_GENERATED visits should not
// result in changing most visited, so we don't update segments (most
// visited db).
if (!is_keyword_generated) {
- UpdateSegments(request->url, from_visit_id, last_ids.second, t,
+ UpdateSegments(request.url, from_visit_id, last_ids.second, t,
last_recorded_time_);
// Update the referrer's duration.
@@ -496,7 +500,8 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
content::PageTransition redirect_info =
content::PAGE_TRANSITION_CHAIN_START;
- if (request->redirects[0].SchemeIs(chrome::kAboutScheme)) {
+ RedirectList redirects = request.redirects;
+ if (redirects[0].SchemeIs(chrome::kAboutScheme)) {
// When the redirect source + referrer is "about" we skip it. This
// happens when a page opens a new frame/window to about:blank and then
// script sets the URL to somewhere else (used to hide the referrer). It
@@ -506,8 +511,8 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
//
// In this case, we just don't bother hooking up the source of the
// redirects, so we remove it.
- request->redirects.erase(request->redirects.begin());
- } else if (request->transition & content::PAGE_TRANSITION_CLIENT_REDIRECT) {
+ redirects.erase(redirects.begin());
+ } else if (request_transition & content::PAGE_TRANSITION_CLIENT_REDIRECT) {
redirect_info = content::PAGE_TRANSITION_CLIENT_REDIRECT;
// The first entry in the redirect chain initiated a client redirect.
// We don't add this to the database since the referrer is already
@@ -518,16 +523,16 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
// https tab that redirects to a different host or to http. In this
// case we don't need to reconnect the new redirect with the existing
// chain.
- if (request->referrer.is_valid()) {
- DCHECK(request->referrer == request->redirects[0]);
- request->redirects.erase(request->redirects.begin());
+ if (request.referrer.is_valid()) {
+ DCHECK(request.referrer == redirects[0]);
+ redirects.erase(redirects.begin());
// If the navigation entry for this visit has replaced that for the
// first visit, remove the CHAIN_END marker from the first visit. This
// can be called a lot, for example, the page cycler, and most of the
// time we won't have changed anything.
VisitRow visit_row;
- if (request->did_replace_entry &&
+ if (request.did_replace_entry &&
db_->GetRowForVisit(last_ids.second, &visit_row) &&
visit_row.transition & content::PAGE_TRANSITION_CHAIN_END) {
visit_row.transition = content::PageTransitionFromInt(
@@ -537,13 +542,13 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
}
}
- for (size_t redirect_index = 0; redirect_index < request->redirects.size();
+ for (size_t redirect_index = 0; redirect_index < redirects.size();
redirect_index++) {
content::PageTransition t =
- content::PageTransitionFromInt(transition | redirect_info);
+ content::PageTransitionFromInt(stripped_transition | redirect_info);
// If this is the last transition, add a CHAIN_END marker
- if (redirect_index == (request->redirects.size() - 1)) {
+ if (redirect_index == (redirects.size() - 1)) {
t = content::PageTransitionFromInt(
t | content::PAGE_TRANSITION_CHAIN_END);
}
@@ -551,12 +556,12 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
// Record all redirect visits with the same timestamp. We don't display
// them anyway, and if we ever decide to, we can reconstruct their order
// from the redirect chain.
- last_ids = AddPageVisit(request->redirects[redirect_index],
+ last_ids = AddPageVisit(redirects[redirect_index],
last_recorded_time_, last_ids.second,
- t, request->visit_source);
+ t, request.visit_source);
if (t & content::PAGE_TRANSITION_CHAIN_START) {
// Update the segment for this visit.
- UpdateSegments(request->redirects[redirect_index],
+ UpdateSegments(redirects[redirect_index],
from_visit_id, last_ids.second, t, last_recorded_time_);
// Update the visit_details for this visit.
@@ -570,7 +575,7 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
// Last, save this redirect chain for later so we can set titles & favicons
// on the redirected pages properly. It is indexed by the destination page.
- recent_redirects_.Put(request->url, request->redirects);
+ recent_redirects_.Put(request.url, redirects);
}
// TODO(brettw) bug 1140015: Add an "add page" notification so the history
@@ -580,15 +585,15 @@ void HistoryBackend::AddPage(scoped_refptr<HistoryAddPageArgs> request) {
// TODO(evanm): Due to http://b/1194536 we lose the referrers of a subframe
// navigation anyway, so last_visit_id is always zero for them. But adding
// them here confuses main frame history, so we skip them for now.
- if (transition != content::PAGE_TRANSITION_AUTO_SUBFRAME &&
- transition != content::PAGE_TRANSITION_MANUAL_SUBFRAME &&
+ if (stripped_transition != content::PAGE_TRANSITION_AUTO_SUBFRAME &&
+ stripped_transition != content::PAGE_TRANSITION_MANUAL_SUBFRAME &&
!is_keyword_generated) {
- tracker_.AddVisit(request->id_scope, request->page_id, request->url,
+ tracker_.AddVisit(request.id_scope, request.page_id, request.url,
last_ids.second);
}
if (text_database_.get()) {
- text_database_->AddPageURL(request->url, last_ids.first, last_ids.second,
+ text_database_->AddPageURL(request.url, last_ids.first, last_ids.second,
last_recorded_time_);
}
diff --git a/chrome/browser/history/history_backend.h b/chrome/browser/history/history_backend.h
index 59a7836..5e66b07 100644
--- a/chrome/browser/history/history_backend.h
+++ b/chrome/browser/history/history_backend.h
@@ -145,7 +145,7 @@ class HistoryBackend : public base::RefCountedThreadSafe<HistoryBackend>,
// Navigation ----------------------------------------------------------------
- void AddPage(scoped_refptr<HistoryAddPageArgs> request);
+ void AddPage(const HistoryAddPageArgs& request);
virtual void SetPageTitle(const GURL& url, const string16& title);
void AddPageNoVisitForBookmark(const GURL& url, const string16& title);
diff --git a/chrome/browser/history/history_backend_unittest.cc b/chrome/browser/history/history_backend_unittest.cc
index c85ae97..28ece0c2 100644
--- a/chrome/browser/history/history_backend_unittest.cc
+++ b/chrome/browser/history/history_backend_unittest.cc
@@ -170,11 +170,10 @@ class HistoryBackendTest : public testing::Test {
int int_scope = 1;
void* scope = 0;
memcpy(&scope, &int_scope, sizeof(int_scope));
- scoped_refptr<history::HistoryAddPageArgs> request(
- new history::HistoryAddPageArgs(
- redirects.back(), time, scope, page_id, GURL(),
- redirects, transition, history::SOURCE_BROWSED,
- true));
+ history::HistoryAddPageArgs request(
+ redirects.back(), time, scope, page_id, GURL(),
+ redirects, transition, history::SOURCE_BROWSED,
+ true);
backend_->AddPage(request);
}
@@ -194,10 +193,10 @@ class HistoryBackendTest : public testing::Test {
redirects.push_back(url1);
if (url2.is_valid())
redirects.push_back(url2);
- scoped_refptr<HistoryAddPageArgs> request(
- new HistoryAddPageArgs(url2, time, dummy_scope, 0, url1,
- redirects, content::PAGE_TRANSITION_CLIENT_REDIRECT,
- history::SOURCE_BROWSED, did_replace));
+ HistoryAddPageArgs request(
+ url2, time, dummy_scope, 0, url1,
+ redirects, content::PAGE_TRANSITION_CLIENT_REDIRECT,
+ history::SOURCE_BROWSED, did_replace);
backend_->AddPage(request);
*transition1 = getTransition(url1);
@@ -625,11 +624,10 @@ TEST_F(HistoryBackendTest, DeleteAllThenAddData) {
Time visit_time = Time::Now();
GURL url("http://www.google.com/");
- scoped_refptr<HistoryAddPageArgs> request(
- new HistoryAddPageArgs(url, visit_time, NULL, 0, GURL(),
+ HistoryAddPageArgs request(url, visit_time, NULL, 0, GURL(),
history::RedirectList(),
content::PAGE_TRANSITION_KEYWORD_GENERATED,
- history::SOURCE_BROWSED, false));
+ history::SOURCE_BROWSED, false);
backend_->AddPage(request);
// Check that a row was added.
@@ -783,11 +781,10 @@ TEST_F(HistoryBackendTest, KeywordGenerated) {
GURL url("http://google.com");
Time visit_time = Time::Now() - base::TimeDelta::FromDays(1);
- scoped_refptr<HistoryAddPageArgs> request(
- new HistoryAddPageArgs(url, visit_time, NULL, 0, GURL(),
+ HistoryAddPageArgs request(url, visit_time, NULL, 0, GURL(),
history::RedirectList(),
content::PAGE_TRANSITION_KEYWORD_GENERATED,
- history::SOURCE_BROWSED, false));
+ history::SOURCE_BROWSED, false);
backend_->AddPage(request);
// A row should have been added for the url.
@@ -1011,25 +1008,22 @@ TEST_F(HistoryBackendTest, AddPageArgsSource) {
GURL url("http://testpageargs.com");
// Assume this page is browsed by user.
- scoped_refptr<HistoryAddPageArgs> request1(
- new HistoryAddPageArgs(url, base::Time::Now(), NULL, 0, GURL(),
+ HistoryAddPageArgs request1(url, base::Time::Now(), NULL, 0, GURL(),
history::RedirectList(),
content::PAGE_TRANSITION_KEYWORD_GENERATED,
- history::SOURCE_BROWSED, false));
+ history::SOURCE_BROWSED, false);
backend_->AddPage(request1);
// Assume this page is synced.
- scoped_refptr<HistoryAddPageArgs> request2(
- new HistoryAddPageArgs(url, base::Time::Now(), NULL, 0, GURL(),
+ HistoryAddPageArgs request2(url, base::Time::Now(), NULL, 0, GURL(),
history::RedirectList(),
content::PAGE_TRANSITION_LINK,
- history::SOURCE_SYNCED, false));
+ history::SOURCE_SYNCED, false);
backend_->AddPage(request2);
// Assume this page is browsed again.
- scoped_refptr<HistoryAddPageArgs> request3(
- new HistoryAddPageArgs(url, base::Time::Now(), NULL, 0, GURL(),
+ HistoryAddPageArgs request3(url, base::Time::Now(), NULL, 0, GURL(),
history::RedirectList(),
content::PAGE_TRANSITION_TYPED,
- history::SOURCE_BROWSED, false));
+ history::SOURCE_BROWSED, false);
backend_->AddPage(request3);
// Three visits should be added with proper sources.
diff --git a/chrome/browser/history/history_extension_api.cc b/chrome/browser/history/history_extension_api.cc
index 687c79e..7e57f7f 100644
--- a/chrome/browser/history/history_extension_api.cc
+++ b/chrome/browser/history/history_extension_api.cc
@@ -11,6 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/string_number_conversions.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/extensions/event_router.h"
@@ -331,7 +332,7 @@ bool AddUrlHistoryFunction::RunImpl() {
HistoryService* hs =
HistoryServiceFactory::GetForProfile(profile(),
Profile::EXPLICIT_ACCESS);
- hs->AddPage(url, history::SOURCE_EXTENSION);
+ hs->AddPage(url, base::Time::Now(), history::SOURCE_EXTENSION);
SendResponse(true);
return true;
diff --git a/chrome/browser/history/history_querying_unittest.cc b/chrome/browser/history/history_querying_unittest.cc
index 18d0755..1dc3f72 100644
--- a/chrome/browser/history/history_querying_unittest.cc
+++ b/chrome/browser/history/history_querying_unittest.cc
@@ -112,7 +112,7 @@ class HistoryQueryTest : public testing::Test {
GURL url(test_entries[i].url);
history_->AddPage(url, test_entries[i].time, id_scope, page_id, GURL(),
- content::PAGE_TRANSITION_LINK, history::RedirectList(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
history_->SetPageTitle(url, UTF8ToUTF16(test_entries[i].title));
history_->SetPageContents(url, UTF8ToUTF16(test_entries[i].body));
diff --git a/chrome/browser/history/history_tab_helper.cc b/chrome/browser/history/history_tab_helper.cc
index 2ab9812..326eb55 100644
--- a/chrome/browser/history/history_tab_helper.cc
+++ b/chrome/browser/history/history_tab_helper.cc
@@ -16,8 +16,8 @@
#include "content/public/browser/notification_details.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
-#include "content/public/browser/web_contents_delegate.h"
#include "content/public/browser/web_contents.h"
+#include "content/public/browser/web_contents_delegate.h"
#include "content/public/common/frame_navigate_params.h"
using content::NavigationEntry;
@@ -34,10 +34,10 @@ HistoryTabHelper::~HistoryTabHelper() {
}
void HistoryTabHelper::UpdateHistoryForNavigation(
- scoped_refptr<history::HistoryAddPageArgs> add_page_args) {
+ const history::HistoryAddPageArgs& add_page_args) {
HistoryService* hs = GetHistoryService();
if (hs)
- GetHistoryService()->AddPage(*add_page_args);
+ GetHistoryService()->AddPage(add_page_args);
}
void HistoryTabHelper::UpdateHistoryPageTitle(const NavigationEntry& entry) {
@@ -46,16 +46,18 @@ void HistoryTabHelper::UpdateHistoryPageTitle(const NavigationEntry& entry) {
hs->SetPageTitle(entry.GetVirtualURL(), entry.GetTitleForDisplay(""));
}
-scoped_refptr<history::HistoryAddPageArgs>
+history::HistoryAddPageArgs
HistoryTabHelper::CreateHistoryAddPageArgs(
const GURL& virtual_url,
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
- scoped_refptr<history::HistoryAddPageArgs> add_page_args(
- new history::HistoryAddPageArgs(
- params.url, base::Time::Now(), web_contents(), params.page_id,
+ // TODO(akalin): Use the timestamp from details.entry when it
+ // becomes available.
+ const base::Time time = base::Time::Now();
+ history::HistoryAddPageArgs add_page_args(
+ params.url, time, web_contents(), params.page_id,
params.referrer.url, params.redirects, params.transition,
- history::SOURCE_BROWSED, details.did_replace_entry));
+ history::SOURCE_BROWSED, details.did_replace_entry);
if (content::PageTransitionIsMainFrame(params.transition) &&
virtual_url != params.url) {
// Hack on the "virtual" URL so that it will appear in history. For some
@@ -64,9 +66,9 @@ HistoryTabHelper::CreateHistoryAddPageArgs(
// they saw in the URL bar, so we add the virtual URL as a redirect. This
// only applies to the main frame, as the virtual URL doesn't apply to
// sub-frames.
- add_page_args->url = virtual_url;
- if (!add_page_args->redirects.empty())
- add_page_args->redirects.back() = virtual_url;
+ add_page_args.url = virtual_url;
+ if (!add_page_args.redirects.empty())
+ add_page_args.redirects.back() = virtual_url;
}
return add_page_args;
}
@@ -101,11 +103,11 @@ void HistoryTabHelper::DidNavigateAnyFrame(
// URLs, we use a data: URL as the real value. We actually want to save the
// about: URL to the history db and keep the data: URL hidden. This is what
// the WebContents' URL getter does.
- scoped_refptr<history::HistoryAddPageArgs> add_page_args(
- CreateHistoryAddPageArgs(web_contents()->GetURL(), details, params));
+ const history::HistoryAddPageArgs& add_page_args =
+ CreateHistoryAddPageArgs(web_contents()->GetURL(), details, params);
if (!web_contents()->GetDelegate() ||
!web_contents()->GetDelegate()->ShouldAddNavigationToHistory(
- *add_page_args, details.type))
+ add_page_args, details.type))
return;
UpdateHistoryForNavigation(add_page_args);
diff --git a/chrome/browser/history/history_tab_helper.h b/chrome/browser/history/history_tab_helper.h
index 58b22ac..51109b4 100644
--- a/chrome/browser/history/history_tab_helper.h
+++ b/chrome/browser/history/history_tab_helper.h
@@ -15,7 +15,7 @@ class SkBitmap;
struct ThumbnailScore;
namespace history {
-class HistoryAddPageArgs;
+struct HistoryAddPageArgs;
}
class HistoryTabHelper : public content::WebContentsObserver,
@@ -27,7 +27,7 @@ class HistoryTabHelper : public content::WebContentsObserver,
// Updates history with the specified navigation. This is called by
// OnMsgNavigate to update history state.
void UpdateHistoryForNavigation(
- scoped_refptr<history::HistoryAddPageArgs> add_page_args);
+ const history::HistoryAddPageArgs& add_page_args);
// Sends the page title to the history service. This is called when we receive
// the page title and we know we want to update history.
@@ -35,7 +35,7 @@ class HistoryTabHelper : public content::WebContentsObserver,
// Returns the history::HistoryAddPageArgs to use for adding a page to
// history.
- scoped_refptr<history::HistoryAddPageArgs> CreateHistoryAddPageArgs(
+ history::HistoryAddPageArgs CreateHistoryAddPageArgs(
const GURL& virtual_url,
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params);
diff --git a/chrome/browser/history/history_types.cc b/chrome/browser/history/history_types.cc
index dd7c038..01ed9c3 100644
--- a/chrome/browser/history/history_types.cc
+++ b/chrome/browser/history/history_types.cc
@@ -265,35 +265,36 @@ TopSitesDelta::~TopSitesDelta() {}
// HistoryAddPageArgs ---------------------------------------------------------
+HistoryAddPageArgs::HistoryAddPageArgs()
+ : id_scope(NULL),
+ page_id(0),
+ transition(content::PAGE_TRANSITION_LINK),
+ visit_source(SOURCE_BROWSED),
+ did_replace_entry(false) {}
+
HistoryAddPageArgs::HistoryAddPageArgs(
- const GURL& arg_url,
- base::Time arg_time,
- const void* arg_id_scope,
- int32 arg_page_id,
- const GURL& arg_referrer,
- const history::RedirectList& arg_redirects,
- content::PageTransition arg_transition,
- VisitSource arg_source,
- bool arg_did_replace_entry)
- : url(arg_url),
- time(arg_time),
- id_scope(arg_id_scope),
- page_id(arg_page_id),
- referrer(arg_referrer),
- redirects(arg_redirects),
- transition(arg_transition),
- visit_source(arg_source),
- did_replace_entry(arg_did_replace_entry) {
+ const GURL& url,
+ base::Time time,
+ const void* id_scope,
+ int32 page_id,
+ const GURL& referrer,
+ const history::RedirectList& redirects,
+ content::PageTransition transition,
+ VisitSource source,
+ bool did_replace_entry)
+ : url(url),
+ time(time),
+ id_scope(id_scope),
+ page_id(page_id),
+ referrer(referrer),
+ redirects(redirects),
+ transition(transition),
+ visit_source(source),
+ did_replace_entry(did_replace_entry) {
}
HistoryAddPageArgs::~HistoryAddPageArgs() {}
-HistoryAddPageArgs* HistoryAddPageArgs::Clone() const {
- return new HistoryAddPageArgs(
- url, time, id_scope, page_id, referrer, redirects, transition,
- visit_source, did_replace_entry);
-}
-
ThumbnailMigration::ThumbnailMigration() {}
ThumbnailMigration::~ThumbnailMigration() {}
diff --git a/chrome/browser/history/history_types.h b/chrome/browser/history/history_types.h
index 4e44b4e..84bded6 100644
--- a/chrome/browser/history/history_types.h
+++ b/chrome/browser/history/history_types.h
@@ -360,22 +360,24 @@ struct FilteredURL {
// Navigation -----------------------------------------------------------------
// Marshalling structure for AddPage.
-class HistoryAddPageArgs
- : public base::RefCountedThreadSafe<HistoryAddPageArgs> {
- public:
- HistoryAddPageArgs(const GURL& arg_url,
- base::Time arg_time,
- const void* arg_id_scope,
- int32 arg_page_id,
- const GURL& arg_referrer,
- const history::RedirectList& arg_redirects,
- content::PageTransition arg_transition,
- VisitSource arg_source,
- bool arg_did_replace_entry);
-
- // Returns a new HistoryAddPageArgs that is a copy of this (ref count is
- // of course reset). Ownership of returned object passes to caller.
- HistoryAddPageArgs* Clone() const;
+struct HistoryAddPageArgs {
+ // The default constructor is equivalent to:
+ //
+ // HistoryAddPageArgs(
+ // GURL(), base::Time(), NULL, 0, GURL(),
+ // history::RedirectList(), content::PAGE_TRANSITION_LINK,
+ // SOURCE_BROWSED, false)
+ HistoryAddPageArgs();
+ HistoryAddPageArgs(const GURL& url,
+ base::Time time,
+ const void* id_scope,
+ int32 page_id,
+ const GURL& referrer,
+ const history::RedirectList& redirects,
+ content::PageTransition transition,
+ VisitSource source,
+ bool did_replace_entry);
+ ~HistoryAddPageArgs();
GURL url;
base::Time time;
@@ -388,13 +390,6 @@ class HistoryAddPageArgs
content::PageTransition transition;
VisitSource visit_source;
bool did_replace_entry;
-
- private:
- friend class base::RefCountedThreadSafe<HistoryAddPageArgs>;
-
- ~HistoryAddPageArgs();
-
- DISALLOW_COPY_AND_ASSIGN(HistoryAddPageArgs);
};
// TopSites -------------------------------------------------------------------
diff --git a/chrome/browser/history/history_unittest.cc b/chrome/browser/history/history_unittest.cc
index e339004..bddb08d 100644
--- a/chrome/browser/history/history_unittest.cc
+++ b/chrome/browser/history/history_unittest.cc
@@ -34,6 +34,7 @@
#include "base/path_service.h"
#include "base/scoped_temp_dir.h"
#include "base/string_util.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_backend.h"
@@ -476,9 +477,9 @@ TEST_F(HistoryTest, AddPage) {
// Add the page once from a child frame.
const GURL test_url("http://www.google.com/");
- history->AddPage(test_url, NULL, 0, GURL(),
- content::PAGE_TRANSITION_MANUAL_SUBFRAME,
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
history::RedirectList(),
+ content::PAGE_TRANSITION_MANUAL_SUBFRAME,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
EXPECT_EQ(1, query_url_row_.visit_count());
@@ -486,8 +487,8 @@ TEST_F(HistoryTest, AddPage) {
EXPECT_TRUE(query_url_row_.hidden()); // Hidden because of child frame.
// Add the page once from the main frame (should unhide it).
- history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(),
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
EXPECT_EQ(2, query_url_row_.visit_count()); // Added twice.
@@ -510,16 +511,14 @@ TEST_F(HistoryTest, AddPageSameTimes) {
// Make sure that two pages added at the same time with no intervening
// additions have different timestamps.
history->AddPage(test_urls[0], now, NULL, 0, GURL(),
- content::PAGE_TRANSITION_LINK,
- history::RedirectList(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_urls[0]));
EXPECT_EQ(1, query_url_row_.visit_count());
EXPECT_TRUE(now == query_url_row_.last_visit()); // gtest doesn't like Time
history->AddPage(test_urls[1], now, NULL, 0, GURL(),
- content::PAGE_TRANSITION_LINK,
- history::RedirectList(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_urls[1]));
EXPECT_EQ(1, query_url_row_.visit_count());
@@ -528,10 +527,9 @@ TEST_F(HistoryTest, AddPageSameTimes) {
// Make sure the next page, at a different time, is also correct.
history->AddPage(test_urls[2], now + TimeDelta::FromMinutes(1),
- NULL, 0, GURL(),
- content::PAGE_TRANSITION_LINK,
- history::RedirectList(),
- history::SOURCE_BROWSED, false);
+ NULL, 0, GURL(), history::RedirectList(),
+ content::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED,
+ false);
EXPECT_TRUE(QueryURL(history, test_urls[2]));
EXPECT_EQ(1, query_url_row_.visit_count());
EXPECT_TRUE(now + TimeDelta::FromMinutes(1) ==
@@ -553,9 +551,9 @@ TEST_F(HistoryTest, AddRedirect) {
// Add the sequence of pages as a server with no referrer. Note that we need
// to have a non-NULL page ID scope.
- history->AddPage(first_redirects.back(), MakeFakeHost(1), 0, GURL(),
- content::PAGE_TRANSITION_LINK, first_redirects,
- history::SOURCE_BROWSED, true);
+ history->AddPage(first_redirects.back(), base::Time::Now(), MakeFakeHost(1),
+ 0, GURL(), first_redirects, content::PAGE_TRANSITION_LINK,
+ history::SOURCE_BROWSED, true);
// The first page should be added once with a link visit type (because we set
// LINK when we added the original URL, and a referrer of nowhere (0).
@@ -591,12 +589,12 @@ TEST_F(HistoryTest, AddRedirect) {
history::RedirectList second_redirects;
second_redirects.push_back(first_redirects[1]);
second_redirects.push_back(GURL("http://last.page.com/"));
- history->AddPage(second_redirects[1], MakeFakeHost(1), 1,
- second_redirects[0],
+ history->AddPage(second_redirects[1], base::Time::Now(),
+ MakeFakeHost(1), 1, second_redirects[0], second_redirects,
static_cast<content::PageTransition>(
content::PAGE_TRANSITION_LINK |
content::PAGE_TRANSITION_CLIENT_REDIRECT),
- second_redirects, history::SOURCE_BROWSED, true);
+ history::SOURCE_BROWSED, true);
// The last page (source of the client redirect) should NOT have an
// additional visit added, because it was a client redirect (normally it
@@ -622,8 +620,9 @@ TEST_F(HistoryTest, MakeIntranetURLsTyped) {
// Add a non-typed visit to an intranet URL on an unvisited host. This should
// get promoted to a typed visit.
const GURL test_url("http://intranet_host/path");
- history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
+ history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
EXPECT_EQ(1, query_url_row_.visit_count());
EXPECT_EQ(1, query_url_row_.typed_count());
@@ -636,8 +635,9 @@ TEST_F(HistoryTest, MakeIntranetURLsTyped) {
// Different path.
const GURL test_url2("http://intranet_host/different_path");
- history->AddPage(test_url2, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history->AddPage(test_url2, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
+ history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url2));
EXPECT_EQ(1, query_url_row_.visit_count());
EXPECT_EQ(0, query_url_row_.typed_count());
@@ -647,8 +647,9 @@ TEST_F(HistoryTest, MakeIntranetURLsTyped) {
// No path.
const GURL test_url3("http://intranet_host/");
- history->AddPage(test_url3, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history->AddPage(test_url3, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
+ history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url3));
EXPECT_EQ(1, query_url_row_.visit_count());
EXPECT_EQ(0, query_url_row_.typed_count());
@@ -658,8 +659,9 @@ TEST_F(HistoryTest, MakeIntranetURLsTyped) {
// Different scheme.
const GURL test_url4("https://intranet_host/");
- history->AddPage(test_url4, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history->AddPage(test_url4, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
+ history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url4));
EXPECT_EQ(1, query_url_row_.visit_count());
EXPECT_EQ(0, query_url_row_.typed_count());
@@ -669,9 +671,10 @@ TEST_F(HistoryTest, MakeIntranetURLsTyped) {
// Different transition.
const GURL test_url5("http://intranet_host/another_path");
- history->AddPage(test_url5, NULL, 0, GURL(),
+ history->AddPage(test_url5, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(),
content::PAGE_TRANSITION_AUTO_BOOKMARK,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url5));
EXPECT_EQ(1, query_url_row_.visit_count());
EXPECT_EQ(0, query_url_row_.typed_count());
@@ -680,8 +683,9 @@ TEST_F(HistoryTest, MakeIntranetURLsTyped) {
content::PageTransitionStripQualifier(query_url_visits_[0].transition));
// Original URL.
- history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
+ history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
EXPECT_EQ(2, query_url_row_.visit_count());
EXPECT_EQ(1, query_url_row_.typed_count());
@@ -697,8 +701,8 @@ TEST_F(HistoryTest, Typed) {
// Add the page once as typed.
const GURL test_url("http://www.google.com/");
- history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_TYPED,
- history::RedirectList(),
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
@@ -707,8 +711,8 @@ TEST_F(HistoryTest, Typed) {
EXPECT_EQ(1, query_url_row_.typed_count());
// Add the page again not typed.
- history->AddPage(test_url, NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(),
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
@@ -717,8 +721,8 @@ TEST_F(HistoryTest, Typed) {
EXPECT_EQ(1, query_url_row_.typed_count());
// Add the page again as a generated URL.
- history->AddPage(test_url, NULL, 0, GURL(),
- content::PAGE_TRANSITION_GENERATED, history::RedirectList(),
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_GENERATED,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
@@ -727,8 +731,8 @@ TEST_F(HistoryTest, Typed) {
EXPECT_EQ(1, query_url_row_.typed_count());
// Add the page again as a reload.
- history->AddPage(test_url, NULL, 0, GURL(),
- content::PAGE_TRANSITION_RELOAD, history::RedirectList(),
+ history->AddPage(test_url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_RELOAD,
history::SOURCE_BROWSED, false);
EXPECT_TRUE(QueryURL(history, test_url));
@@ -744,7 +748,7 @@ TEST_F(HistoryTest, SetTitle) {
// Add a URL.
const GURL existing_url("http://www.google.com/");
- history->AddPage(existing_url, history::SOURCE_BROWSED);
+ history->AddPage(existing_url, base::Time::Now(), history::SOURCE_BROWSED);
// Set some title.
const string16 existing_title = UTF8ToUTF16("Google");
@@ -777,8 +781,8 @@ TEST_F(HistoryTest, Segments) {
// Add a URL.
const GURL existing_url("http://www.google.com/");
- history->AddPage(existing_url, scope, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, history::RedirectList(),
+ history->AddPage(existing_url, base::Time::Now(), scope, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
// Make sure a segment was created.
@@ -796,8 +800,8 @@ TEST_F(HistoryTest, Segments) {
// Add a URL which doesn't create a segment.
const GURL link_url("http://yahoo.com/");
- history->AddPage(link_url, scope, 0, GURL(),
- content::PAGE_TRANSITION_LINK, history::RedirectList(),
+ history->AddPage(link_url, base::Time::Now(), scope, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_LINK,
history::SOURCE_BROWSED, false);
// Query again
@@ -814,9 +818,10 @@ TEST_F(HistoryTest, Segments) {
EXPECT_TRUE(page_usage_data_[0]->GetURL() == existing_url);
// Add a page linked from existing_url.
- history->AddPage(GURL("http://www.google.com/foo"), scope, 3, existing_url,
- content::PAGE_TRANSITION_LINK, history::RedirectList(),
- history::SOURCE_BROWSED, false);
+ history->AddPage(GURL("http://www.google.com/foo"), base::Time::Now(),
+ scope, 3, existing_url, history::RedirectList(),
+ content::PAGE_TRANSITION_LINK, history::SOURCE_BROWSED,
+ false);
// Query again
history->QuerySegmentUsageSince(
@@ -849,11 +854,11 @@ TEST_F(HistoryTest, MostVisitedURLs) {
static const void* scope = static_cast<void*>(this);
// Add two pages.
- history->AddPage(url0, scope, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, history::RedirectList(),
+ history->AddPage(url0, base::Time::Now(), scope, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
- history->AddPage(url1, scope, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, history::RedirectList(),
+ history->AddPage(url1, base::Time::Now(), scope, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history->QueryMostVisitedURLs(20, 90, &consumer_,
base::Bind(
@@ -866,8 +871,8 @@ TEST_F(HistoryTest, MostVisitedURLs) {
EXPECT_EQ(url1, most_visited_urls_[1].url);
// Add another page.
- history->AddPage(url2, scope, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, history::RedirectList(),
+ history->AddPage(url2, base::Time::Now(), scope, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history->QueryMostVisitedURLs(20, 90, &consumer_,
base::Bind(
@@ -881,8 +886,8 @@ TEST_F(HistoryTest, MostVisitedURLs) {
EXPECT_EQ(url2, most_visited_urls_[2].url);
// Revisit url2, making it the top URL.
- history->AddPage(url2, scope, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, history::RedirectList(),
+ history->AddPage(url2, base::Time::Now(), scope, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history->QueryMostVisitedURLs(20, 90, &consumer_,
base::Bind(
@@ -896,8 +901,8 @@ TEST_F(HistoryTest, MostVisitedURLs) {
EXPECT_EQ(url1, most_visited_urls_[2].url);
// Revisit url1, making it the top URL.
- history->AddPage(url1, scope, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, history::RedirectList(),
+ history->AddPage(url1, base::Time::Now(), scope, 0, GURL(),
+ history::RedirectList(), content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history->QueryMostVisitedURLs(20, 90, &consumer_,
base::Bind(
@@ -916,8 +921,8 @@ TEST_F(HistoryTest, MostVisitedURLs) {
redirects.push_back(url4);
// Visit url4 using redirects.
- history->AddPage(url4, scope, 0, GURL(),
- content::PAGE_TRANSITION_TYPED, redirects,
+ history->AddPage(url4, base::Time::Now(), scope, 0, GURL(),
+ redirects, content::PAGE_TRANSITION_TYPED,
history::SOURCE_BROWSED, false);
history->QueryMostVisitedURLs(20, 90, &consumer_,
base::Bind(
diff --git a/chrome/browser/history/top_sites_unittest.cc b/chrome/browser/history/top_sites_unittest.cc
index 4524f92..1f57ae8 100644
--- a/chrome/browser/history/top_sites_unittest.cc
+++ b/chrome/browser/history/top_sites_unittest.cc
@@ -240,9 +240,9 @@ class TopSitesTest : public HistoryUnitTestBase {
RedirectList redirects;
redirects.push_back(url);
history_service()->AddPage(
- url, static_cast<void*>(this), 0, GURL(),
- content::PAGE_TRANSITION_TYPED,
- redirects, history::SOURCE_BROWSED, false);
+ url, base::Time::Now(), static_cast<void*>(this), 0, GURL(),
+ redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED,
+ false);
}
// Adds a page to history.
@@ -250,9 +250,9 @@ class TopSitesTest : public HistoryUnitTestBase {
RedirectList redirects;
redirects.push_back(url);
history_service()->AddPage(
- url, static_cast<void*>(this), 0, GURL(),
- content::PAGE_TRANSITION_TYPED,
- redirects, history::SOURCE_BROWSED, false);
+ url, base::Time::Now(), static_cast<void*>(this), 0, GURL(),
+ redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED,
+ false);
history_service()->SetPageTitle(url, title);
}
@@ -263,8 +263,8 @@ class TopSitesTest : public HistoryUnitTestBase {
base::Time time) {
history_service()->AddPage(
url, time, static_cast<void*>(this), 0, GURL(),
- content::PAGE_TRANSITION_TYPED,
- redirects, history::SOURCE_BROWSED, false);
+ redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED,
+ false);
history_service()->SetPageTitle(url, title);
}
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc
index 55859df..2f2f50b3 100644
--- a/chrome/browser/instant/instant_controller.cc
+++ b/chrome/browser/instant/instant_controller.cc
@@ -7,6 +7,7 @@
#include "base/command_line.h"
#include "base/i18n/case_conversion.h"
#include "base/metrics/histogram.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/autocomplete/autocomplete_provider.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
@@ -346,12 +347,12 @@ TabContents* InstantController::ReleasePreviewContents(InstantCommitType type) {
// If the preview page has navigated since the last Update(), we need to add
// the navigation to history ourselves. Else, the page will navigate after
// commit, and it will be added to history in the usual manner.
- scoped_refptr<history::HistoryAddPageArgs> last_navigation =
+ const history::HistoryAddPageArgs& last_navigation =
loader_->last_navigation();
- if (last_navigation != NULL) {
+ if (!last_navigation.url.is_empty()) {
content::NavigationEntry* entry =
preview->web_contents()->GetController().GetActiveEntry();
- DCHECK_EQ(last_navigation->url, entry->GetURL());
+ DCHECK_EQ(last_navigation.url, entry->GetURL());
// Add the page to history.
preview->history_tab_helper()->UpdateHistoryForNavigation(last_navigation);
@@ -374,8 +375,9 @@ TabContents* InstantController::ReleasePreviewContents(InstantCommitType type) {
HistoryService* history = HistoryServiceFactory::GetForProfile(
preview->profile(), Profile::EXPLICIT_ACCESS);
if (history) {
- history->AddPage(url_for_history_, NULL, 0, GURL(), last_transition_type_,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history->AddPage(url_for_history_, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(), last_transition_type_,
+ history::SOURCE_BROWSED, false);
}
AddPreviewUsageForHistogram(mode_, PREVIEW_COMMITTED);
diff --git a/chrome/browser/instant/instant_loader.cc b/chrome/browser/instant/instant_loader.cc
index 5d6d9c7..4898310 100644
--- a/chrome/browser/instant/instant_loader.cc
+++ b/chrome/browser/instant/instant_loader.cc
@@ -172,7 +172,7 @@ bool InstantLoader::WebContentsDelegateImpl::OnGoToEntryOffset(int offset) {
bool InstantLoader::WebContentsDelegateImpl::ShouldAddNavigationToHistory(
const history::HistoryAddPageArgs& add_page_args,
content::NavigationType navigation_type) {
- loader_->last_navigation_ = add_page_args.Clone();
+ loader_->last_navigation_ = add_page_args;
return false;
}
@@ -312,7 +312,7 @@ void InstantLoader::Init() {
void InstantLoader::Update(const string16& user_text, bool verbatim) {
// TODO: Support real cursor position.
- last_navigation_ = NULL;
+ last_navigation_ = history::HistoryAddPageArgs();
content::RenderViewHost* rvh =
preview_contents_->web_contents()->GetRenderViewHost();
rvh->Send(new ChromeViewMsg_SearchBoxChange(rvh->GetRoutingID(), user_text,
diff --git a/chrome/browser/instant/instant_loader.h b/chrome/browser/instant/instant_loader.h
index e767d31..c0249ea 100644
--- a/chrome/browser/instant/instant_loader.h
+++ b/chrome/browser/instant/instant_loader.h
@@ -12,6 +12,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/string16.h"
+#include "chrome/browser/history/history_types.h"
#include "chrome/browser/instant/instant_commit_type.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
@@ -30,10 +31,6 @@ namespace gfx {
class Rect;
}
-namespace history {
-class HistoryAddPageArgs;
-}
-
// InstantLoader is created with an "Instant URL". It loads the URL and tells
// its delegate (usually InstantController) of all interesting events. For
// example, it determines if the page actually supports the Instant API
@@ -95,8 +92,8 @@ class InstantLoader : public content::NotificationObserver {
const std::string& instant_url() const { return instant_url_; }
// Returns info about the last navigation by the Instant page. If the page
- // hasn't navigated since the last Update(), this contains NULL.
- scoped_refptr<history::HistoryAddPageArgs> last_navigation() const {
+ // hasn't navigated since the last Update(), the URL is empty.
+ const history::HistoryAddPageArgs& last_navigation() const {
return last_navigation_;
}
@@ -136,7 +133,7 @@ class InstantLoader : public content::NotificationObserver {
content::NotificationRegistrar registrar_;
// See comments on the getter above.
- scoped_refptr<history::HistoryAddPageArgs> last_navigation_;
+ history::HistoryAddPageArgs last_navigation_;
DISALLOW_COPY_AND_ASSIGN(InstantLoader);
};
diff --git a/chrome/browser/prerender/prerender_contents.cc b/chrome/browser/prerender/prerender_contents.cc
index 54ae9d0..15d769c 100644
--- a/chrome/browser/prerender/prerender_contents.cc
+++ b/chrome/browser/prerender/prerender_contents.cc
@@ -23,11 +23,11 @@
#include "chrome/common/icon_messages.h"
#include "chrome/common/prerender_messages.h"
#include "chrome/common/url_constants.h"
-#include "content/public/browser/resource_request_details.h"
#include "content/public/browser/browser_child_process_host.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
+#include "content/public/browser/resource_request_details.h"
#include "content/public/browser/session_storage_namespace.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_delegate.h"
@@ -107,8 +107,7 @@ class PrerenderContents::TabContentsDelegateImpl
virtual bool ShouldAddNavigationToHistory(
const history::HistoryAddPageArgs& add_page_args,
content::NavigationType navigation_type) OVERRIDE {
- add_page_vector_.push_back(
- scoped_refptr<history::HistoryAddPageArgs>(add_page_args.Clone()));
+ add_page_vector_.push_back(add_page_args);
return false;
}
@@ -175,12 +174,11 @@ class PrerenderContents::TabContentsDelegateImpl
void CommitHistory(TabContents* tab) {
for (size_t i = 0; i < add_page_vector_.size(); ++i)
tab->history_tab_helper()->UpdateHistoryForNavigation(
- add_page_vector_[i].get());
+ add_page_vector_[i]);
}
private:
- typedef std::vector<scoped_refptr<history::HistoryAddPageArgs> >
- AddPageVector;
+ typedef std::vector<history::HistoryAddPageArgs> AddPageVector;
// Caches pages to be added to the history.
AddPageVector add_page_vector_;
diff --git a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
index 9089a2c..0754df1 100644
--- a/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
+++ b/chrome/browser/safe_browsing/browser_feature_extractor_unittest.cc
@@ -21,10 +21,10 @@
#include "chrome/common/safe_browsing/csd.pb.h"
#include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "chrome/test/base/testing_profile.h"
+#include "content/public/browser/navigation_controller.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/page_transition_types.h"
#include "content/public/common/referrer.h"
-#include "content/public/browser/navigation_controller.h"
#include "content/public/test/test_browser_thread.h"
#include "content/public/test/web_contents_tester.h"
#include "googleurl/src/gurl.h"
@@ -174,28 +174,32 @@ TEST_F(BrowserFeatureExtractorTest, RequestNotInitialized) {
TEST_F(BrowserFeatureExtractorTest, UrlInHistory) {
history_service()->AddPage(GURL("http://www.foo.com/bar.html"),
+ base::Time::Now(),
history::SOURCE_BROWSED);
history_service()->AddPage(GURL("https://www.foo.com/gaa.html"),
+ base::Time::Now(),
history::SOURCE_BROWSED); // same host HTTPS.
history_service()->AddPage(GURL("http://www.foo.com/gaa.html"),
+ base::Time::Now(),
history::SOURCE_BROWSED); // same host HTTP.
history_service()->AddPage(GURL("http://bar.foo.com/gaa.html"),
+ base::Time::Now(),
history::SOURCE_BROWSED); // different host.
history_service()->AddPage(GURL("http://www.foo.com/bar.html?a=b"),
base::Time::Now() - base::TimeDelta::FromHours(23),
- NULL, 0, GURL(), content::PAGE_TRANSITION_LINK,
- history::RedirectList(), history::SOURCE_BROWSED,
- false);
+ NULL, 0, GURL(), history::RedirectList(),
+ content::PAGE_TRANSITION_LINK,
+ history::SOURCE_BROWSED, false);
history_service()->AddPage(GURL("http://www.foo.com/bar.html"),
base::Time::Now() - base::TimeDelta::FromHours(25),
- NULL, 0, GURL(), content::PAGE_TRANSITION_TYPED,
- history::RedirectList(), history::SOURCE_BROWSED,
- false);
+ NULL, 0, GURL(), history::RedirectList(),
+ content::PAGE_TRANSITION_TYPED,
+ history::SOURCE_BROWSED, false);
history_service()->AddPage(GURL("https://www.foo.com/goo.html"),
base::Time::Now() - base::TimeDelta::FromDays(5),
- NULL, 0, GURL(), content::PAGE_TRANSITION_TYPED,
- history::RedirectList(), history::SOURCE_BROWSED,
- false);
+ NULL, 0, GURL(), history::RedirectList(),
+ content::PAGE_TRANSITION_TYPED,
+ history::SOURCE_BROWSED, false);
SimpleNavigateAndCommit(GURL("http://www.foo.com/bar.html"));
@@ -239,6 +243,7 @@ TEST_F(BrowserFeatureExtractorTest, UrlInHistory) {
TEST_F(BrowserFeatureExtractorTest, MultipleRequestsAtOnce) {
history_service()->AddPage(GURL("http://www.foo.com/bar.html"),
+ base::Time::Now(),
history::SOURCE_BROWSED);
SimpleNavigateAndCommit(GURL("http:/www.foo.com/bar.html"));
ClientPhishingRequest request;
@@ -261,14 +266,19 @@ TEST_F(BrowserFeatureExtractorTest, MultipleRequestsAtOnce) {
TEST_F(BrowserFeatureExtractorTest, BrowseFeatures) {
history_service()->AddPage(GURL("http://www.foo.com/"),
+ base::Time::Now(),
history::SOURCE_BROWSED);
history_service()->AddPage(GURL("http://www.foo.com/page.html"),
+ base::Time::Now(),
history::SOURCE_BROWSED);
history_service()->AddPage(GURL("http://www.bar.com/"),
+ base::Time::Now(),
history::SOURCE_BROWSED);
history_service()->AddPage(GURL("http://www.bar.com/other_page.html"),
+ base::Time::Now(),
history::SOURCE_BROWSED);
history_service()->AddPage(GURL("http://www.baz.com/"),
+ base::Time::Now(),
history::SOURCE_BROWSED);
ClientPhishingRequest request;
diff --git a/chrome/browser/safe_browsing/malware_details_unittest.cc b/chrome/browser/safe_browsing/malware_details_unittest.cc
index 8edab8f..ad1e8f2 100644
--- a/chrome/browser/safe_browsing/malware_details_unittest.cc
+++ b/chrome/browser/safe_browsing/malware_details_unittest.cc
@@ -304,9 +304,9 @@ class MalwareDetailsTest : public ChromeRenderViewHostTestHarness {
// to history backend.
redirects->push_back(url);
history_service()->AddPage(
- url, static_cast<void*>(this), 0, GURL(),
- content::PAGE_TRANSITION_TYPED,
- *redirects, history::SOURCE_BROWSED, false);
+ url, base::Time::Now(), static_cast<void*>(this), 0, GURL(),
+ *redirects, content::PAGE_TRANSITION_TYPED, history::SOURCE_BROWSED,
+ false);
}
content::TestBrowserThread ui_thread_;
diff --git a/chrome/browser/search_engines/template_url_service.cc b/chrome/browser/search_engines/template_url_service.cc
index 598f07b..3d23b03 100644
--- a/chrome/browser/search_engines/template_url_service.cc
+++ b/chrome/browser/search_engines/template_url_service.cc
@@ -16,6 +16,7 @@
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/threading/thread_restrictions.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/google/google_url_tracker.h"
@@ -1920,9 +1921,10 @@ void TemplateURLService::AddTabToSearchVisit(const TemplateURL& t_url) {
// Synthesize a visit for the keyword. This ensures the url for the keyword is
// autocompleted even if the user doesn't type the url in directly.
- history->AddPage(url, NULL, 0, GURL(),
+ history->AddPage(url, base::Time::Now(), NULL, 0, GURL(),
+ history::RedirectList(),
content::PAGE_TRANSITION_KEYWORD_GENERATED,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ history::SOURCE_BROWSED, false);
}
// static
diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc
index c7e4091..0ef9736 100644
--- a/chrome/browser/search_engines/template_url_service_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_unittest.cc
@@ -11,6 +11,7 @@
#include "base/string_util.h"
#include "base/test/mock_time_provider.h"
#include "base/threading/thread.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/history/history.h"
#include "chrome/browser/history/history_notifications.h"
@@ -21,8 +22,8 @@
#include "chrome/browser/search_engines/template_url_prepopulate_data.h"
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_test_util.h"
-#include "chrome/browser/webdata/web_database.h"
#include "chrome/browser/webdata/web_data_service_factory.h"
+#include "chrome/browser/webdata/web_database.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/testing_profile.h"
#include "content/public/test/test_browser_thread.h"
@@ -1064,8 +1065,8 @@ TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) {
history->AddPage(
GURL(t_url->url_ref().ReplaceSearchTerms(
TemplateURLRef::SearchTermsArgs(ASCIIToUTF16("blah")))),
- NULL, 0, GURL(), content::PAGE_TRANSITION_KEYWORD,
- history::RedirectList(), history::SOURCE_BROWSED, false);
+ base::Time::Now(), NULL, 0, GURL(), history::RedirectList(),
+ content::PAGE_TRANSITION_KEYWORD, history::SOURCE_BROWSED, false);
// Wait for history to finish processing the request.
test_util_.profile()->BlockUntilHistoryProcessesPendingRequests();
diff --git a/chrome/browser/sync/test/integration/typed_urls_helper.cc b/chrome/browser/sync/test/integration/typed_urls_helper.cc
index 045ca05..b0a3897 100644
--- a/chrome/browser/sync/test/integration/typed_urls_helper.cc
+++ b/chrome/browser/sync/test/integration/typed_urls_helper.cc
@@ -160,8 +160,8 @@ void AddToHistory(HistoryService* service,
NULL, // scope
1234, // page_id
GURL(), // referrer
- transition,
history::RedirectList(),
+ transition,
source,
false);
service->SetPageTitle(url, ASCIIToUTF16(url.spec() + " - title"));
diff --git a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
index bfb000d..81e11d5 100644
--- a/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
+++ b/chrome/browser/ui/toolbar/back_forward_menu_model_unittest.cc
@@ -7,6 +7,7 @@
#include "base/path_service.h"
#include "base/string16.h"
#include "base/string_util.h"
+#include "base/time.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/favicon/favicon_service_factory.h"
#include "chrome/browser/history/history.h"
@@ -527,7 +528,7 @@ TEST_F(BackFwdMenuModelTest, FaviconLoadTest) {
// Set the desired favicon for url1.
HistoryServiceFactory::GetForProfile(
profile(), Profile::EXPLICIT_ACCESS)->AddPage(
- url1, history::SOURCE_BROWSED);
+ url1, base::Time::Now(), history::SOURCE_BROWSED);
FaviconServiceFactory::GetForProfile(
profile(), Profile::EXPLICIT_ACCESS)->SetFavicons(
url1, url1_favicon, history::FAVICON, gfx::Image(new_icon_bitmap));
diff --git a/chrome/browser/ui/views/external_tab_container_win.cc b/chrome/browser/ui/views/external_tab_container_win.cc
index 7dfe392..c913144 100644
--- a/chrome/browser/ui/views/external_tab_container_win.cc
+++ b/chrome/browser/ui/views/external_tab_container_win.cc
@@ -435,9 +435,9 @@ WebContents* ExternalTabContainerWin::OpenURLFromTab(
content::LoadCommittedDetails details;
details.did_replace_entry = false;
- scoped_refptr<history::HistoryAddPageArgs> add_page_args(
+ const history::HistoryAddPageArgs& add_page_args =
tab_contents_->history_tab_helper()->
- CreateHistoryAddPageArgs(params.url, details, nav_params));
+ CreateHistoryAddPageArgs(params.url, details, nav_params);
tab_contents_->history_tab_helper()->
UpdateHistoryForNavigation(add_page_args);
diff --git a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc
index 5400353..e40e838 100644
--- a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc
+++ b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc
@@ -9,8 +9,9 @@
#include "base/message_loop.h"
#include "base/path_service.h"
#include "base/synchronization/waitable_event.h"
-#include "base/utf_string_conversions.h"
#include "base/threading/platform_thread.h"
+#include "base/time.h"
+#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "chrome/browser/autofill/autofill_common_test.h"
#include "chrome/browser/autofill/autofill_profile.h"
@@ -146,7 +147,8 @@ static void SetupHistoryPageTest(Browser* browser,
HistoryService* history_service = HistoryServiceFactory::GetForProfile(
browser->profile(), Profile::IMPLICIT_ACCESS);
const GURL history_url = GURL(page_url);
- history_service->AddPage(history_url, history::SOURCE_BROWSED);
+ history_service->AddPage(
+ history_url, base::Time::Now(), history::SOURCE_BROWSED);
history_service->SetPageTitle(history_url, UTF8ToUTF16(page_title));
}
diff --git a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
index db3e0c8..9cf6aed 100644
--- a/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
+++ b/chrome/browser/ui/webui/web_dialog_web_contents_delegate_unittest.cc
@@ -63,12 +63,11 @@ class WebDialogWebContentsDelegateTest : public BrowserWithTestWindowTest {
TEST_F(WebDialogWebContentsDelegateTest, DoNothingMethodsTest) {
// None of the following calls should do anything.
EXPECT_TRUE(test_web_contents_delegate_->IsPopupOrPanel(NULL));
- scoped_refptr<history::HistoryAddPageArgs> should_add_args(
- new history::HistoryAddPageArgs(
+ history::HistoryAddPageArgs should_add_args(
GURL(), base::Time::Now(), 0, 0, GURL(), history::RedirectList(),
- content::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false));
+ content::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false);
EXPECT_FALSE(test_web_contents_delegate_->ShouldAddNavigationToHistory(
- *should_add_args, content::NAVIGATION_TYPE_NEW_PAGE));
+ should_add_args, content::NAVIGATION_TYPE_NEW_PAGE));
test_web_contents_delegate_->NavigationStateChanged(NULL, 0);
test_web_contents_delegate_->ActivateContents(NULL);
test_web_contents_delegate_->LoadingStateChanged(NULL);
diff --git a/chrome/browser/visitedlink/visitedlink_unittest.cc b/chrome/browser/visitedlink/visitedlink_unittest.cc
index 1fe0fa3..4ce94f0 100644
--- a/chrome/browser/visitedlink/visitedlink_unittest.cc
+++ b/chrome/browser/visitedlink/visitedlink_unittest.cc
@@ -12,6 +12,7 @@
#include "base/process_util.h"
#include "base/shared_memory.h"
#include "base/string_util.h"
+#include "base/time.h"
#include "chrome/browser/visitedlink/visitedlink_event_listener.h"
#include "chrome/browser/visitedlink/visitedlink_master.h"
#include "chrome/common/render_messages.h"
@@ -381,7 +382,8 @@ TEST_F(VisitedLinkTest, Rebuild) {
// initialize the visited link DB.
int history_count = g_test_count / 2;
for (int i = 0; i < history_count; i++)
- history_service_->AddPage(TestURL(i), history::SOURCE_BROWSED);
+ history_service_->AddPage(
+ TestURL(i), base::Time::Now(), history::SOURCE_BROWSED);
// Initialize the visited link DB. Since the visited links file doesn't exist
// and we don't suppress history rebuilding, this will load from history.
diff --git a/chrome/tools/profiles/generate_profile.cc b/chrome/tools/profiles/generate_profile.cc
index 47a8ea1..6a5e675 100644
--- a/chrome/tools/profiles/generate_profile.cc
+++ b/chrome/tools/profiles/generate_profile.cc
@@ -173,10 +173,10 @@ void InsertURLBatch(Profile* profile,
}
// Add all of this information to the history service.
- history_service->AddPage(url,
+ history_service->AddPage(url, base::Time::Now(),
id_scope, page_id,
- previous_url, transition,
- redirects, history::SOURCE_BROWSED, true);
+ previous_url, redirects,
+ transition, history::SOURCE_BROWSED, true);
ThumbnailScore score(0.75, false, false);
history_service->SetPageTitle(url, ConstructRandomTitle());
if (types & FULL_TEXT)
diff --git a/content/public/browser/web_contents_delegate.h b/content/public/browser/web_contents_delegate.h
index 48d90ac..9c4fde1 100644
--- a/content/public/browser/web_contents_delegate.h
+++ b/content/public/browser/web_contents_delegate.h
@@ -50,7 +50,7 @@ class Size;
}
namespace history {
-class HistoryAddPageArgs;
+struct HistoryAddPageArgs;
}
namespace webkit_glue {