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 // This file implements a standalone host process for Me2Me. | 5 // This file implements a standalone host process for Me2Me. |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 // See comment in ApplyHostDomainPolicy. | 1127 // See comment in ApplyHostDomainPolicy. |
1128 if (host_owner_ != host_owner_email_) { | 1128 if (host_owner_ != host_owner_email_) { |
1129 LOG(ERROR) << "The username and host domain policies cannot be enabled " | 1129 LOG(ERROR) << "The username and host domain policies cannot be enabled " |
1130 << "for accounts with a non-Google email."; | 1130 << "for accounts with a non-Google email."; |
1131 ShutdownHost(kUsernameMismatchExitCode); | 1131 ShutdownHost(kUsernameMismatchExitCode); |
1132 } | 1132 } |
1133 | 1133 |
1134 std::string username = GetUsername(); | 1134 std::string username = GetUsername(); |
1135 bool shutdown = | 1135 bool shutdown = |
1136 username.empty() || | 1136 username.empty() || |
1137 !base::StartsWithASCII(host_owner_, username + std::string("@"), false); | 1137 !base::StartsWith(host_owner_, username + std::string("@"), |
| 1138 base::CompareCase::INSENSITIVE_ASCII); |
1138 | 1139 |
1139 #if defined(OS_MACOSX) | 1140 #if defined(OS_MACOSX) |
1140 // On Mac, we run as root at the login screen, so the username won't match. | 1141 // On Mac, we run as root at the login screen, so the username won't match. |
1141 // However, there's no need to enforce the policy at the login screen, as | 1142 // However, there's no need to enforce the policy at the login screen, as |
1142 // the client will have to reconnect if a login occurs. | 1143 // the client will have to reconnect if a login occurs. |
1143 if (shutdown && getuid() == 0) { | 1144 if (shutdown && getuid() == 0) { |
1144 shutdown = false; | 1145 shutdown = false; |
1145 } | 1146 } |
1146 #endif | 1147 #endif |
1147 | 1148 |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1651 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); | 1652 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); |
1652 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); | 1653 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); |
1653 | 1654 |
1654 // Run the main (also UI) message loop until the host no longer needs it. | 1655 // Run the main (also UI) message loop until the host no longer needs it. |
1655 message_loop.Run(); | 1656 message_loop.Run(); |
1656 | 1657 |
1657 return exit_code; | 1658 return exit_code; |
1658 } | 1659 } |
1659 | 1660 |
1660 } // namespace remoting | 1661 } // namespace remoting |
OLD | NEW |