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 |