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/api/cloud_print_private/cloud_print_private_
api.h" | 5 #include "chrome/browser/extensions/api/cloud_print_private/cloud_print_private_
api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/threading/sequenced_worker_pool.h" | 9 #include "base/threading/sequenced_worker_pool.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 22 matching lines...) Expand all Loading... |
33 CloudPrintPrivateSetupConnectorFunction() { | 33 CloudPrintPrivateSetupConnectorFunction() { |
34 } | 34 } |
35 | 35 |
36 CloudPrintPrivateSetupConnectorFunction:: | 36 CloudPrintPrivateSetupConnectorFunction:: |
37 ~CloudPrintPrivateSetupConnectorFunction() { | 37 ~CloudPrintPrivateSetupConnectorFunction() { |
38 } | 38 } |
39 | 39 |
40 bool CloudPrintPrivateSetupConnectorFunction::RunAsync() { | 40 bool CloudPrintPrivateSetupConnectorFunction::RunAsync() { |
41 #if defined(ENABLE_PRINT_PREVIEW) | 41 #if defined(ENABLE_PRINT_PREVIEW) |
42 using api::cloud_print_private::SetupConnector::Params; | 42 using api::cloud_print_private::SetupConnector::Params; |
43 scoped_ptr<Params> params(Params::Create(*args_)); | 43 std::unique_ptr<Params> params(Params::Create(*args_)); |
44 if (CloudPrintTestsDelegate::instance()) { | 44 if (CloudPrintTestsDelegate::instance()) { |
45 CloudPrintTestsDelegate::instance()->SetupConnector( | 45 CloudPrintTestsDelegate::instance()->SetupConnector( |
46 params->user_email, | 46 params->user_email, |
47 params->robot_email, | 47 params->robot_email, |
48 params->credentials, | 48 params->credentials, |
49 params->user_settings); | 49 params->user_settings); |
50 } else { | 50 } else { |
51 CloudPrintProxyService* service = | 51 CloudPrintProxyService* service = |
52 CloudPrintProxyServiceFactory::GetForProfile(GetProfile()); | 52 CloudPrintProxyServiceFactory::GetForProfile(GetProfile()); |
53 if (!service) | 53 if (!service) |
54 return false; | 54 return false; |
55 scoped_ptr<base::DictionaryValue> user_setings( | 55 std::unique_ptr<base::DictionaryValue> user_setings( |
56 params->user_settings.ToValue()); | 56 params->user_settings.ToValue()); |
57 service->EnableForUserWithRobot(params->credentials, | 57 service->EnableForUserWithRobot(params->credentials, |
58 params->robot_email, | 58 params->robot_email, |
59 params->user_email, | 59 params->user_email, |
60 *user_setings); | 60 *user_setings); |
61 } | 61 } |
62 SendResponse(true); | 62 SendResponse(true); |
63 return true; | 63 return true; |
64 #else | 64 #else |
65 return false; | 65 return false; |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 bool CloudPrintPrivateGetClientIdFunction::RunAsync() { | 122 bool CloudPrintPrivateGetClientIdFunction::RunAsync() { |
123 SetResult(new base::StringValue( | 123 SetResult(new base::StringValue( |
124 CloudPrintTestsDelegate::instance() ? | 124 CloudPrintTestsDelegate::instance() ? |
125 CloudPrintTestsDelegate::instance()->GetClientId() : | 125 CloudPrintTestsDelegate::instance()->GetClientId() : |
126 google_apis::GetOAuth2ClientID(google_apis::CLIENT_CLOUD_PRINT))); | 126 google_apis::GetOAuth2ClientID(google_apis::CLIENT_CLOUD_PRINT))); |
127 SendResponse(true); | 127 SendResponse(true); |
128 return true; | 128 return true; |
129 } | 129 } |
130 | 130 |
131 } // namespace extensions | 131 } // namespace extensions |
OLD | NEW |