Popular sites on the NTP: Try to keep the ordering constant
[chromium-blink-merge.git] / content / public / browser / navigator_connect_context.h
blob1c6dc7efa872faac3e128dcf1e69a7aa60740735
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_PUBLIC_BROWSER_NAVIGATOR_CONNECT_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_NAVIGATOR_CONNECT_CONTEXT_H_
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h"
11 namespace content {
13 class NavigatorConnectServiceFactory;
15 // Use this class to register additional navigator.connect service factories.
16 // One instance of this class exists per StoragePartition.
17 // TODO(mek): Add API so services can close a connection.
18 class NavigatorConnectContext
19 : public base::RefCountedThreadSafe<NavigatorConnectContext> {
20 public:
21 // Register a service factory. The most recently added factory that claims to
22 // handle a URL will be used to handle a connection request for that URL.
23 // This method must always be called on the UI thread. No guarantees are
24 // given as to on what thread the passed in factory will get destroyed.
25 virtual void AddFactory(
26 scoped_ptr<NavigatorConnectServiceFactory> factory) = 0;
28 protected:
29 friend class base::RefCountedThreadSafe<NavigatorConnectContext>;
30 NavigatorConnectContext() {}
31 virtual ~NavigatorConnectContext() {}
34 } // namespace content
36 #endif // CONTENT_PUBLIC_BROWSER_NAVIGATOR_CONNECT_CONTEXT_H_