Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2241)

Unified Diff: chrome/browser/extensions/api/history/history_api.cc

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/history/history_api.cc
diff --git a/chrome/browser/extensions/api/history/history_api.cc b/chrome/browser/extensions/api/history/history_api.cc
index 196ecaaf4cc5e6a73c38a7a5f77446573959fc41..76e646c550b136e84f104c06e38db355213bb535 100644
--- a/chrome/browser/extensions/api/history/history_api.cc
+++ b/chrome/browser/extensions/api/history/history_api.cc
@@ -18,7 +18,6 @@
#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
#include "base/values.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/activity_log/activity_log.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h"
@@ -27,8 +26,6 @@
#include "chrome/common/extensions/api/history.h"
#include "chrome/common/pref_names.h"
#include "components/history/core/browser/history_types.h"
-#include "content/public/browser/notification_details.h"
-#include "content/public/browser/notification_source.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_system_provider.h"
#include "extensions/browser/extensions_browser_client.h"
@@ -135,24 +132,12 @@ HistoryEventRouter::HistoryEventRouter(Profile* profile,
HistoryService* history_service)
: profile_(profile), history_service_observer_(this) {
DCHECK(profile);
- registrar_.Add(this,
- chrome::NOTIFICATION_HISTORY_URLS_DELETED,
- content::Source<Profile>(profile));
history_service_observer_.Add(history_service);
}
HistoryEventRouter::~HistoryEventRouter() {
}
-void HistoryEventRouter::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED);
- HistoryUrlsRemoved(
- content::Source<Profile>(source).ptr(),
- content::Details<const history::URLsDeletedDetails>(details).ptr());
-}
-
void HistoryEventRouter::OnURLVisited(HistoryService* history_service,
ui::PageTransition transition,
const history::URLRow& row,
@@ -163,21 +148,25 @@ void HistoryEventRouter::OnURLVisited(HistoryService* history_service,
DispatchEvent(profile_, api::history::OnVisited::kEventName, args.Pass());
}
-void HistoryEventRouter::HistoryUrlsRemoved(
- Profile* profile,
- const history::URLsDeletedDetails* details) {
+void HistoryEventRouter::OnURLsDeleted(HistoryService* history_service,
+ bool all_history,
+ bool expired,
+ const history::URLRows& deleted_rows,
+ const std::set<GURL>& favicon_urls) {
+ DCHECK_EQ(HistoryServiceFactory::GetForProfileIfExists(
+ profile_, Profile::EXPLICIT_ACCESS),
+ history_service);
OnVisitRemoved::Removed removed;
- removed.all_history = details->all_history;
+ removed.all_history = all_history;
std::vector<std::string>* urls = new std::vector<std::string>();
- for (history::URLRows::const_iterator iterator = details->rows.begin();
- iterator != details->rows.end(); ++iterator) {
- urls->push_back(iterator->url().spec());
- }
+ for (const auto& row : deleted_rows)
+ urls->push_back(row.url().spec());
removed.urls.reset(urls);
scoped_ptr<base::ListValue> args = OnVisitRemoved::Create(removed);
- DispatchEvent(profile, api::history::OnVisitRemoved::kEventName, args.Pass());
+ DispatchEvent(profile_, api::history::OnVisitRemoved::kEventName,
+ args.Pass());
}
void HistoryEventRouter::DispatchEvent(

Powered by Google App Engine
This is Rietveld 408576698