OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_PUBLIC_BROWSER_GRAPH_BROWSER_CONTEXT_DEPENDENCY_VISITOR_IMPL_H_ |
| 6 #define CONTENT_PUBLIC_BROWSER_GRAPH_BROWSER_CONTEXT_DEPENDENCY_VISITOR_IMPL_H_ |
| 7 |
| 8 #include "base/callback.h" |
| 9 #include "base/compiler_specific.h" |
| 10 #include "base/graph/dependency_manager_instance.h" |
| 11 #include "content/public/browser/graph/browser_context_dependency_visitor.h" |
| 12 |
| 13 namespace content { |
| 14 |
| 15 template <typename Component> |
| 16 class BrowserContextDependencyVisitorImpl |
| 17 : public BrowserContextDependencyVisitor { |
| 18 public: |
| 19 explicit BrowserContextDependencyVisitorImpl( |
| 20 const base::Callback<void(Component*)>& completion_callback) |
| 21 : completion_callback_(completion_callback) {} |
| 22 |
| 23 virtual void Visit( |
| 24 graph::DependencyManagerInstance* dependency_manager) OVERRIDE { |
| 25 if (dependency_manager) |
| 26 dependency_manager->Get<Component>(completion_callback_); |
| 27 else |
| 28 completion_callback_.Run(NULL); |
| 29 } |
| 30 |
| 31 private: |
| 32 base::Callback<void(Component*)> completion_callback_; |
| 33 }; |
| 34 |
| 35 } // namespace content |
| 36 |
| 37 #endif // CONTENT_PUBLIC_BROWSER_GRAPH_BROWSER_CONTEXT_DEPENDENCY_VISITOR_IMPL_
H_ |
OLD | NEW |