Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / extensions / api / feedback_private / feedback_private_api.h
blobdfe83e6465e71bd4617bfc254935c3a5abb292e2
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_
8 #include "chrome/browser/extensions/chrome_extension_function.h"
9 #include "chrome/common/extensions/api/feedback_private.h"
10 #include "extensions/browser/browser_context_keyed_api_factory.h"
11 #include "ui/gfx/geometry/rect.h"
13 namespace extensions {
15 extern char kFeedbackExtensionId[];
17 class FeedbackService;
19 using extensions::api::feedback_private::SystemInformation;
21 class FeedbackPrivateAPI : public BrowserContextKeyedAPI {
22 public:
23 explicit FeedbackPrivateAPI(content::BrowserContext* context);
24 ~FeedbackPrivateAPI() override;
26 FeedbackService* GetService() const;
27 void RequestFeedback(const std::string& description_template,
28 const std::string& category_tag,
29 const GURL& page_url);
31 // BrowserContextKeyedAPI implementation.
32 static BrowserContextKeyedAPIFactory<FeedbackPrivateAPI>*
33 GetFactoryInstance();
35 private:
36 friend class BrowserContextKeyedAPIFactory<FeedbackPrivateAPI>;
38 // BrowserContextKeyedAPI implementation.
39 static const char* service_name() {
40 return "FeedbackPrivateAPI";
43 static const bool kServiceHasOwnInstanceInIncognito = true;
45 content::BrowserContext* const browser_context_;
46 FeedbackService* service_;
49 // Feedback strings.
50 class FeedbackPrivateGetStringsFunction : public ChromeSyncExtensionFunction {
51 public:
52 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getStrings",
53 FEEDBACKPRIVATE_GETSTRINGS)
55 // Invoke this callback when this function is called - used for testing.
56 static void set_test_callback(base::Closure* const callback) {
57 test_callback_ = callback;
60 protected:
61 ~FeedbackPrivateGetStringsFunction() override {}
63 // SyncExtensionFunction overrides.
64 bool RunSync() override;
66 private:
67 static base::Closure* test_callback_;
70 class FeedbackPrivateGetUserEmailFunction : public ChromeSyncExtensionFunction {
71 public:
72 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getUserEmail",
73 FEEDBACKPRIVATE_GETUSEREMAIL);
75 protected:
76 ~FeedbackPrivateGetUserEmailFunction() override {}
77 bool RunSync() override;
80 class FeedbackPrivateGetSystemInformationFunction
81 : public ChromeAsyncExtensionFunction {
82 public:
83 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getSystemInformation",
84 FEEDBACKPRIVATE_GETSYSTEMINFORMATION);
86 protected:
87 ~FeedbackPrivateGetSystemInformationFunction() override {}
88 bool RunAsync() override;
90 private:
91 void OnCompleted(
92 const std::vector<linked_ptr<SystemInformation> >& sys_info);
95 class FeedbackPrivateSendFeedbackFunction
96 : public ChromeAsyncExtensionFunction {
97 public:
98 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.sendFeedback",
99 FEEDBACKPRIVATE_SENDFEEDBACK);
101 protected:
102 ~FeedbackPrivateSendFeedbackFunction() override {}
103 bool RunAsync() override;
105 private:
106 void OnCompleted(bool success);
109 } // namespace extensions
111 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_