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

Side by Side Diff: chrome/browser/local_discovery/privet_http.h

Issue 1417363004: Verify certificate of Privet v3 device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 unified diff | Download patch
OLDNEW
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
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 only HTTPS will be used. Only requests to the server with
67 // matching certificate will be allowed.
68 // Privet v3 devices must supports HTTPS. However the device has self-signed
69 // certificate so normal validation is not useful. The only know information
70 // about device is fingerprint of the certificate.
71 // Before using HTTPS, Privet v3 pairing generates a shared secret using
72 // SPAKE2 over an insecure channel. Then the device sends the fingerprint
73 // to the client, over the insecure channel, but signed using the shared
74 // secret.
75 // More info on pairing:
76 // https://developers.google.com/cloud-devices/v1/reference/local-api/pairing_ start
77 virtual void SwitchToHttps(
78 uint16_t port,
79 const net::SHA256HashValue& certificate_fingerprint) = 0;
80
81 virtual bool IsInHttpsMode() const = 0;
65 }; 82 };
66 83
67 class PrivetDataReadOperation { 84 class PrivetDataReadOperation {
68 public: 85 public:
69 enum ResponseType { 86 enum ResponseType {
70 RESPONSE_TYPE_ERROR, 87 RESPONSE_TYPE_ERROR,
71 RESPONSE_TYPE_STRING, 88 RESPONSE_TYPE_STRING,
72 RESPONSE_TYPE_FILE 89 RESPONSE_TYPE_FILE
73 }; 90 };
74 91
(...skipping 19 matching lines...) Expand all
94 // complete action. Some intervention from the caller is required to display the 111 // complete action. Some intervention from the caller is required to display the
95 // claim URL to the user (noted in OnPrivetRegisterClaimURL). 112 // claim URL to the user (noted in OnPrivetRegisterClaimURL).
96 class PrivetRegisterOperation { 113 class PrivetRegisterOperation {
97 public: 114 public:
98 enum FailureReason { 115 enum FailureReason {
99 FAILURE_NETWORK, 116 FAILURE_NETWORK,
100 FAILURE_HTTP_ERROR, 117 FAILURE_HTTP_ERROR,
101 FAILURE_JSON_ERROR, 118 FAILURE_JSON_ERROR,
102 FAILURE_MALFORMED_RESPONSE, 119 FAILURE_MALFORMED_RESPONSE,
103 FAILURE_TOKEN, 120 FAILURE_TOKEN,
104 FAILURE_RETRY 121 FAILURE_UNKNOWN,
105 }; 122 };
106 123
107 class Delegate { 124 class Delegate {
108 public: 125 public:
109 ~Delegate() {} 126 ~Delegate() {}
110 127
111 // Called when a user needs to claim the printer by visiting the given URL. 128 // Called when a user needs to claim the printer by visiting the given URL.
112 virtual void OnPrivetRegisterClaimToken( 129 virtual void OnPrivetRegisterClaimToken(
113 PrivetRegisterOperation* operation, 130 PrivetRegisterOperation* operation,
114 const std::string& token, 131 const std::string& token,
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation( 222 virtual scoped_ptr<PrivetJSONOperation> CreateCapabilitiesOperation(
206 const PrivetJSONOperation::ResultCallback& callback) = 0; 223 const PrivetJSONOperation::ResultCallback& callback) = 0;
207 224
208 // Creates operation to submit print job to local printer. 225 // Creates operation to submit print job to local printer.
209 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation( 226 virtual scoped_ptr<PrivetLocalPrintOperation> CreateLocalPrintOperation(
210 PrivetLocalPrintOperation::Delegate* delegate) = 0; 227 PrivetLocalPrintOperation::Delegate* delegate) = 0;
211 }; 228 };
212 229
213 } // namespace local_discovery 230 } // namespace local_discovery
214 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_ 231 #endif // CHROME_BROWSER_LOCAL_DISCOVERY_PRIVET_HTTP_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/local_discovery/privet_http_impl.h » ('j') | chrome/browser/local_discovery/privet_http_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698