| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" | 8 #include "chrome/browser/extensions/api/profile_keyed_api_factory.h" |
| 9 #include "chrome/browser/extensions/chrome_extension_function.h" | 9 #include "chrome/browser/extensions/chrome_extension_function.h" |
| 10 #include "chrome/common/extensions/api/feedback_private.h" | 10 #include "chrome/common/extensions/api/feedback_private.h" |
| 11 #include "ui/gfx/rect.h" | 11 #include "ui/gfx/rect.h" |
| 12 | 12 |
| 13 namespace extensions { | 13 namespace extensions { |
| 14 | 14 |
| 15 extern char kFeedbackExtensionId[]; | 15 extern char kFeedbackExtensionId[]; |
| 16 | 16 |
| 17 class FeedbackService; | 17 class FeedbackService; |
| 18 | 18 |
| 19 using extensions::api::feedback_private::SystemInformation; | 19 using extensions::api::feedback_private::SystemInformation; |
| 20 | 20 |
| 21 class FeedbackPrivateAPI : public ProfileKeyedAPI { | 21 class FeedbackPrivateAPI : public ProfileKeyedAPI { |
| 22 public: | 22 public: |
| 23 explicit FeedbackPrivateAPI(Profile* profile); | 23 explicit FeedbackPrivateAPI(content::BrowserContext* context); |
| 24 virtual ~FeedbackPrivateAPI(); | 24 virtual ~FeedbackPrivateAPI(); |
| 25 | 25 |
| 26 FeedbackService* GetService() const; | 26 FeedbackService* GetService() const; |
| 27 void RequestFeedback(const std::string& description_template, | 27 void RequestFeedback(const std::string& description_template, |
| 28 const std::string& category_tag, | 28 const std::string& category_tag, |
| 29 const GURL& page_url); | 29 const GURL& page_url); |
| 30 | 30 |
| 31 // ProfileKeyedAPI implementation. | 31 // ProfileKeyedAPI implementation. |
| 32 static ProfileKeyedAPIFactory<FeedbackPrivateAPI>* GetFactoryInstance(); | 32 static ProfileKeyedAPIFactory<FeedbackPrivateAPI>* GetFactoryInstance(); |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 friend class ProfileKeyedAPIFactory<FeedbackPrivateAPI>; | 35 friend class ProfileKeyedAPIFactory<FeedbackPrivateAPI>; |
| 36 | 36 |
| 37 // ProfileKeyedAPI implementation. | 37 // ProfileKeyedAPI implementation. |
| 38 static const char* service_name() { | 38 static const char* service_name() { |
| 39 return "FeedbackPrivateAPI"; | 39 return "FeedbackPrivateAPI"; |
| 40 } | 40 } |
| 41 | 41 |
| 42 static const bool kServiceHasOwnInstanceInIncognito = true; | 42 static const bool kServiceHasOwnInstanceInIncognito = true; |
| 43 | 43 |
| 44 Profile* const profile_; | 44 content::BrowserContext* const context_; |
| 45 FeedbackService* service_; | 45 FeedbackService* service_; |
| 46 }; | 46 }; |
| 47 | 47 |
| 48 // Feedback strings. | 48 // Feedback strings. |
| 49 class FeedbackPrivateGetStringsFunction : public ChromeSyncExtensionFunction { | 49 class FeedbackPrivateGetStringsFunction : public ChromeSyncExtensionFunction { |
| 50 public: | 50 public: |
| 51 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getStrings", | 51 DECLARE_EXTENSION_FUNCTION("feedbackPrivate.getStrings", |
| 52 FEEDBACKPRIVATE_GETSTRINGS) | 52 FEEDBACKPRIVATE_GETSTRINGS) |
| 53 | 53 |
| 54 // Invoke this callback when this function is called - used for testing. | 54 // Invoke this callback when this function is called - used for testing. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 virtual ~FeedbackPrivateSendFeedbackFunction() {} | 101 virtual ~FeedbackPrivateSendFeedbackFunction() {} |
| 102 virtual bool RunImpl() OVERRIDE; | 102 virtual bool RunImpl() OVERRIDE; |
| 103 | 103 |
| 104 private: | 104 private: |
| 105 void OnCompleted(bool success); | 105 void OnCompleted(bool success); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace extensions | 108 } // namespace extensions |
| 109 | 109 |
| 110 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H
_ | 110 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_PRIVATE_API_H
_ |
| OLD | NEW |