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