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

Side by Side Diff: net/socket_stream/socket_stream_job_manager.cc

Issue 601077: Support HttpOnly cookie on Web Socket (Closed)
Patch Set: fix darin's comment Created 10 years, 9 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
« no previous file with comments | « net/socket_stream/socket_stream_job_manager.h ('k') | net/websockets/websocket_job.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2010 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.
4
5 #include "net/socket_stream/socket_stream_job_manager.h"
6
7 namespace net {
8
9 SocketStreamJobManager::SocketStreamJobManager() {
10 }
11
12 SocketStreamJobManager::~SocketStreamJobManager() {
13 }
14
15 SocketStreamJob* SocketStreamJobManager::CreateJob(
16 const GURL& url, SocketStream::Delegate* delegate) const {
17 // If url is invalid, create plain SocketStreamJob, which will close
18 // the socket immediately.
19 if (!url.is_valid()) {
20 SocketStreamJob* job = new SocketStreamJob();
21 job->InitSocketStream(new SocketStream(url, delegate));
22 return job;
23 }
24
25 const std::string& scheme = url.scheme(); // already lowercase
26
27 AutoLock locked(lock_);
28 FactoryMap::const_iterator found = factories_.find(scheme);
29 if (found != factories_.end()) {
30 SocketStreamJob* job = found->second(url, delegate);
31 if (job)
32 return job;
33 }
34 SocketStreamJob* job = new SocketStreamJob();
35 job->InitSocketStream(new SocketStream(url, delegate));
36 return job;
37 }
38
39 SocketStreamJob::ProtocolFactory*
40 SocketStreamJobManager::RegisterProtocolFactory(
41 const std::string& scheme, SocketStreamJob::ProtocolFactory* factory) {
42 AutoLock locked(lock_);
43
44 SocketStreamJob::ProtocolFactory* old_factory;
45 FactoryMap::iterator found = factories_.find(scheme);
46 if (found != factories_.end()) {
47 old_factory = found->second;
48 } else {
49 old_factory = NULL;
50 }
51 if (factory) {
52 factories_[scheme] = factory;
53 } else if (found != factories_.end()) {
54 factories_.erase(found);
55 }
56 return old_factory;
57 }
58
59 } // namespace net
OLDNEW
« no previous file with comments | « net/socket_stream/socket_stream_job_manager.h ('k') | net/websockets/websocket_job.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698