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 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY _H_ | |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY _H_ | |
| 7 | |
| 8 #include "base/callback.h" | |
| 9 #include "chrome/browser/chromeos/system_logs/single_log_source.h" | |
| 10 | |
| 11 namespace extensions { | |
| 12 | |
| 13 // Provides a way to override the creation of a new SingleLogSource during | |
| 14 // testing. | |
| 15 class SingleLogSourceFactory { | |
| 16 public: | |
| 17 using CreateCallback = base::Callback<system_logs::SingleLogSource*( | |
| 18 system_logs::SingleLogSource::SupportedSource)>; | |
| 19 | |
| 20 // Returns a SingleLogSource with source type of |type|. The caller must take | |
| 21 // ownership of the returned object. | |
|
tbarzic
2017/05/22 23:02:55
return unique_ptr
Simon Que
2017/05/23 20:01:20
Done.
| |
| 22 static system_logs::SingleLogSource* CreateSingleLogSource( | |
| 23 system_logs::SingleLogSource::SupportedSource type); | |
| 24 | |
| 25 // Pass in a callback that gets executed instead of the default behavior of | |
| 26 // CreateSingleLogSource. Does not take ownership of |callback|. When done | |
| 27 // testing, call this function again with |callback|=nullptr to restore the | |
| 28 // default behavior. | |
| 29 static void InitForTesting(const CreateCallback* callback); | |
| 30 }; | |
| 31 | |
| 32 } // namespace extensions | |
| 33 | |
| 34 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACT ORY_H_ | |
| OLD | NEW |