| 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_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 | 11 |
| 12 class GURL; | 12 class GURL; |
| 13 class Profile; | 13 class Profile; |
| 14 | 14 |
| 15 namespace base { | 15 namespace base { |
| 16 class TaskRunner; | 16 class TaskRunner; |
| 17 } | 17 } |
| 18 | 18 |
| 19 namespace net { | 19 namespace net { |
| 20 class URLRequestContextGetter; | 20 class URLRequestContextGetter; |
| 21 } | 21 } |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 // This class provides properties of messages asynchronously. | 25 // This class provides properties of messages asynchronously. |
| 26 class MessagePropertyProvider { | 26 class MessagePropertyProvider { |
| 27 public: | 27 public: |
| 28 MessagePropertyProvider(); | 28 MessagePropertyProvider(); |
| 29 | 29 |
| 30 typedef base::Callback<void(const std::string&)> DomainBoundCertCallback; | 30 typedef base::Callback<void(const std::string&)> ChannelIDCallback; |
| 31 | 31 |
| 32 // Gets the DER-encoded public key of the domain-bound cert, | 32 // Gets the DER-encoded public key of the domain-bound cert, |
| 33 // aka TLS channel ID, for the given URL. | 33 // aka TLS channel ID, for the given URL. |
| 34 // Runs |reply| on the current message loop. | 34 // Runs |reply| on the current message loop. |
| 35 void GetDomainBoundCert(Profile* profile, | 35 void GetChannelID(Profile* profile, |
| 36 const GURL& source_url, | 36 const GURL& source_url, |
| 37 const DomainBoundCertCallback& reply); | 37 const ChannelIDCallback& reply); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 struct GetDomainBoundCertOutput; | 40 struct GetChannelIDOutput; |
| 41 | 41 |
| 42 static void GetDomainBoundCertOnIOThread( | 42 static void GetChannelIDOnIOThread( |
| 43 scoped_refptr<base::TaskRunner> original_task_runner, | 43 scoped_refptr<base::TaskRunner> original_task_runner, |
| 44 scoped_refptr<net::URLRequestContextGetter> request_context_getter, | 44 scoped_refptr<net::URLRequestContextGetter> request_context_getter, |
| 45 const std::string& host, | 45 const std::string& host, |
| 46 const DomainBoundCertCallback& reply); | 46 const ChannelIDCallback& reply); |
| 47 | 47 |
| 48 static void GotDomainBoundCert( | 48 static void GotChannelID( |
| 49 scoped_refptr<base::TaskRunner> original_task_runner, | 49 scoped_refptr<base::TaskRunner> original_task_runner, |
| 50 struct GetDomainBoundCertOutput* output, | 50 struct GetChannelIDOutput* output, |
| 51 const DomainBoundCertCallback& reply, | 51 const ChannelIDCallback& reply, |
| 52 int status); | 52 int status); |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(MessagePropertyProvider); | 54 DISALLOW_COPY_AND_ASSIGN(MessagePropertyProvider); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace extensions | 57 } // namespace extensions |
| 58 | 58 |
| 59 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_ | 59 #endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_ |
| OLD | NEW |