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

Side by Side Diff: chrome/browser/extensions/api/history/history_api.cc

Issue 11820041: Remove profile-keyed factory boilerplates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 7 years, 11 months 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 unified diff | Download patch
OLDNEW
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 "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/json/json_writer.h" 10 #include "base/json/json_writer.h"
11 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/message_loop.h" 13 #include "base/message_loop.h"
13 #include "base/string_number_conversions.h" 14 #include "base/string_number_conversions.h"
14 #include "base/time.h" 15 #include "base/time.h"
15 #include "base/utf_string_conversions.h" 16 #include "base/utf_string_conversions.h"
16 #include "base/values.h" 17 #include "base/values.h"
17 #include "chrome/browser/extensions/event_router.h" 18 #include "chrome/browser/extensions/event_router.h"
18 #include "chrome/browser/extensions/extension_system.h" 19 #include "chrome/browser/extensions/extension_system.h"
19 #include "chrome/browser/history/history.h" 20 #include "chrome/browser/history/history.h"
20 #include "chrome/browser/history/history_service_factory.h" 21 #include "chrome/browser/history/history_service_factory.h"
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 this, kOnVisitRemoved); 206 this, kOnVisitRemoved);
206 } 207 }
207 208
208 HistoryAPI::~HistoryAPI() { 209 HistoryAPI::~HistoryAPI() {
209 } 210 }
210 211
211 void HistoryAPI::Shutdown() { 212 void HistoryAPI::Shutdown() {
212 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 213 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
213 } 214 }
214 215
216 static base::LazyInstance<ProfileKeyedAPIFactory<HistoryAPI> >
217 g_factory = LAZY_INSTANCE_INITIALIZER;
218
219 // static
220 ProfileKeyedAPIFactory<HistoryAPI>* HistoryAPI::GetFactoryInstance() {
221 return &g_factory.Get();
222 }
223
215 void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) { 224 void HistoryAPI::OnListenerAdded(const EventListenerInfo& details) {
216 history_event_router_.reset(new HistoryEventRouter(profile_)); 225 history_event_router_.reset(new HistoryEventRouter(profile_));
217 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this); 226 ExtensionSystem::Get(profile_)->event_router()->UnregisterObserver(this);
218 } 227 }
219 228
220 void HistoryFunction::Run() { 229 void HistoryFunction::Run() {
221 if (!RunImpl()) { 230 if (!RunImpl()) {
222 SendResponse(false); 231 SendResponse(false);
223 } 232 }
224 } 233 }
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 &task_tracker_); 474 &task_tracker_);
466 475
467 return true; 476 return true;
468 } 477 }
469 478
470 void HistoryDeleteAllFunction::DeleteComplete() { 479 void HistoryDeleteAllFunction::DeleteComplete() {
471 SendAsyncResponse(); 480 SendAsyncResponse();
472 } 481 }
473 482
474 } // namespace extensions 483 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/history/history_api.h ('k') | chrome/browser/extensions/api/history/history_api_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698