Remove PlatformFile from profile_browsertest
[chromium-blink-merge.git] / content / browser / android / devtools_auth.cc
blobc89cdc0cbf16de9a767330d30e4b3f2198599de6
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
3 // found in the LICENSE file.
5 #include "content/public/browser/android/devtools_auth.h"
7 #include "base/logging.h"
9 namespace content {
11 bool CanUserConnectToDevTools(uid_t uid, gid_t gid) {
12 struct passwd* creds = getpwuid(uid);
13 if (!creds || !creds->pw_name) {
14 LOG(WARNING) << "DevTools: can't obtain creds for uid " << uid;
15 return false;
17 if (gid == uid &&
18 (strcmp("root", creds->pw_name) == 0 || // For rooted devices
19 strcmp("shell", creds->pw_name) == 0)) { // For non-rooted devices
20 return true;
22 LOG(WARNING) << "DevTools: connection attempt from " << creds->pw_name;
23 return false;
26 } // namespace content