| 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_LOCAL_DISCOVERY_PRIVET_HTTP_H_ | 5 #ifndef CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ |
| 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ | 6 #define CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 const PrivetJSONOperation::ResultCallback& callback) = 0; | 55 const PrivetJSONOperation::ResultCallback& callback) = 0; |
| 56 | 56 |
| 57 // Creates a URL fetcher for PrivetV1. | 57 // Creates a URL fetcher for PrivetV1. |
| 58 virtual scoped_ptr<PrivetURLFetcher> CreateURLFetcher( | 58 virtual scoped_ptr<PrivetURLFetcher> CreateURLFetcher( |
| 59 const GURL& url, | 59 const GURL& url, |
| 60 net::URLFetcher::RequestType request_type, | 60 net::URLFetcher::RequestType request_type, |
| 61 PrivetURLFetcher::Delegate* delegate) = 0; | 61 PrivetURLFetcher::Delegate* delegate) = 0; |
| 62 | 62 |
| 63 virtual void RefreshPrivetToken( | 63 virtual void RefreshPrivetToken( |
| 64 const PrivetURLFetcher::TokenCallback& token_callback) = 0; | 64 const PrivetURLFetcher::TokenCallback& token_callback) = 0; |
| 65 |
| 66 // After this call HTTPS will be used. Only requests to the server with |
| 67 // matching certificate will be allowed. |
| 68 virtual void SwitchToHttps( |
| 69 uint16_t port, |
| 70 const net::SHA256HashValue& certificate_fingerprint) = 0; |
| 71 |
| 72 virtual bool IsInHttpsMode() const = 0; |
| 65 }; | 73 }; |
| 66 | 74 |
| 67 class PrivetDataReadOperation { | 75 class PrivetDataReadOperation { |
| 68 public: | 76 public: |
| 69 enum ResponseType { | 77 enum ResponseType { |
| 70 RESPONSE_TYPE_ERROR, | 78 RESPONSE_TYPE_ERROR, |
| 71 RESPONSE_TYPE_STRING, | 79 RESPONSE_TYPE_STRING, |
| 72 RESPONSE_TYPE_FILE | 80 RESPONSE_TYPE_FILE |
| 73 }; | 81 }; |
| 74 | 82 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 94 // complete action. Some intervention from the caller is required to display the | 102 // complete action. Some intervention from the caller is required to display the |
| 95 // claim URL to the user (noted in OnPrivetRegisterClaimURL). | 103 // claim URL to the user (noted in OnPrivetRegisterClaimURL). |
| 96 class PrivetRegisterOperation { | 104 class PrivetRegisterOperation { |
| 97 public: | 105 public: |
| 98 enum FailureReason { | 106 enum FailureReason { |
| 99 FAILURE_NETWORK, | 107 FAILURE_NETWORK, |
| 100 FAILURE_HTTP_ERROR, | 108 FAILURE_HTTP_ERROR, |
| 101 FAILURE_JSON_ERROR, | 109 FAILURE_JSON_ERROR, |
| 102 FAILURE_MALFORMED_RESPONSE, | 110 FAILURE_MALFORMED_RESPONSE, |
| 103 FAILURE_TOKEN, | 111 FAILURE_TOKEN, |
| 104 FAILURE_RETRY | 112 FAILURE_UNKNOWN, |
| 105 }; | 113 }; |
| 106 | 114 |
| 107 class Delegate { | 115 class Delegate { |
| 108 public: | 116 public: |
| 109 ~Delegate() {} | 117 ~Delegate() {} |
| 110 | 118 |
| 111 // Called when a user needs to claim the printer by visiting the given URL. | 119 // Called when a user needs to claim the printer by visiting the given URL. |
| 112 virtual void OnPrivetRegisterClaimToken( | 120 virtual void OnPrivetRegisterClaimToken( |
| 113 PrivetRegisterOperation* operation, | 121 PrivetRegisterOperation* operation, |
| 114 const std::string& token, | 122 const std::string& token, |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation( | 213 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation( |
| 206 const PrivetJSONOperation::ResultCallback& callback) = 0; | 214 const PrivetJSONOperation::ResultCallback& callback) = 0; |
| 207 | 215 |
| 208 // Creates operation to submit print job to local printer. | 216 // Creates operation to submit print job to local printer. |
| 209 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation( | 217 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation( |
| 210 PrivetLocalPrintOperation::Delegate* delegate) = 0; | 218 PrivetLocalPrintOperation::Delegate* delegate) = 0; |
| 211 }; | 219 }; |
| 212 | 220 |
| 213 } // namespace local_discovery | 221 } // namespace local_discovery |
| 214 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ | 222 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ |
| OLD | NEW |