| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/history/history_api.h" | 5 #include "chrome/browser/extensions/api/history/history_api.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 DispatchEvent(profile_, events::HISTORY_ON_VISIT_REMOVED, | 166 DispatchEvent(profile_, events::HISTORY_ON_VISIT_REMOVED, |
| 167 api::history::OnVisitRemoved::kEventName, std::move(args)); | 167 api::history::OnVisitRemoved::kEventName, std::move(args)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 void HistoryEventRouter::DispatchEvent( | 170 void HistoryEventRouter::DispatchEvent( |
| 171 Profile* profile, | 171 Profile* profile, |
| 172 events::HistogramValue histogram_value, | 172 events::HistogramValue histogram_value, |
| 173 const std::string& event_name, | 173 const std::string& event_name, |
| 174 std::unique_ptr<base::ListValue> event_args) { | 174 std::unique_ptr<base::ListValue> event_args) { |
| 175 if (profile && EventRouter::Get(profile)) { | 175 if (profile && EventRouter::Get(profile)) { |
| 176 std::unique_ptr<Event> event( | 176 auto event = base::MakeUnique<Event>(histogram_value, event_name, |
| 177 new Event(histogram_value, event_name, std::move(event_args))); | 177 std::move(event_args), profile); |
| 178 event->restrict_to_browser_context = profile; | |
| 179 EventRouter::Get(profile)->BroadcastEvent(std::move(event)); | 178 EventRouter::Get(profile)->BroadcastEvent(std::move(event)); |
| 180 } | 179 } |
| 181 } | 180 } |
| 182 | 181 |
| 183 HistoryAPI::HistoryAPI(content::BrowserContext* context) | 182 HistoryAPI::HistoryAPI(content::BrowserContext* context) |
| 184 : browser_context_(context) { | 183 : browser_context_(context) { |
| 185 EventRouter* event_router = EventRouter::Get(browser_context_); | 184 EventRouter* event_router = EventRouter::Get(browser_context_); |
| 186 event_router->RegisterObserver(this, api::history::OnVisited::kEventName); | 185 event_router->RegisterObserver(this, api::history::OnVisited::kEventName); |
| 187 event_router->RegisterObserver(this, | 186 event_router->RegisterObserver(this, |
| 188 api::history::OnVisitRemoved::kEventName); | 187 api::history::OnVisitRemoved::kEventName); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 AddRef(); // Balanced in DeleteComplete(). | 443 AddRef(); // Balanced in DeleteComplete(). |
| 445 return RespondLater(); // DeleteComplete() will be called asynchronously. | 444 return RespondLater(); // DeleteComplete() will be called asynchronously. |
| 446 } | 445 } |
| 447 | 446 |
| 448 void HistoryDeleteAllFunction::DeleteComplete() { | 447 void HistoryDeleteAllFunction::DeleteComplete() { |
| 449 Respond(NoArguments()); | 448 Respond(NoArguments()); |
| 450 Release(); // Balanced in Run(). | 449 Release(); // Balanced in Run(). |
| 451 } | 450 } |
| 452 | 451 |
| 453 } // namespace extensions | 452 } // namespace extensions |
| OLD | NEW |