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

Side by Side Diff: remoting/host/remoting_me2me_host.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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
OLDNEW
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 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after
1112 HOST_LOG << "Policy requires host username match."; 1112 HOST_LOG << "Policy requires host username match.";
1113 1113
1114 // See comment in ApplyHostDomainPolicy. 1114 // See comment in ApplyHostDomainPolicy.
1115 if (host_owner_ != host_owner_email_) { 1115 if (host_owner_ != host_owner_email_) {
1116 LOG(ERROR) << "The username and host domain policies cannot be enabled " 1116 LOG(ERROR) << "The username and host domain policies cannot be enabled "
1117 << "for accounts with a non-Google email."; 1117 << "for accounts with a non-Google email.";
1118 ShutdownHost(kUsernameMismatchExitCode); 1118 ShutdownHost(kUsernameMismatchExitCode);
1119 } 1119 }
1120 1120
1121 std::string username = GetUsername(); 1121 std::string username = GetUsername();
1122 bool shutdown = username.empty() || 1122 bool shutdown =
1123 !StartsWithASCII(host_owner_, username + std::string("@"), 1123 username.empty() ||
1124 false); 1124 !base::StartsWithASCII(host_owner_, username + std::string("@"), false);
1125 1125
1126 #if defined(OS_MACOSX) 1126 #if defined(OS_MACOSX)
1127 // On Mac, we run as root at the login screen, so the username won't match. 1127 // On Mac, we run as root at the login screen, so the username won't match.
1128 // However, there's no need to enforce the policy at the login screen, as 1128 // However, there's no need to enforce the policy at the login screen, as
1129 // the client will have to reconnect if a login occurs. 1129 // the client will have to reconnect if a login occurs.
1130 if (shutdown && getuid() == 0) { 1130 if (shutdown && getuid() == 0) {
1131 shutdown = false; 1131 shutdown = false;
1132 } 1132 }
1133 #endif 1133 #endif
1134 1134
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1633 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds)); 1633 base::TimeDelta::FromSeconds(kShutdownTimeoutSeconds));
1634 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog); 1634 new HostProcess(context.Pass(), &exit_code, &shutdown_watchdog);
1635 1635
1636 // Run the main (also UI) message loop until the host no longer needs it. 1636 // Run the main (also UI) message loop until the host no longer needs it.
1637 message_loop.Run(); 1637 message_loop.Run();
1638 1638
1639 return exit_code; 1639 return exit_code;
1640 } 1640 }
1641 1641
1642 } // namespace remoting 1642 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/it2me/it2me_native_messaging_host.cc ('k') | remoting/protocol/me2me_host_authenticator_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698