| 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 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 CloudPrintTestsDelegate::CloudPrintTestsDelegate() { | 24 CloudPrintTestsDelegate::CloudPrintTestsDelegate() { |
| 25 instance_ = this; | 25 instance_ = this; |
| 26 } | 26 } |
| 27 | 27 |
| 28 CloudPrintTestsDelegate::~CloudPrintTestsDelegate() { | 28 CloudPrintTestsDelegate::~CloudPrintTestsDelegate() { |
| 29 instance_ = NULL; | 29 instance_ = NULL; |
| 30 } | 30 } |
| 31 | 31 |
| 32 |
| 32 CloudPrintPrivateSetupConnectorFunction:: | 33 CloudPrintPrivateSetupConnectorFunction:: |
| 33 CloudPrintPrivateSetupConnectorFunction() { | 34 CloudPrintPrivateSetupConnectorFunction() { |
| 34 } | 35 } |
| 35 | 36 |
| 36 CloudPrintPrivateSetupConnectorFunction:: | 37 CloudPrintPrivateSetupConnectorFunction:: |
| 37 ~CloudPrintPrivateSetupConnectorFunction() { | 38 ~CloudPrintPrivateSetupConnectorFunction() { |
| 38 } | 39 } |
| 39 | 40 |
| 40 | 41 |
| 41 bool CloudPrintPrivateSetupConnectorFunction::RunImpl() { | 42 bool CloudPrintPrivateSetupConnectorFunction::RunImpl() { |
| 42 using api::cloud_print_private::SetupConnector::Params; | 43 using api::cloud_print_private::SetupConnector::Params; |
| 43 scoped_ptr<Params> params(Params::Create(*args_)); | 44 scoped_ptr<Params> params(Params::Create(*args_)); |
| 44 if (CloudPrintTestsDelegate::instance()) { | 45 if (CloudPrintTestsDelegate::instance()) { |
| 45 CloudPrintTestsDelegate::instance()->SetupConnector( | 46 CloudPrintTestsDelegate::instance()->SetupConnector( |
| 46 params->user_email, | 47 params->user_email, |
| 47 params->robot_email, | 48 params->robot_email, |
| 48 params->credentials, | 49 params->credentials, |
| 49 params->connect_new_printers, | 50 params->user_settings); |
| 50 params->printer_blacklist); | |
| 51 } else { | 51 } else { |
| 52 if (!CloudPrintProxyServiceFactory::GetForProfile(profile_)) | 52 if (!CloudPrintProxyServiceFactory::GetForProfile(profile_)) |
| 53 return false; | 53 return false; |
| 54 scoped_ptr<base::DictionaryValue> user_setings( |
| 55 params->user_settings.ToValue()); |
| 54 CloudPrintProxyServiceFactory::GetForProfile(profile_)-> | 56 CloudPrintProxyServiceFactory::GetForProfile(profile_)-> |
| 55 EnableForUserWithRobot(params->credentials, | 57 EnableForUserWithRobot(params->credentials, |
| 56 params->robot_email, | 58 params->robot_email, |
| 57 params->user_email, | 59 params->user_email, |
| 58 params->connect_new_printers, | 60 *user_setings); |
| 59 params->printer_blacklist); | |
| 60 } | 61 } |
| 61 SendResponse(true); | 62 SendResponse(true); |
| 62 return true; | 63 return true; |
| 63 } | 64 } |
| 64 | 65 |
| 65 CloudPrintPrivateGetHostNameFunction::CloudPrintPrivateGetHostNameFunction() { | 66 CloudPrintPrivateGetHostNameFunction::CloudPrintPrivateGetHostNameFunction() { |
| 66 } | 67 } |
| 67 | 68 |
| 68 CloudPrintPrivateGetHostNameFunction::~CloudPrintPrivateGetHostNameFunction() { | 69 CloudPrintPrivateGetHostNameFunction::~CloudPrintPrivateGetHostNameFunction() { |
| 69 } | 70 } |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 bool CloudPrintPrivateGetClientIdFunction::RunImpl() { | 114 bool CloudPrintPrivateGetClientIdFunction::RunImpl() { |
| 114 SetResult(Value::CreateStringValue( | 115 SetResult(Value::CreateStringValue( |
| 115 CloudPrintTestsDelegate::instance() ? | 116 CloudPrintTestsDelegate::instance() ? |
| 116 CloudPrintTestsDelegate::instance()->GetClientId() : | 117 CloudPrintTestsDelegate::instance()->GetClientId() : |
| 117 google_apis::GetOAuth2ClientID(google_apis::CLIENT_CLOUD_PRINT))); | 118 google_apis::GetOAuth2ClientID(google_apis::CLIENT_CLOUD_PRINT))); |
| 118 SendResponse(true); | 119 SendResponse(true); |
| 119 return true; | 120 return true; |
| 120 } | 121 } |
| 121 | 122 |
| 122 } // namespace extensions | 123 } // namespace extensions |
| OLD | NEW |