| 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_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ |   5 #ifndef CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ | 
|   6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ |   6 #define CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ | 
|   7  |   7  | 
|   8 #include <string> |   8 #include <string> | 
|   9  |   9  | 
|  10 #include "base/basictypes.h" |  10 #include "base/basictypes.h" | 
|  11 #include "base/callback.h" |  11 #include "base/callback.h" | 
|  12 #include "base/memory/scoped_ptr.h" |  | 
|  13 #include "net/url_request/url_fetcher_delegate.h" |  12 #include "net/url_request/url_fetcher_delegate.h" | 
|  14  |  13  | 
|  15 namespace feedback { |  14 namespace feedback { | 
|  16  |  15  | 
|  17 typedef base::Callback<void(scoped_ptr<std::string>)> ReportDataCallback; |  16 typedef base::Callback<void(const std::string&)> ReportDataCallback; | 
|  18  |  17  | 
|  19 // FeedbackUploaderDelegate is a simple http uploader for a feedback report. On |  18 // FeedbackUploaderDelegate is a simple http uploader for a feedback report. On | 
|  20 // succes or failure, it deletes itself, but on failure it also notifies the |  19 // succes or failure, it deletes itself, but on failure it also notifies the | 
|  21 // error callback specified when constructing the class instance. |  20 // error callback specified when constructing the class instance. | 
|  22 class FeedbackUploaderDelegate : public net::URLFetcherDelegate { |  21 class FeedbackUploaderDelegate : public net::URLFetcherDelegate { | 
|  23  public: |  22  public: | 
|  24   FeedbackUploaderDelegate(scoped_ptr<std::string> post_body, |  23   FeedbackUploaderDelegate(const std::string& post_body, | 
|  25                            const base::Closure& success_callback, |  24                            const base::Closure& success_callback, | 
|  26                            const ReportDataCallback& error_callback); |  25                            const ReportDataCallback& error_callback); | 
|  27   virtual ~FeedbackUploaderDelegate(); |  26   virtual ~FeedbackUploaderDelegate(); | 
|  28  |  27  | 
|  29  private: |  28  private: | 
|  30   // Overridden from net::URLFetcherDelegate. |  29   // Overridden from net::URLFetcherDelegate. | 
|  31   virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; |  30   virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 
|  32  |  31  | 
|  33   scoped_ptr<std::string> post_body_; |  32   std::string post_body_; | 
|  34   base::Closure success_callback_; |  33   base::Closure success_callback_; | 
|  35   ReportDataCallback error_callback_; |  34   ReportDataCallback error_callback_; | 
|  36  |  35  | 
|  37   DISALLOW_COPY_AND_ASSIGN(FeedbackUploaderDelegate); |  36   DISALLOW_COPY_AND_ASSIGN(FeedbackUploaderDelegate); | 
|  38 }; |  37 }; | 
|  39  |  38  | 
|  40 }  // namespace feedback |  39 }  // namespace feedback | 
|  41  |  40  | 
|  42 #endif  // CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ |  41 #endif  // CHROME_BROWSER_FEEDBACK_FEEDBACK_UPLOADER_DELEGATE_H_ | 
| OLD | NEW |