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

Unified Diff: chrome/browser/extensions/api/feedback_private/single_log_source_factory.h

Issue 2840103002: Add new API function: feedbackPrivate.readLogSource (Closed)
Patch Set: Add proper ifdefs for non-CrOS platforms Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/feedback_private/single_log_source_factory.h
diff --git a/chrome/browser/extensions/api/feedback_private/single_log_source_factory.h b/chrome/browser/extensions/api/feedback_private/single_log_source_factory.h
new file mode 100644
index 0000000000000000000000000000000000000000..6d7e710a60a31f13cdf2d0db0a5c2abcc852d3e3
--- /dev/null
+++ b/chrome/browser/extensions/api/feedback_private/single_log_source_factory.h
@@ -0,0 +1,37 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY_H_
+#define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY_H_
+
+#include <memory>
+
+#include "base/callback.h"
+#include "chrome/browser/chromeos/system_logs/single_log_source.h"
+
+namespace extensions {
+
+// Provides a way to override the creation of a new SingleLogSource during
+// testing.
+class SingleLogSourceFactory {
+ public:
+ using CreateCallback =
+ base::Callback<std::unique_ptr<system_logs::SingleLogSource>(
+ system_logs::SingleLogSource::SupportedSource)>;
+
+ // Returns a SingleLogSource with source type of |type|. The caller must take
+ // ownership of the returned object.
+ static std::unique_ptr<system_logs::SingleLogSource> CreateSingleLogSource(
+ system_logs::SingleLogSource::SupportedSource type);
+
+ // Pass in a callback that gets executed instead of the default behavior of
+ // CreateSingleLogSource. Does not take ownership of |callback|. When done
+ // testing, call this function again with |callback|=nullptr to restore the
+ // default behavior.
+ static void SetForTesting(CreateCallback* callback);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_SINGLE_LOG_SOURCE_FACTORY_H_

Powered by Google App Engine
This is Rietveld 408576698