Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 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 #include "chrome/browser/extensions/api/feedback_private/single_log_source_facto ry.h" | |
| 6 | |
| 7 #include "base/memory/ptr_util.h" | |
| 8 | |
| 9 namespace extensions { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 using system_logs::SingleLogSource; | |
| 14 | |
| 15 const SingleLogSourceFactory::CreateCallback* g_callback = nullptr; | |
| 16 | |
| 17 } // namespace | |
| 18 | |
| 19 // static | |
| 20 std::unique_ptr<SingleLogSource> SingleLogSourceFactory::CreateSingleLogSource( | |
| 21 SingleLogSource::SupportedSource type) { | |
| 22 if (g_callback) | |
| 23 return std::unique_ptr<SingleLogSource>(g_callback->Run(type)); | |
|
tbarzic
2017/06/06 20:27:26
Can't g_callback return unique_ptr directly?
Simon Que
2017/06/06 22:29:15
Done.
| |
| 24 return base::MakeUnique<SingleLogSource>(type); | |
| 25 } | |
| 26 | |
| 27 // static | |
| 28 void SingleLogSourceFactory::SetForTesting( | |
| 29 const SingleLogSourceFactory::CreateCallback* callback) { | |
| 30 g_callback = callback; | |
| 31 } | |
| 32 | |
| 33 } // namespace extensions | |
| OLD | NEW |