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 20 matching lines...) Expand all Loading... |
31 | 31 |
32 CloudPrintPrivateSetupConnectorFunction:: | 32 CloudPrintPrivateSetupConnectorFunction:: |
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_FULL_PRINTING) | 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 scoped_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 = |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 CloudPrintPrivateGetPrintersFunction::~CloudPrintPrivateGetPrintersFunction() { | 87 CloudPrintPrivateGetPrintersFunction::~CloudPrintPrivateGetPrintersFunction() { |
88 } | 88 } |
89 | 89 |
90 void CloudPrintPrivateGetPrintersFunction::SendResults( | 90 void CloudPrintPrivateGetPrintersFunction::SendResults( |
91 const std::vector<std::string>& printers) { | 91 const std::vector<std::string>& printers) { |
92 results_ = api::cloud_print_private::GetPrinters::Results::Create(printers); | 92 results_ = api::cloud_print_private::GetPrinters::Results::Create(printers); |
93 SendResponse(true); | 93 SendResponse(true); |
94 } | 94 } |
95 | 95 |
96 bool CloudPrintPrivateGetPrintersFunction::RunAsync() { | 96 bool CloudPrintPrivateGetPrintersFunction::RunAsync() { |
97 #if defined(ENABLE_FULL_PRINTING) | 97 #if defined(ENABLE_PRINT_PREVIEW) |
98 std::vector<std::string> result; | 98 std::vector<std::string> result; |
99 if (CloudPrintTestsDelegate::instance()) { | 99 if (CloudPrintTestsDelegate::instance()) { |
100 SendResults(CloudPrintTestsDelegate::instance()->GetPrinters()); | 100 SendResults(CloudPrintTestsDelegate::instance()->GetPrinters()); |
101 } else { | 101 } else { |
102 CloudPrintProxyService* service = | 102 CloudPrintProxyService* service = |
103 CloudPrintProxyServiceFactory::GetForProfile(GetProfile()); | 103 CloudPrintProxyServiceFactory::GetForProfile(GetProfile()); |
104 if (!service) | 104 if (!service) |
105 return false; | 105 return false; |
106 service->GetPrinters( | 106 service->GetPrinters( |
107 base::Bind(&CloudPrintPrivateGetPrintersFunction::SendResults, this)); | 107 base::Bind(&CloudPrintPrivateGetPrintersFunction::SendResults, this)); |
(...skipping 14 matching lines...) Expand all 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 |