summaryrefslogtreecommitdiffstats
path: root/chrome/browser/extensions/api/messaging/message_property_provider.h
diff options
context:
space:
mode:
authorjuanlang@google.com <juanlang@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-16 02:54:11 +0000
committerjuanlang@google.com <juanlang@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-16 02:54:11 +0000
commit8ad95b7c95b24fdeacdd8208a4b84b252d2684f1 (patch)
tree695042cd7e03b2b5bb77a73d59b378a4b7a2e458 /chrome/browser/extensions/api/messaging/message_property_provider.h
parent0dc953e343be15211fcd6df53a416da9d85dbdf2 (diff)
downloadchromium_src-8ad95b7c95b24fdeacdd8208a4b84b252d2684f1.zip
chromium_src-8ad95b7c95b24fdeacdd8208a4b84b252d2684f1.tar.gz
chromium_src-8ad95b7c95b24fdeacdd8208a4b84b252d2684f1.tar.bz2
Introduce a new attribute to externally_connectable,
accepts_tls_channel_id. When sites are allowed to connect to an extension, and specify include_tls_channel_id in their chrome.runtime.connect or chrome.runtime.sendMessage options, and the extension sets the accepts_tls_channel_id attribute, automatically annotate the TLS channel ID as an attribute of the MessageSender given to the onConnectExternal handler. BUG=259097 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=227722 Review URL: https://codereview.chromium.org/23002007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/api/messaging/message_property_provider.h')
-rw-r--r--chrome/browser/extensions/api/messaging/message_property_provider.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/chrome/browser/extensions/api/messaging/message_property_provider.h b/chrome/browser/extensions/api/messaging/message_property_provider.h
new file mode 100644
index 0000000..849aaae
--- /dev/null
+++ b/chrome/browser/extensions/api/messaging/message_property_provider.h
@@ -0,0 +1,59 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_
+#define CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_
+
+#include <string>
+
+#include "base/callback.h"
+
+class GURL;
+class Profile;
+
+namespace base {
+class TaskRunner;
+}
+
+namespace net {
+class URLRequestContextGetter;
+}
+
+namespace extensions {
+
+// This class provides properties of messages asynchronously.
+class MessagePropertyProvider {
+ public:
+ MessagePropertyProvider();
+
+ typedef base::Callback<void(const std::string&)> DomainBoundCertCallback;
+
+ // Gets the DER-encoded public key of the domain-bound cert,
+ // aka TLS channel ID, for the given URL.
+ // Runs |reply| on the current message loop.
+ void GetDomainBoundCert(Profile* profile,
+ const GURL& source_url,
+ const DomainBoundCertCallback& reply);
+
+ private:
+ struct GetDomainBoundCertOutput;
+
+ static void GetDomainBoundCertOnIOThread(
+ scoped_refptr<base::TaskRunner> original_task_runner,
+ scoped_refptr<net::URLRequestContextGetter> request_context_getter,
+ const std::string& host,
+ const DomainBoundCertCallback& reply);
+
+ static void GotDomainBoundCert(
+ scoped_refptr<base::TaskRunner> original_task_runner,
+ struct GetDomainBoundCertOutput* output,
+ const DomainBoundCertCallback& reply,
+ int status);
+
+ DISALLOW_COPY_AND_ASSIGN(MessagePropertyProvider);
+};
+
+} // namespace extensions
+
+#endif // CHROME_BROWSER_EXTENSIONS_API_MESSAGING_MESSAGE_PROPERTY_PROVIDER_H_