OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/debugger/devtools_http_handler_impl.h" | 5 #include "content/browser/debugger/devtools_http_handler_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
111 } | 111 } |
112 | 112 |
113 private: | 113 private: |
114 virtual void FrameNavigating(const std::string& url) {} | 114 virtual void FrameNavigating(const std::string& url) {} |
115 net::HttpServer* server_; | 115 net::HttpServer* server_; |
116 int connection_id_; | 116 int connection_id_; |
117 }; | 117 }; |
118 | 118 |
119 } // namespace | 119 } // namespace |
120 | 120 |
121 #if defined(OS_ANDROID) | |
122 // static | |
123 bool DevToolsHttpHandler::IsUserAllowedToConnect(uid_t uid, gid_t gid) { | |
pfeldman
2012/08/02 17:05:50
I don't think this code belongs here. It looks lik
Satish
2012/08/02 17:17:53
This function is specific to the devtools feature,
pfeldman
2012/08/02 17:37:53
The code below does not seem to be related to devt
Satish
2012/08/06 10:21:41
Done.
| |
124 struct passwd* creds = getpwuid(uid); | |
125 if (!creds || !creds->pw_name) { | |
126 LOG(WARNING) << "DevToolsHttpHandler: can't obtain creds for uid " << uid; | |
127 return false; | |
128 } | |
129 if (gid == uid && | |
130 (strcmp("root", creds->pw_name) == 0 || | |
131 strcmp("shell", creds->pw_name) == 0)) { | |
132 return true; | |
133 } | |
134 LOG(WARNING) << "DevToolsHttpHandler: connection attempt from " | |
135 << creds->pw_name; | |
136 return false; | |
137 } | |
138 #endif | |
139 | |
121 // static | 140 // static |
122 int DevToolsHttpHandler::GetFrontendResourceId(const std::string& name) { | 141 int DevToolsHttpHandler::GetFrontendResourceId(const std::string& name) { |
123 for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { | 142 for (size_t i = 0; i < kDevtoolsResourcesSize; ++i) { |
124 if (name == kDevtoolsResources[i].name) | 143 if (name == kDevtoolsResources[i].name) |
125 return kDevtoolsResources[i].value; | 144 return kDevtoolsResources[i].value; |
126 } | 145 } |
127 return -1; | 146 return -1; |
128 } | 147 } |
129 | 148 |
130 // static | 149 // static |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
618 void DevToolsHttpHandlerImpl::AcceptWebSocket( | 637 void DevToolsHttpHandlerImpl::AcceptWebSocket( |
619 int connection_id, | 638 int connection_id, |
620 const net::HttpServerRequestInfo& request) { | 639 const net::HttpServerRequestInfo& request) { |
621 BrowserThread::PostTask( | 640 BrowserThread::PostTask( |
622 BrowserThread::IO, FROM_HERE, | 641 BrowserThread::IO, FROM_HERE, |
623 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), | 642 base::Bind(&net::HttpServer::AcceptWebSocket, server_.get(), |
624 connection_id, request)); | 643 connection_id, request)); |
625 } | 644 } |
626 | 645 |
627 } // namespace content | 646 } // namespace content |
OLD | NEW |