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 "chrome/browser/extensions/extension_chrome_auth_private_api.h" | 5 #include "chrome/browser/extensions/extension_chrome_auth_private_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/extensions/extension_service.h" | 9 #include "chrome/browser/extensions/extension_service.h" |
10 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 10 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 std::string user_email; | 27 std::string user_email; |
28 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &user_email)); | 28 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &user_email)); |
29 std::string robot_email; | 29 std::string robot_email; |
30 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &robot_email)); | 30 EXTENSION_FUNCTION_VALIDATE(args_->GetString(1, &robot_email)); |
31 std::string credentials; | 31 std::string credentials; |
32 EXTENSION_FUNCTION_VALIDATE(args_->GetString(2, &credentials)); | 32 EXTENSION_FUNCTION_VALIDATE(args_->GetString(2, &credentials)); |
33 if (test_mode) { | 33 if (test_mode) { |
34 std::string test_response = user_email; | 34 std::string test_response = user_email; |
35 test_response.append(robot_email); | 35 test_response.append(robot_email); |
36 test_response.append(credentials); | 36 test_response.append(credentials); |
37 result_.reset(Value::CreateStringValue(test_response)); | 37 SetResult(Value::CreateStringValue(test_response)); |
38 } else { | 38 } else { |
39 CloudPrintProxyServiceFactory::GetForProfile(profile_)-> | 39 CloudPrintProxyServiceFactory::GetForProfile(profile_)-> |
40 EnableForUserWithRobot(credentials, robot_email, user_email); | 40 EnableForUserWithRobot(credentials, robot_email, user_email); |
41 } | 41 } |
42 SendResponse(true); | 42 SendResponse(true); |
43 return true; | 43 return true; |
44 } | 44 } |
45 | 45 |
46 // static | 46 // static |
47 void SetCloudPrintCredentialsFunction::SetTestMode(bool test_mode_enabled) { | 47 void SetCloudPrintCredentialsFunction::SetTestMode(bool test_mode_enabled) { |
48 test_mode = test_mode_enabled; | 48 test_mode = test_mode_enabled; |
49 } | 49 } |
OLD | NEW |