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

Side by Side Diff: chrome/browser/debugger/devtools_http_protocol_handler.cc

Issue 3654001: Revert 61899 for breaking cookes on file:// URLs.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years, 2 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) 2010 The Chromium Authors. All rights reserved. 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 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 #include "chrome/browser/debugger/devtools_http_protocol_handler.h" 5 #include "chrome/browser/debugger/devtools_http_protocol_handler.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop_proxy.h" 9 #include "base/message_loop_proxy.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 void DevToolsHttpProtocolHandler::OnHttpRequest( 88 void DevToolsHttpProtocolHandler::OnHttpRequest(
89 HttpListenSocket* socket, 89 HttpListenSocket* socket,
90 const HttpServerRequestInfo& info) { 90 const HttpServerRequestInfo& info) {
91 if (info.path == "" || info.path == "/") { 91 if (info.path == "" || info.path == "/") {
92 // Pages discovery request. 92 // Pages discovery request.
93 ChromeThread::PostTask( 93 ChromeThread::PostTask(
94 ChromeThread::UI, 94 ChromeThread::UI,
95 FROM_HERE, 95 FROM_HERE,
96 NewRunnableMethod(this, 96 NewRunnableMethod(this,
97 &DevToolsHttpProtocolHandler::OnHttpRequestUI, 97 &DevToolsHttpProtocolHandler::OnHttpRequestUI,
98 scoped_refptr<HttpListenSocket>(socket), 98 socket,
99 info)); 99 info));
100 return; 100 return;
101 } 101 }
102 102
103 size_t pos = info.path.find("/devtools/"); 103 size_t pos = info.path.find("/devtools/");
104 if (pos != 0) { 104 if (pos != 0) {
105 socket->Send404(); 105 socket->Send404();
106 return; 106 return;
107 } 107 }
108 108
109 // Proxy static files from chrome://devtools/*. 109 // Proxy static files from chrome://devtools/*.
110 URLRequest* request = new URLRequest(GURL("chrome:/" + info.path), this); 110 URLRequest* request = new URLRequest(GURL("chrome:/" + info.path), this);
111 Bind(request, socket); 111 Bind(request, socket);
112 request->set_context( 112 request->set_context(
113 Profile::GetDefaultRequestContext()->GetURLRequestContext()); 113 Profile::GetDefaultRequestContext()->GetURLRequestContext());
114 request->Start(); 114 request->Start();
115 } 115 }
116 116
117 void DevToolsHttpProtocolHandler::OnWebSocketRequest( 117 void DevToolsHttpProtocolHandler::OnWebSocketRequest(
118 HttpListenSocket* socket, 118 HttpListenSocket* socket,
119 const HttpServerRequestInfo& request) { 119 const HttpServerRequestInfo& request) {
120 ChromeThread::PostTask( 120 ChromeThread::PostTask(
121 ChromeThread::UI, 121 ChromeThread::UI,
122 FROM_HERE, 122 FROM_HERE,
123 NewRunnableMethod( 123 NewRunnableMethod(
124 this, 124 this,
125 &DevToolsHttpProtocolHandler::OnWebSocketRequestUI, 125 &DevToolsHttpProtocolHandler::OnWebSocketRequestUI,
126 make_scoped_refptr(socket), 126 socket,
127 request)); 127 request));
128 } 128 }
129 129
130 void DevToolsHttpProtocolHandler::OnWebSocketMessage(HttpListenSocket* socket, 130 void DevToolsHttpProtocolHandler::OnWebSocketMessage(HttpListenSocket* socket,
131 const std::string& data) { 131 const std::string& data) {
132 ChromeThread::PostTask( 132 ChromeThread::PostTask(
133 ChromeThread::UI, 133 ChromeThread::UI,
134 FROM_HERE, 134 FROM_HERE,
135 NewRunnableMethod( 135 NewRunnableMethod(
136 this, 136 this,
137 &DevToolsHttpProtocolHandler::OnWebSocketMessageUI, 137 &DevToolsHttpProtocolHandler::OnWebSocketMessageUI,
138 make_scoped_refptr(socket), 138 socket,
139 data)); 139 data));
140 } 140 }
141 141
142 void DevToolsHttpProtocolHandler::OnClose(HttpListenSocket* socket) { 142 void DevToolsHttpProtocolHandler::OnClose(HttpListenSocket* socket) {
143 SocketToRequestsMap::iterator it = socket_to_requests_io_.find(socket); 143 SocketToRequestsMap::iterator it = socket_to_requests_io_.find(socket);
144 if (it != socket_to_requests_io_.end()) { 144 if (it != socket_to_requests_io_.end()) {
145 // Dispose delegating socket. 145 // Dispose delegating socket.
146 for (std::set<URLRequest*>::iterator it2 = it->second.begin(); 146 for (std::set<URLRequest*>::iterator it2 = it->second.begin();
147 it2 != it->second.end(); ++it2) { 147 it2 != it->second.end(); ++it2) {
148 URLRequest* request = *it2; 148 URLRequest* request = *it2;
149 request->Cancel(); 149 request->Cancel();
150 request_to_socket_io_.erase(request); 150 request_to_socket_io_.erase(request);
151 request_to_buffer_io_.erase(request); 151 request_to_buffer_io_.erase(request);
152 delete request; 152 delete request;
153 } 153 }
154 socket_to_requests_io_.erase(socket); 154 socket_to_requests_io_.erase(socket);
155 } 155 }
156 156
157 ChromeThread::PostTask( 157 ChromeThread::PostTask(
158 ChromeThread::UI, 158 ChromeThread::UI,
159 FROM_HERE, 159 FROM_HERE,
160 NewRunnableMethod( 160 NewRunnableMethod(
161 this, 161 this,
162 &DevToolsHttpProtocolHandler::OnCloseUI, 162 &DevToolsHttpProtocolHandler::OnCloseUI,
163 make_scoped_refptr(socket))); 163 socket));
164 } 164 }
165 165
166 void DevToolsHttpProtocolHandler::OnHttpRequestUI( 166 void DevToolsHttpProtocolHandler::OnHttpRequestUI(
167 HttpListenSocket* socket, 167 HttpListenSocket* socket,
168 const HttpServerRequestInfo& info) { 168 const HttpServerRequestInfo& info) {
169 std::string response = "<html><body>"; 169 std::string response = "<html><body>";
170 for (BrowserList::const_iterator it = BrowserList::begin(), 170 for (BrowserList::const_iterator it = BrowserList::begin(),
171 end = BrowserList::end(); it != end; ++it) { 171 end = BrowserList::end(); it != end; ++it) {
172 TabStripModel* model = (*it)->tabstrip_model(); 172 TabStripModel* model = (*it)->tabstrip_model();
173 for (int i = 0, size = model->count(); i < size; ++i) { 173 for (int i = 0, size = model->count(); i < size; ++i) {
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 TabStripModel* model = (*it)->tabstrip_model(); 407 TabStripModel* model = (*it)->tabstrip_model();
408 for (int i = 0, size = model->count(); i < size; ++i) { 408 for (int i = 0, size = model->count(); i < size; ++i) {
409 NavigationController& controller = 409 NavigationController& controller =
410 model->GetTabContentsAt(i)->controller(); 410 model->GetTabContentsAt(i)->controller();
411 if (controller.session_id().id() == session_id) 411 if (controller.session_id().id() == session_id)
412 return controller.tab_contents(); 412 return controller.tab_contents();
413 } 413 }
414 } 414 }
415 return NULL; 415 return NULL;
416 } 416 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_resource_message_filter.cc ('k') | chrome/browser/download/download_file_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698