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 #include "chrome/browser/extensions/api/feedback_private/single_log_source_facto
ry.h" | 5 #include "chrome/browser/extensions/api/feedback_private/single_log_source_facto
ry.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/chromeos/system_logs/single_debug_daemon_log_source.h" |
8 #include "chrome/browser/chromeos/system_logs/single_log_file_log_source.h" | 9 #include "chrome/browser/chromeos/system_logs/single_log_file_log_source.h" |
9 | 10 |
10 namespace extensions { | 11 namespace extensions { |
11 | 12 |
12 namespace { | 13 namespace { |
13 | 14 |
14 namespace feedback_private = api::feedback_private; | 15 namespace feedback_private = api::feedback_private; |
15 | 16 |
| 17 using system_logs::SingleDebugDaemonLogSource; |
16 using system_logs::SingleLogFileLogSource; | 18 using system_logs::SingleLogFileLogSource; |
17 using system_logs::SystemLogsSource; | 19 using system_logs::SystemLogsSource; |
18 | 20 |
19 SingleLogSourceFactory::CreateCallback* g_callback = nullptr; | 21 SingleLogSourceFactory::CreateCallback* g_callback = nullptr; |
20 | 22 |
21 } // namespace | 23 } // namespace |
22 | 24 |
23 // static | 25 // static |
24 std::unique_ptr<SystemLogsSource> SingleLogSourceFactory::CreateSingleLogSource( | 26 std::unique_ptr<SystemLogsSource> SingleLogSourceFactory::CreateSingleLogSource( |
25 feedback_private::LogSource source_type) { | 27 feedback_private::LogSource source_type) { |
26 if (g_callback) | 28 if (g_callback) |
27 return g_callback->Run(source_type); | 29 return g_callback->Run(source_type); |
28 | 30 |
29 switch (source_type) { | 31 switch (source_type) { |
30 case feedback_private::LOG_SOURCE_MESSAGES: | 32 case feedback_private::LOG_SOURCE_MESSAGES: |
31 return base::MakeUnique<system_logs::SingleLogFileLogSource>( | 33 return base::MakeUnique<system_logs::SingleLogFileLogSource>( |
32 SingleLogFileLogSource::SupportedSource::kMessages); | 34 SingleLogFileLogSource::SupportedSource::kMessages); |
33 case feedback_private::LOG_SOURCE_UILATEST: | 35 case feedback_private::LOG_SOURCE_UILATEST: |
34 return base::MakeUnique<system_logs::SingleLogFileLogSource>( | 36 return base::MakeUnique<system_logs::SingleLogFileLogSource>( |
35 SingleLogFileLogSource::SupportedSource::kUiLatest); | 37 SingleLogFileLogSource::SupportedSource::kUiLatest); |
| 38 case feedback_private::LOG_SOURCE_DRMMODETEST: |
| 39 return base::MakeUnique<system_logs::SingleDebugDaemonLogSource>( |
| 40 SingleDebugDaemonLogSource::SupportedSource::kModetest); |
| 41 case feedback_private::LOG_SOURCE_LSUSB: |
| 42 return base::MakeUnique<system_logs::SingleDebugDaemonLogSource>( |
| 43 SingleDebugDaemonLogSource::SupportedSource::kLsusb); |
36 case feedback_private::LOG_SOURCE_NONE: | 44 case feedback_private::LOG_SOURCE_NONE: |
37 default: | 45 default: |
38 NOTREACHED() << "Unknown log source type."; | 46 NOTREACHED() << "Unknown log source type."; |
39 break; | 47 break; |
40 } | 48 } |
41 return std::unique_ptr<SystemLogsSource>(nullptr); | 49 return std::unique_ptr<SystemLogsSource>(nullptr); |
42 } | 50 } |
43 | 51 |
44 // static | 52 // static |
45 void SingleLogSourceFactory::SetForTesting( | 53 void SingleLogSourceFactory::SetForTesting( |
46 SingleLogSourceFactory::CreateCallback* callback) { | 54 SingleLogSourceFactory::CreateCallback* callback) { |
47 g_callback = callback; | 55 g_callback = callback; |
48 } | 56 } |
49 | 57 |
50 } // namespace extensions | 58 } // namespace extensions |
OLD | NEW |