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

Unified Diff: chrome/browser/local_discovery/privet_http.h

Issue 320683002: Extracted PrivetV1HTTPClient with Privet v1 specific operations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_http.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/local_discovery/privet_http.h
diff --git a/chrome/browser/local_discovery/privet_http.h b/chrome/browser/local_discovery/privet_http.h
index 4e8441089c76dfb768ad5a1cba8ac2a302b582c5..e0814669bd49c871cf6b984bd43ee4207e91de1c 100644
--- a/chrome/browser/local_discovery/privet_http.h
+++ b/chrome/browser/local_discovery/privet_http.h
@@ -42,6 +42,27 @@ class PrivetJSONOperation {
virtual PrivetHTTPClient* GetHTTPClient() = 0;
};
+// Privet HTTP client. Must outlive the operations it creates.
+class PrivetHTTPClient {
+ public:
+ virtual ~PrivetHTTPClient() {}
+
+ // A name for the HTTP client, e.g. the device name for the privet device.
+ virtual const std::string& GetName() = 0;
+
+ // Creates operation to query basic information about local device.
+ virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation(
+ const PrivetJSONOperation::ResultCallback& callback) = 0;
+
+ virtual scoped_ptr<PrivetURLFetcher> CreateURLFetcher(
+ const GURL& url,
+ net::URLFetcher::RequestType request_type,
+ PrivetURLFetcher::Delegate* delegate) = 0;
+
+ virtual void RefreshPrivetToken(
+ const PrivetURLFetcher::TokenCallback& token_callback) = 0;
+};
+
class PrivetDataReadOperation {
public:
enum ResponseType {
@@ -160,19 +181,25 @@ class PrivetLocalPrintOperation {
};
// Privet HTTP client. Must outlive the operations it creates.
-class PrivetHTTPClient {
+class PrivetV1HTTPClient {
public:
- virtual ~PrivetHTTPClient() {}
+ virtual ~PrivetV1HTTPClient() {}
- // Creates operation to register local device using Privet v1 protocol.
- virtual scoped_ptr<PrivetRegisterOperation> CreateRegisterOperation(
- const std::string& user,
- PrivetRegisterOperation::Delegate* delegate) = 0;
+ // A name for the HTTP client, e.g. the device name for the privet device.
+ virtual const std::string& GetName() = 0;
+
+ static scoped_ptr<PrivetV1HTTPClient> CreateDefault(
+ scoped_ptr<PrivetHTTPClient> info_client);
// Creates operation to query basic information about local device.
virtual scoped_ptr<PrivetJSONOperation> CreateInfoOperation(
const PrivetJSONOperation::ResultCallback& callback) = 0;
+ // Creates operation to register local device using Privet v1 protocol.
+ virtual scoped_ptr<PrivetRegisterOperation> CreateRegisterOperation(
+ const std::string& user,
+ PrivetRegisterOperation::Delegate* delegate) = 0;
+
// Creates operation to query capabilities of local printer.
virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation(
const PrivetJSONOperation::ResultCallback& callback) = 0;
@@ -190,9 +217,6 @@ class PrivetHTTPClient {
virtual scoped_ptr<PrivetDataReadOperation> CreateStorageReadOperation(
const std::string& path,
const PrivetDataReadOperation::ResultCallback& callback) = 0;
-
- // A name for the HTTP client, e.g. the device name for the privet device.
- virtual const std::string& GetName() = 0;
};
} // namespace local_discovery
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_http.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698