OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY
_H_ | 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_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY
_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "chrome/browser/feedback/system_logs/system_logs_fetcher.h" | |
12 #include "chrome/common/extensions/api/feedback_private.h" | 11 #include "chrome/common/extensions/api/feedback_private.h" |
| 12 #include "components/feedback/system_logs/system_logs_fetcher.h" |
13 | 13 |
14 namespace extensions { | 14 namespace extensions { |
15 | 15 |
16 // Provides a way to override the creation of a new Single*LogSource during | 16 // Provides a way to override the creation of a new Single*LogSource during |
17 // testing. | 17 // testing. |
18 class SingleLogSourceFactory { | 18 class SingleLogSourceFactory { |
19 public: | 19 public: |
20 using CreateCallback = | 20 using CreateCallback = |
21 base::Callback<std::unique_ptr<system_logs::SystemLogsSource>( | 21 base::Callback<std::unique_ptr<system_logs::SystemLogsSource>( |
22 api::feedback_private::LogSource)>; | 22 api::feedback_private::LogSource)>; |
23 | 23 |
24 // Returns a Single*LogSource with source type corresponding to |type|. The | 24 // Returns a Single*LogSource with source type corresponding to |type|. The |
25 // caller must takeownership of the returned object. | 25 // caller must takeownership of the returned object. |
26 static std::unique_ptr<system_logs::SystemLogsSource> CreateSingleLogSource( | 26 static std::unique_ptr<system_logs::SystemLogsSource> CreateSingleLogSource( |
27 api::feedback_private::LogSource type); | 27 api::feedback_private::LogSource type); |
28 | 28 |
29 // Pass in a callback that gets executed instead of the default behavior of | 29 // Pass in a callback that gets executed instead of the default behavior of |
30 // CreateSingleLogSource. Does not take ownership of |callback|. When done | 30 // CreateSingleLogSource. Does not take ownership of |callback|. When done |
31 // testing, call this function again with |callback|=nullptr to restore the | 31 // testing, call this function again with |callback|=nullptr to restore the |
32 // default behavior. | 32 // default behavior. |
33 static void SetForTesting(CreateCallback* callback); | 33 static void SetForTesting(CreateCallback* callback); |
34 }; | 34 }; |
35 | 35 |
36 } // namespace extensions | 36 } // namespace extensions |
37 | 37 |
38 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACT
ORY_H_ | 38 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACT
ORY_H_ |
OLD | NEW |