summaryrefslogtreecommitdiffstats
path: root/chrome/service
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-08 22:55:55 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-08 22:55:55 +0000
commite0832490090b060c31ba3e93e74f6b8fed573dbd (patch)
tree85b8774a816cded4f45610bf4549d1b15d3fadef /chrome/service
parentaa90589bdd060bb7df2d950e1d648c1a91cd6b4f (diff)
downloadchromium_src-e0832490090b060c31ba3e93e74f6b8fed573dbd.zip
chromium_src-e0832490090b060c31ba3e93e74f6b8fed573dbd.tar.gz
chromium_src-e0832490090b060c31ba3e93e74f6b8fed573dbd.tar.bz2
New Cloud Print Private API.
Renamed cloudPrintPrivate.setCredentials -> cloudPrintPrivate.setupConnector Added cloudPrintPrivate.getHostName Added cloudPrintPrivate.getPrinters Extracted test logic from cloud_print_private_api.cc BUG=137129 Review URL: https://chromiumcodereview.appspot.com/11037005 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160734 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r--chrome/service/cloud_print/cloud_print_proxy.cc23
-rw-r--r--chrome/service/cloud_print/cloud_print_proxy.h5
-rw-r--r--chrome/service/service_ipc_server.cc9
-rw-r--r--chrome/service/service_ipc_server.h5
-rw-r--r--chrome/service/service_process_prefs.cc4
-rw-r--r--chrome/service/service_process_prefs.h3
6 files changed, 42 insertions, 7 deletions
diff --git a/chrome/service/cloud_print/cloud_print_proxy.cc b/chrome/service/cloud_print/cloud_print_proxy.cc
index c934fbe..d1c8cb8 100644
--- a/chrome/service/cloud_print/cloud_print_proxy.cc
+++ b/chrome/service/cloud_print/cloud_print_proxy.cc
@@ -122,8 +122,29 @@ void CloudPrintProxy::EnableForUser(const std::string& lsid) {
void CloudPrintProxy::EnableForUserWithRobot(
const std::string& robot_auth_code,
const std::string& robot_email,
- const std::string& user_email) {
+ const std::string& user_email,
+ bool connect_new_printers,
+ const std::vector<std::string>& printer_blacklist) {
DCHECK(CalledOnValidThread());
+
+ ShutdownBackend();
+ std::string proxy_id(
+ service_prefs_->GetString(prefs::kCloudPrintProxyId, ""));
+ service_prefs_->RemovePref(prefs::kCloudPrintRoot);
+ if (!proxy_id.empty()) {
+ // Keep only proxy id;
+ service_prefs_->SetString(prefs::kCloudPrintProxyId, proxy_id);
+ }
+ service_prefs_->SetBoolean(prefs::kCloudPrintConnectNewPrinters,
+ connect_new_printers);
+ if (!printer_blacklist.empty()) {
+ scoped_ptr<base::ListValue> printers(new base::ListValue());
+ printers->AppendStrings(printer_blacklist);
+ service_prefs_->SetValue(prefs::kCloudPrintConnectNewPrinters,
+ printers.release());
+ }
+ service_prefs_->WritePrefs();
+
if (!CreateBackend())
return;
DCHECK(backend_.get());
diff --git a/chrome/service/cloud_print/cloud_print_proxy.h b/chrome/service/cloud_print/cloud_print_proxy.h
index e844a9d..67ab4e7 100644
--- a/chrome/service/cloud_print/cloud_print_proxy.h
+++ b/chrome/service/cloud_print/cloud_print_proxy.h
@@ -7,6 +7,7 @@
#include <list>
#include <string>
+#include <vector>
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@@ -44,7 +45,9 @@ class CloudPrintProxy : public CloudPrintProxyFrontend,
void EnableForUserWithRobot(
const std::string& robot_auth_code,
const std::string& robot_email,
- const std::string& user_email);
+ const std::string& user_email,
+ bool connect_new_printers,
+ const std::vector<std::string>& printer_blacklist);
void UnregisterPrintersAndDisableForUser();
void DisableForUser();
// Returns the proxy info.
diff --git a/chrome/service/service_ipc_server.cc b/chrome/service/service_ipc_server.cc
index f25ce7b..4cca7ec 100644
--- a/chrome/service/service_ipc_server.cc
+++ b/chrome/service/service_ipc_server.cc
@@ -111,11 +111,12 @@ void ServiceIPCServer::OnEnableCloudPrintProxy(const std::string& lsid) {
void ServiceIPCServer::OnEnableCloudPrintProxyWithRobot(
const std::string& robot_auth_code,
const std::string& robot_email,
- const std::string& user_email) {
+ const std::string& user_email,
+ bool connect_new_printers,
+ const std::vector<std::string>& printer_blacklist) {
g_service_process->GetCloudPrintProxy()->EnableForUserWithRobot(
- robot_auth_code,
- robot_email,
- user_email);
+ robot_auth_code, robot_email, user_email, connect_new_printers,
+ printer_blacklist);
}
void ServiceIPCServer::OnGetCloudPrintProxyInfo() {
diff --git a/chrome/service/service_ipc_server.h b/chrome/service/service_ipc_server.h
index b2855be..4f7f5f7 100644
--- a/chrome/service/service_ipc_server.h
+++ b/chrome/service/service_ipc_server.h
@@ -6,6 +6,7 @@
#define CHROME_SERVICE_SERVICE_IPC_SERVER_H_
#include <string>
+#include <vector>
#include "base/memory/scoped_ptr.h"
#include "ipc/ipc_channel_handle.h"
@@ -47,7 +48,9 @@ class ServiceIPCServer : public IPC::Listener, public IPC::Sender {
void OnEnableCloudPrintProxyWithRobot(
const std::string& robot_auth_code,
const std::string& robot_email,
- const std::string& user_email);
+ const std::string& user_email,
+ bool connect_new_printers,
+ const std::vector<std::string>& printer_blacklist);
void OnGetCloudPrintProxyInfo();
void OnDisableCloudPrintProxy();
diff --git a/chrome/service/service_process_prefs.cc b/chrome/service/service_process_prefs.cc
index e1aca1a1..7de70a4 100644
--- a/chrome/service/service_process_prefs.cc
+++ b/chrome/service/service_process_prefs.cc
@@ -76,6 +76,10 @@ const base::ListValue* ServiceProcessPrefs::GetList(
return static_cast<const ListValue*>(value);
}
+void ServiceProcessPrefs::SetValue(const std::string& key, base::Value* value) {
+ prefs_->SetValue(key, value);
+}
+
void ServiceProcessPrefs::RemovePref(const std::string& key) {
prefs_->RemoveValue(key);
}
diff --git a/chrome/service/service_process_prefs.h b/chrome/service/service_process_prefs.h
index d03fda9..ef6d836 100644
--- a/chrome/service/service_process_prefs.h
+++ b/chrome/service/service_process_prefs.h
@@ -49,6 +49,9 @@ class ServiceProcessPrefs {
// Returns a list for |key|.
const base::ListValue* GetList(const std::string& key) const;
+ // Set a |value| for |key|.
+ void SetValue(const std::string& key, base::Value* value);
+
// Removes the pref specified by |key|.
void RemovePref(const std::string& key);