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