| OLD | NEW | 
|   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/chromeos/cros/login_library.h" |   5 #include "chrome/browser/chromeos/cros/login_library.h" | 
|   6  |   6  | 
|   7 #include "base/message_loop.h" |   7 #include "base/message_loop.h" | 
|   8 #include "chrome/browser/chrome_thread.h" |   8 #include "chrome/browser/chrome_thread.h" | 
|   9 #include "chrome/browser/chromeos/cros/cros_library.h" |   9 #include "chrome/browser/chromeos/cros/cros_library.h" | 
|  10  |  10  | 
|  11 namespace chromeos { |  11 namespace chromeos { | 
|  12  |  12  | 
|  13 bool LoginLibraryImpl::EmitLoginPromptReady() { |  13 class LoginLibraryImpl : public LoginLibrary { | 
|  14   return chromeos::EmitLoginPromptReady(); |  14  public: | 
|  15 } |  15   LoginLibraryImpl() {} | 
 |  16   virtual ~LoginLibraryImpl() {} | 
|  16  |  17  | 
|  17 bool LoginLibraryImpl::StartSession(const std::string& user_email, |  18   bool EmitLoginPromptReady() { | 
|  18                                 const std::string& unique_id /* unused */) { |  19     return chromeos::EmitLoginPromptReady(); | 
|  19   // only pass unique_id through once we use it for something. |  20   } | 
|  20   return chromeos::StartSession(user_email.c_str(), ""); |  | 
|  21 } |  | 
|  22  |  21  | 
|  23 bool LoginLibraryImpl::StopSession(const std::string& unique_id /* unused */) { |  22   bool StartSession(const std::string& user_email, | 
|  24   // only pass unique_id through once we use it for something. |  23                     const std::string& unique_id /* unused */) { | 
|  25   return chromeos::StopSession(""); |  24     // only pass unique_id through once we use it for something. | 
 |  25     return chromeos::StartSession(user_email.c_str(), ""); | 
 |  26   } | 
 |  27  | 
 |  28   bool StopSession(const std::string& unique_id /* unused */) { | 
 |  29     // only pass unique_id through once we use it for something. | 
 |  30     return chromeos::StopSession(""); | 
 |  31   } | 
 |  32  | 
 |  33  private: | 
 |  34   DISALLOW_COPY_AND_ASSIGN(LoginLibraryImpl); | 
 |  35 }; | 
 |  36  | 
 |  37 class LoginLibraryStubImpl : public LoginLibrary { | 
 |  38  public: | 
 |  39   LoginLibraryStubImpl() {} | 
 |  40   virtual ~LoginLibraryStubImpl() {} | 
 |  41  | 
 |  42   bool EmitLoginPromptReady() { return true; } | 
 |  43   bool StartSession(const std::string& user_email, | 
 |  44                     const std::string& unique_id /* unused */) { return true; } | 
 |  45   bool StopSession(const std::string& unique_id /* unused */) { return true; } | 
 |  46  | 
 |  47  private: | 
 |  48   DISALLOW_COPY_AND_ASSIGN(LoginLibraryStubImpl); | 
 |  49 }; | 
 |  50  | 
 |  51 // static | 
 |  52 LoginLibrary* LoginLibrary::GetImpl(bool stub) { | 
 |  53   if (stub) | 
 |  54     return new LoginLibraryStubImpl(); | 
 |  55   else | 
 |  56     return new LoginLibraryImpl(); | 
|  26 } |  57 } | 
|  27  |  58  | 
|  28 }  // namespace chromeos |  59 }  // namespace chromeos | 
| OLD | NEW |