| Index: chrome/browser/extensions/api/feedback_private/feedback_private_api.h
|
| diff --git a/chrome/browser/extensions/api/feedback_private/feedback_private_api.h b/chrome/browser/extensions/api/feedback_private/feedback_private_api.h
|
| index 3ff94b9c3f70f5f313d42f5b347febf6d19bc50d..fc1d8d9dca42c8b025ff10e3b8a0304f6913dd0e 100644
|
| --- a/chrome/browser/extensions/api/feedback_private/feedback_private_api.h
|
| +++ b/chrome/browser/extensions/api/feedback_private/feedback_private_api.h
|
| @@ -12,6 +12,12 @@
|
| #include "extensions/browser/extension_function.h"
|
| #include "ui/gfx/geometry/rect.h"
|
|
|
| +#if defined(OS_CHROMEOS)
|
| +#include "base/time/time.h"
|
| +#include "chrome/browser/extensions/api/feedback_private/log_source_access_manager.h"
|
| +#include "chrome/browser/extensions/api/feedback_private/log_source_resource.h"
|
| +#endif // defined(OS_CHROMEOS)
|
| +
|
| namespace extensions {
|
|
|
| class FeedbackService;
|
| @@ -23,6 +29,12 @@ class FeedbackPrivateAPI : public BrowserContextKeyedAPI {
|
|
|
| FeedbackService* GetService() const;
|
|
|
| +#if defined(OS_CHROMEOS)
|
| + LogSourceAccessManager* log_source_access_manager() {
|
| + return log_source_access_manager_;
|
| + }
|
| +#endif // defined(OS_CHROMEOS)
|
| +
|
| void RequestFeedback(const std::string& description_template,
|
| const std::string& category_tag,
|
| const GURL& page_url);
|
| @@ -48,6 +60,10 @@ class FeedbackPrivateAPI : public BrowserContextKeyedAPI {
|
|
|
| content::BrowserContext* const browser_context_;
|
| FeedbackService* service_;
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + LogSourceAccessManager* log_source_access_manager_;
|
| +#endif // defined(OS_CHROMEOS)
|
| };
|
|
|
| // Feedback strings.
|
| @@ -95,6 +111,46 @@ class FeedbackPrivateGetSystemInformationFunction
|
| void OnCompleted(std::unique_ptr<system_logs::SystemLogsResponse> sys_info);
|
| };
|
|
|
| +// This function only reads from actual log sources on Chrome OS. On other
|
| +// platforms, it just returns EmptyResponse().
|
| +class FeedbackPrivateReadLogSourceFunction : public UIThreadExtensionFunction {
|
| + public:
|
| + DECLARE_EXTENSION_FUNCTION("feedbackPrivate.readLogSource",
|
| + FEEDBACKPRIVATE_READLOGSOURCE);
|
| +
|
| + protected:
|
| + ~FeedbackPrivateReadLogSourceFunction() override {}
|
| + ResponseAction Run() override;
|
| +
|
| +#if defined(OS_CHROMEOS)
|
| + private:
|
| + // Looks for an existing LogSourceResource in the API Resource Manager with
|
| + // id=|*reader_id|.
|
| + // - If the resource exists and was created by the same extension, returns the
|
| + // resource.
|
| + // - If the resource exists and was created by a different extension, returns
|
| + // nullptr.
|
| + // - If the resource does not exist and there is no existing resource with
|
| + // source=|source| for the current extension, creates one, stores it in the
|
| + // API Resource Manager, and returns it.
|
| + // - If the resource does not exist and there is already an existing resource
|
| + // source=|source| for the current extension, returns nullptr.
|
| + //
|
| + // |*reader_id|=0 means the resource does not exist. In that case, the created
|
| + // resource will have a new ID that is returned in |*reader_id|.
|
| + //
|
| + // All returned pointers are owned by the API Resource Manager.
|
| + LogSourceResource* GetOrCreateLogSourceResource(
|
| + int* reader_id,
|
| + api::feedback_private::LogSource source);
|
| +
|
| + void OnCompleted(api::feedback_private::LogSource source,
|
| + int readerId,
|
| + bool incremental,
|
| + system_logs::SystemLogsResponse* response);
|
| +#endif // defined(OS_CHROMEOS)
|
| +};
|
| +
|
| class FeedbackPrivateSendFeedbackFunction
|
| : public ChromeAsyncExtensionFunction {
|
| public:
|
|
|