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

Side by Side Diff: chrome/browser/chrome_plugin_browsing_context.h

Issue 6338002: net: Remove typedef net::URLRequestContext URLRequestContext; (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for real Created 9 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_CHROME_PLUGIN_BROWSING_CONTEXT_H_ 5 #ifndef CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_
6 #define CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_ 6 #define CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 10
11 #include "base/id_map.h" 11 #include "base/id_map.h"
12 #include "chrome/common/chrome_plugin_api.h" 12 #include "chrome/common/chrome_plugin_api.h"
13 #include "chrome/common/notification_observer.h" 13 #include "chrome/common/notification_observer.h"
14 #include "chrome/common/notification_registrar.h" 14 #include "chrome/common/notification_registrar.h"
15 15
16 namespace net { 16 namespace net {
17 class URLRequestContext; 17 class URLRequestContext;
18 } // namespace net 18 } // namespace net
19 19
20 // This class manages the mapping between CPBrowsingContexts and 20 // This class manages the mapping between CPBrowsingContexts and
21 // URLRequestContexts. It observes when URLRequestContexts go away, and 21 // net::URLRequestContexts. It observes when net::URLRequestContexts go away,
22 // invalidates the corresponding CPBrowsingContexts. CPBrowsingContexts can be 22 // and invalidates the corresponding CPBrowsingContexts. CPBrowsingContexts can
23 // associated with other data as well, so there can be multiple ones referring 23 // be associated with other data as well, so there can be multiple ones
24 // to a given URLRequestContext. 24 // referring to a given net::URLRequestContext.
25 // Note: This class should be used on the IO thread only. 25 // Note: This class should be used on the IO thread only.
26 class CPBrowsingContextManager : public NotificationObserver { 26 class CPBrowsingContextManager : public NotificationObserver {
27 public: 27 public:
28 static CPBrowsingContextManager* GetInstance(); 28 static CPBrowsingContextManager* GetInstance();
29 29
30 // Note: don't call these directly - use Instance() above. They are public 30 // Note: don't call these directly - use Instance() above. They are public
31 // so Singleton can access them. 31 // so Singleton can access them.
32 CPBrowsingContextManager(); 32 CPBrowsingContextManager();
33 ~CPBrowsingContextManager(); 33 ~CPBrowsingContextManager();
34 34
35 // Generate a new unique CPBrowsingContext ID from the given 35 // Generate a new unique CPBrowsingContext ID from the given
36 // URLRequestContext. Multiple CPBrowsingContexts can map to the same 36 // net::URLRequestContext. Multiple CPBrowsingContexts can map to the same
37 // URLRequestContext. 37 // net::URLRequestContext.
38 CPBrowsingContext Allocate(net::URLRequestContext* context); 38 CPBrowsingContext Allocate(net::URLRequestContext* context);
39 39
40 // Return the URLRequestContext that this CPBrowsingContext refers to, or NULL 40 // Return the net::URLRequestContext that this CPBrowsingContext refers to, or
41 // if not found. 41 // NULL if not found.
42 net::URLRequestContext* ToURLRequestContext(CPBrowsingContext id); 42 net::URLRequestContext* ToURLRequestContext(CPBrowsingContext id);
43 43
44 // Return a CPBrowsingContext ID that corresponds to the given 44 // Return a CPBrowsingContext ID that corresponds to the given
45 // URLRequestContext. This function differs from Allocate in that calling 45 // net::URLRequestContext. This function differs from Allocate in that calling
46 // this multiple times with the same argument gives the same ID. 46 // this multiple times with the same argument gives the same ID.
47 CPBrowsingContext Lookup(net::URLRequestContext* context); 47 CPBrowsingContext Lookup(net::URLRequestContext* context);
48 48
49 private: 49 private:
50 // NotificationObserver 50 // NotificationObserver
51 virtual void Observe(NotificationType type, 51 virtual void Observe(NotificationType type,
52 const NotificationSource& source, 52 const NotificationSource& source,
53 const NotificationDetails& details); 53 const NotificationDetails& details);
54 54
55 typedef IDMap<net::URLRequestContext> Map; 55 typedef IDMap<net::URLRequestContext> Map;
56 typedef std::map<net::URLRequestContext*, CPBrowsingContext> ReverseMap; 56 typedef std::map<net::URLRequestContext*, CPBrowsingContext> ReverseMap;
57 57
58 NotificationRegistrar registrar_; 58 NotificationRegistrar registrar_;
59 59
60 Map map_; // map of CPBrowsingContext -> URLRequestContext 60 Map map_; // map of CPBrowsingContext -> net::URLRequestContext
61 ReverseMap reverse_map_; // map of URLRequestContext -> CPBrowsingContext 61 ReverseMap reverse_map_; // map of net::URLRequestContext -> CPBrowsingContext
62 }; 62 };
63 63
64 #endif // CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_ 64 #endif // CHROME_BROWSER_CHROME_PLUGIN_BROWSING_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698