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

Side by Side Diff: chrome/browser/extensions/api/feedback_private/feedback_service.h

Issue 17111003: Implement the feedbackPrivate API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 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.
4
5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_
7
8 #include <vector>
9 #include "base/basictypes.h"
10 #include "base/callback.h"
11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/weak_ptr.h"
13 #include "chrome/browser/extensions/api/feedback_private/blob_reader.h"
14 #include "chrome/browser/feedback/feedback_data.h"
15 #include "chrome/common/extensions/api/feedback_private.h"
16
17 class Profile;
18
19 namespace extensions {
20
21 typedef std::vector<linked_ptr<api::feedback_private::SystemInformation> >
22 SystemInformationList;
23
24 class FeedbackService {
25 public:
26 typedef base::Callback<void(bool)> SendFeedbackCallback;
27 typedef base::Callback<void(const SystemInformationList& sys_info)>
28 GetSystemInformationCallback;
29
30 // Creates a platform-specific FeedbackService instance.
31 static FeedbackService* CreateInstance();
32
33 virtual ~FeedbackService();
34
35 // Sends a feedback report.
36 virtual void SendFeedback(Profile* profile,
37 scoped_refptr<FeedbackData> feedback_data,
38 const SendFeedbackCallback& callback);
39
40 // Platform specific methods:
41 // Get's the email address of the logged in user.
42 virtual std::string GetUserEmail() = 0;
43
44 // Start to gather system information.
45 // The |callback| will be invoked once the query is completed.
46 virtual void GetSystemInformation(
47 const GetSystemInformationCallback& callback) = 0;
48
49 protected:
50 FeedbackService();
51
52 // Used to get a weak ptr for a derived class instance.
53 virtual base::WeakPtr<FeedbackService> GetWeakPtr() = 0;
54
55 // Callbacks to receive blob data.
56 void AttachedFileCallback(scoped_ptr<std::string> data);
57 void ScreenshotCallback(scoped_ptr<std::string> data);
58
59 // Checks if we have read all the blobs we need to; signals the feedback
60 // data object once all the requisite data has been populated.
61 void CompleteSendFeedback();
62
63 GetSystemInformationCallback system_information_callback_;
64 SendFeedbackCallback send_feedback_callback_;
65
66 scoped_refptr<FeedbackData> feedback_data_;
67 BlobReader* attached_file_reader_;
68 BlobReader* screenshot_reader_;
69
70 DISALLOW_COPY_AND_ASSIGN(FeedbackService);
71 };
72
73 } // namespace extensions
74
75 #endif // CHROME_BROWSER_EXTENSIONS_API_FEEDBACK_PRIVATE_FEEDBACK_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698