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/processes/processes_api.h" | 5 #include "chrome/browser/extensions/api/processes/processes_api.h" |
6 | 6 |
7 #include "base/callback.h" | 7 #include "base/callback.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
501 } | 501 } |
502 | 502 |
503 ProcessesAPI::~ProcessesAPI() { | 503 ProcessesAPI::~ProcessesAPI() { |
504 } | 504 } |
505 | 505 |
506 void ProcessesAPI::Shutdown() { | 506 void ProcessesAPI::Shutdown() { |
507 ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver( | 507 ExtensionSystem::Get(browser_context_)->event_router()->UnregisterObserver( |
508 this); | 508 this); |
509 } | 509 } |
510 | 510 |
511 static base::LazyInstance<ProfileKeyedAPIFactory<ProcessesAPI> > | 511 static base::LazyInstance<BrowserContextKeyedAPIFactory<ProcessesAPI> > |
512 g_factory = LAZY_INSTANCE_INITIALIZER; | 512 g_factory = LAZY_INSTANCE_INITIALIZER; |
513 | 513 |
514 // static | 514 // static |
515 ProfileKeyedAPIFactory<ProcessesAPI>* ProcessesAPI::GetFactoryInstance() { | 515 BrowserContextKeyedAPIFactory<ProcessesAPI>* |
| 516 ProcessesAPI::GetFactoryInstance() { |
516 return g_factory.Pointer(); | 517 return g_factory.Pointer(); |
517 } | 518 } |
518 | 519 |
519 // static | 520 // static |
520 ProcessesAPI* ProcessesAPI::Get(content::BrowserContext* context) { | 521 ProcessesAPI* ProcessesAPI::Get(content::BrowserContext* context) { |
521 return ProfileKeyedAPIFactory<ProcessesAPI>::GetForProfile(context); | 522 return BrowserContextKeyedAPIFactory<ProcessesAPI>::Get(context); |
522 } | 523 } |
523 | 524 |
524 ProcessesEventRouter* ProcessesAPI::processes_event_router() { | 525 ProcessesEventRouter* ProcessesAPI::processes_event_router() { |
525 if (!processes_event_router_) | 526 if (!processes_event_router_) |
526 processes_event_router_.reset(new ProcessesEventRouter(browser_context_)); | 527 processes_event_router_.reset(new ProcessesEventRouter(browser_context_)); |
527 return processes_event_router_.get(); | 528 return processes_event_router_.get(); |
528 } | 529 } |
529 | 530 |
530 void ProcessesAPI::OnListenerAdded(const EventListenerInfo& details) { | 531 void ProcessesAPI::OnListenerAdded(const EventListenerInfo& details) { |
531 // We lazily tell the TaskManager to start updating when listeners to the | 532 // We lazily tell the TaskManager to start updating when listeners to the |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 | 763 |
763 SetResult(processes); | 764 SetResult(processes); |
764 SendResponse(true); | 765 SendResponse(true); |
765 | 766 |
766 // Balance the AddRef in the RunImpl. | 767 // Balance the AddRef in the RunImpl. |
767 Release(); | 768 Release(); |
768 #endif // defined(ENABLE_TASK_MANAGER) | 769 #endif // defined(ENABLE_TASK_MANAGER) |
769 } | 770 } |
770 | 771 |
771 } // namespace extensions | 772 } // namespace extensions |
OLD | NEW |