Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: chrome/browser/extensions/api/feedback_private/single_log_source_factory.cc

Issue 2956513004: Rename SingleLogSource to SingleLogFileLogSource (Closed)
Patch Set: Rebased Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/extensions/api/feedback_private/single_log_source_factory.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_log_file_log_source.h"
8 9
9 namespace extensions { 10 namespace extensions {
10 11
11 namespace { 12 namespace {
12 13
13 using system_logs::SingleLogSource; 14 namespace feedback_private = api::feedback_private;
15
16 using system_logs::SingleLogFileLogSource;
17 using system_logs::SystemLogsSource;
14 18
15 SingleLogSourceFactory::CreateCallback* g_callback = nullptr; 19 SingleLogSourceFactory::CreateCallback* g_callback = nullptr;
16 20
17 } // namespace 21 } // namespace
18 22
19 // static 23 // static
20 std::unique_ptr<SingleLogSource> SingleLogSourceFactory::CreateSingleLogSource( 24 std::unique_ptr<SystemLogsSource> SingleLogSourceFactory::CreateSingleLogSource(
21 SingleLogSource::SupportedSource type) { 25 feedback_private::LogSource source_type) {
22 if (g_callback) 26 if (g_callback)
23 return g_callback->Run(type); 27 return g_callback->Run(source_type);
24 return base::MakeUnique<SingleLogSource>(type); 28
29 switch (source_type) {
30 case feedback_private::LOG_SOURCE_MESSAGES:
31 return base::MakeUnique<system_logs::SingleLogFileLogSource>(
32 SingleLogFileLogSource::SupportedSource::kMessages);
33 case feedback_private::LOG_SOURCE_UILATEST:
34 return base::MakeUnique<system_logs::SingleLogFileLogSource>(
35 SingleLogFileLogSource::SupportedSource::kUiLatest);
36 case feedback_private::LOG_SOURCE_NONE:
37 default:
38 NOTREACHED() << "Unknown log source type.";
39 break;
40 }
41 return std::unique_ptr<SystemLogsSource>(nullptr);
25 } 42 }
26 43
27 // static 44 // static
28 void SingleLogSourceFactory::SetForTesting( 45 void SingleLogSourceFactory::SetForTesting(
29 SingleLogSourceFactory::CreateCallback* callback) { 46 SingleLogSourceFactory::CreateCallback* callback) {
30 g_callback = callback; 47 g_callback = callback;
31 } 48 }
32 49
33 } // namespace extensions 50 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/api/feedback_private/single_log_source_factory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698