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

Unified Diff: chrome/browser/chrome_to_mobile/common/cloud_print_request_impl.h

Issue 11038063: Support chrome_to_mobile job receiving Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix format Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chrome_to_mobile/common/cloud_print_request_impl.h
diff --git a/chrome/browser/chrome_to_mobile/common/cloud_print_request_impl.h b/chrome/browser/chrome_to_mobile/common/cloud_print_request_impl.h
new file mode 100644
index 0000000000000000000000000000000000000000..8925001acae576dfc10b2a05707b24ff5497b9b2
--- /dev/null
+++ b/chrome/browser/chrome_to_mobile/common/cloud_print_request_impl.h
@@ -0,0 +1,64 @@
+// Copyright 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_CHROME_TO_MOBILE_COMMON_CLOUD_PRINT_REQUEST_IMPL_H_
+#define CHROME_BROWSER_CHROME_TO_MOBILE_COMMON_CLOUD_PRINT_REQUEST_IMPL_H_
+
+#include "chrome/browser/chrome_to_mobile/common/cloud_print_request.h"
+
+#include <string>
+
+#include "base/memory/scoped_ptr.h"
+
+class GURL;
+
+namespace chrome_to_mobile {
+
+// An implementation of |CloudPrintRequest|.
+class CloudPrintRequestImpl : public CloudPrintRequest {
+ public:
+ // Contructs a cloud print request at |url| with the request headers required
+ // by cloud print server and |additional_header|. The request is of type
+ // |request_type|; if it is a POST request, mime type and post data
+ // are given by |post_data_mime_type| and |post_data|. Additional settings are
+ // given in |setting|. |delegate| will be called back when the request
+ // completes.
+ CloudPrintRequestImpl(
+ const GURL& url,
+ const std::string& additional_header,
+ const net::URLFetcher::RequestType& request_type,
+ const std::string& post_data_mime_type,
+ const std::string& post_data,
+ const Settings& setting,
+ Delegate* delegate);
+ virtual ~CloudPrintRequestImpl();
+
+ // Starts the request.
+ void Start();
+
+ // |CloudPrintRequest|
+ virtual bool HasOAuth2AccessTokenFailure() const OVERRIDE;
+ virtual bool HasCloudPrintAuthError() const OVERRIDE;
+ virtual std::string GetResponseMimeType() const OVERRIDE;
+ virtual std::string GetResponseData(bool* success) const OVERRIDE;
+
+ protected:
+ // Called back by |fetcher_|.
+ void OnGetOAuth2AccessTokenFailure();
+ virtual void OnFetchComplete(const net::URLFetcher* source);
+
+ private:
+ class Fetcher;
+ friend Fetcher;
+
+ const Settings settings_;
+ Delegate* const delegate_;
+
+ scoped_ptr<Fetcher> fetcher_;
+ bool auth_token_failure_;
+};
+
+} // namespace chrome_to_mobile
+
+#endif // CHROME_BROWSER_CHROME_TO_MOBILE_COMMON_CLOUD_PRINT_REQUEST_IMPL_H_

Powered by Google App Engine
This is Rietveld 408576698