| Index: chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
|
| diff --git a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
|
| index bee9467dbf83af4f5144cd0e1bfb57a4ab6d0688..ecade406d85e008b4cd04f8ac83b49a0ff19986d 100644
|
| --- a/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
|
| +++ b/chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.cc
|
| @@ -14,13 +14,13 @@
|
| #include "base/strings/utf_string_conversions.h"
|
| #include "base/values.h"
|
| #include "build/build_config.h"
|
| -#include "chrome/browser/local_discovery/privet_confirm_api_flow.h"
|
| -#include "chrome/browser/local_discovery/privet_constants.h"
|
| -#include "chrome/browser/local_discovery/privet_device_lister_impl.h"
|
| -#include "chrome/browser/local_discovery/privet_http_asynchronous_factory.h"
|
| #include "chrome/browser/local_discovery/service_discovery_shared_client.h"
|
| #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
|
| #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.h"
|
| +#include "chrome/browser/printing/cloud_print/privet_confirm_api_flow.h"
|
| +#include "chrome/browser/printing/cloud_print/privet_constants.h"
|
| +#include "chrome/browser/printing/cloud_print/privet_device_lister_impl.h"
|
| +#include "chrome/browser/printing/cloud_print/privet_http_asynchronous_factory.h"
|
| #include "chrome/browser/profiles/profile.h"
|
| #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
|
| #include "chrome/browser/signin/signin_manager_factory.h"
|
| @@ -40,6 +40,11 @@
|
| #define CLOUD_PRINT_CONNECTOR_UI_AVAILABLE
|
| #endif
|
|
|
| +using cloud_print::CloudPrintPrinterList;
|
| +using cloud_print::DeviceDescription;
|
| +using cloud_print::GCDApiFlow;
|
| +using cloud_print::PrivetRegisterOperation;
|
| +
|
| namespace local_discovery {
|
|
|
| namespace {
|
| @@ -169,9 +174,11 @@ void LocalDiscoveryUIHandler::HandleStart(const base::ListValue* args) {
|
| if (!privet_lister_) {
|
| service_discovery_client_ = ServiceDiscoverySharedClient::GetInstance();
|
| privet_lister_.reset(
|
| - new PrivetDeviceListerImpl(service_discovery_client_.get(), this));
|
| - privet_http_factory_ = PrivetHTTPAsynchronousFactory::CreateInstance(
|
| - profile->GetRequestContext());
|
| + new cloud_print::PrivetDeviceListerImpl(service_discovery_client_.get(),
|
| + this));
|
| + privet_http_factory_ =
|
| + cloud_print::PrivetHTTPAsynchronousFactory::CreateInstance(
|
| + profile->GetRequestContext());
|
|
|
| SigninManagerBase* signin_manager =
|
| SigninManagerFactory::GetInstance()->GetForProfile(profile);
|
| @@ -266,9 +273,9 @@ void LocalDiscoveryUIHandler::HandleShowSyncUI(
|
| }
|
|
|
| void LocalDiscoveryUIHandler::StartRegisterHTTP(
|
| - scoped_ptr<PrivetHTTPClient> http_client) {
|
| + scoped_ptr<cloud_print::PrivetHTTPClient> http_client) {
|
| current_http_client_ =
|
| - PrivetV1HTTPClient::CreateDefault(std::move(http_client));
|
| + cloud_print::PrivetV1HTTPClient::CreateDefault(std::move(http_client));
|
|
|
| std::string user = GetSyncAccount();
|
|
|
| @@ -283,7 +290,7 @@ void LocalDiscoveryUIHandler::StartRegisterHTTP(
|
| }
|
|
|
| void LocalDiscoveryUIHandler::OnPrivetRegisterClaimToken(
|
| - PrivetRegisterOperation* operation,
|
| + cloud_print::PrivetRegisterOperation* operation,
|
| const std::string& token,
|
| const GURL& url) {
|
| web_ui()->CallJavascriptFunction(
|
| @@ -299,10 +306,11 @@ void LocalDiscoveryUIHandler::OnPrivetRegisterClaimToken(
|
| return;
|
| }
|
| confirm_api_call_flow_->Start(
|
| - make_scoped_ptr<GCDApiFlow::Request>(new PrivetConfirmApiCallFlow(
|
| - token,
|
| - base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone,
|
| - base::Unretained(this)))));
|
| + make_scoped_ptr<GCDApiFlow::Request>(
|
| + new cloud_print::PrivetConfirmApiCallFlow(
|
| + token,
|
| + base::Bind(&LocalDiscoveryUIHandler::OnConfirmDone,
|
| + base::Unretained(this)))));
|
| }
|
|
|
| void LocalDiscoveryUIHandler::OnPrivetRegisterError(
|
| @@ -314,12 +322,12 @@ void LocalDiscoveryUIHandler::OnPrivetRegisterError(
|
| std::string error;
|
|
|
| if (reason == PrivetRegisterOperation::FAILURE_JSON_ERROR &&
|
| - json->GetString(kPrivetKeyError, &error)) {
|
| - if (error == kPrivetErrorTimeout) {
|
| + json->GetString(cloud_print::kPrivetKeyError, &error)) {
|
| + if (error == cloud_print::kPrivetErrorTimeout) {
|
| web_ui()->CallJavascriptFunction(
|
| "local_discovery.onRegistrationTimeout");
|
| return;
|
| - } else if (error == kPrivetErrorCancel) {
|
| + } else if (error == cloud_print::kPrivetErrorCancel) {
|
| web_ui()->CallJavascriptFunction(
|
| "local_discovery.onRegistrationCanceledPrinter");
|
| return;
|
|
|