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/printing/cloud_print/cloud_print_proxy_service.h" | 5 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
6 | 6 |
7 #include <stack> | 7 #include <stack> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 bool CloudPrintProxyService::ApplyCloudPrintConnectorPolicy() { | 109 bool CloudPrintProxyService::ApplyCloudPrintConnectorPolicy() { |
110 if (!profile_->GetPrefs()->GetBoolean(prefs::kCloudPrintProxyEnabled)) { | 110 if (!profile_->GetPrefs()->GetBoolean(prefs::kCloudPrintProxyEnabled)) { |
111 std::string email = | 111 std::string email = |
112 profile_->GetPrefs()->GetString(prefs::kCloudPrintEmail); | 112 profile_->GetPrefs()->GetString(prefs::kCloudPrintEmail); |
113 if (!email.empty()) { | 113 if (!email.empty()) { |
114 DisableForUser(); | 114 DisableForUser(); |
115 profile_->GetPrefs()->SetString(prefs::kCloudPrintEmail, std::string()); | 115 profile_->GetPrefs()->SetString(prefs::kCloudPrintEmail, std::string()); |
116 if (enforcing_connector_policy_) { | 116 if (enforcing_connector_policy_) { |
117 MessageLoop::current()->PostTask( | 117 base::MessageLoop::current()->PostTask( |
118 FROM_HERE, | 118 FROM_HERE, |
119 base::Bind(&CloudPrintProxyService::RefreshCloudPrintProxyStatus, | 119 base::Bind(&CloudPrintProxyService::RefreshCloudPrintProxyStatus, |
120 weak_factory_.GetWeakPtr())); | 120 weak_factory_.GetWeakPtr())); |
121 } | 121 } |
122 return false; | 122 return false; |
123 } else if (enforcing_connector_policy_) { | 123 } else if (enforcing_connector_policy_) { |
124 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 124 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 125 base::MessageLoop::QuitClosure()); |
125 } | 126 } |
126 } | 127 } |
127 return true; | 128 return true; |
128 } | 129 } |
129 | 130 |
130 void CloudPrintProxyService::OnCloudPrintSetupClosed() { | 131 void CloudPrintProxyService::OnCloudPrintSetupClosed() { |
131 MessageLoop::current()->PostTask(FROM_HERE, | 132 base::MessageLoop::current()->PostTask(FROM_HERE, |
132 base::Bind(&chrome::EndKeepAlive)); | 133 base::Bind(&chrome::EndKeepAlive)); |
133 } | 134 } |
134 | 135 |
135 void CloudPrintProxyService::GetPrintersAvalibleForRegistration( | 136 void CloudPrintProxyService::GetPrintersAvalibleForRegistration( |
136 std::vector<std::string>* printers) { | 137 std::vector<std::string>* printers) { |
137 base::FilePath list_path( | 138 base::FilePath list_path( |
138 CommandLine::ForCurrentProcess()->GetSwitchValuePath( | 139 CommandLine::ForCurrentProcess()->GetSwitchValuePath( |
139 switches::kCloudPrintSetupProxy)); | 140 switches::kCloudPrintSetupProxy)); |
140 if (!list_path.empty()) { | 141 if (!list_path.empty()) { |
141 std::string printers_json; | 142 std::string printers_json; |
142 file_util::ReadFileToString(list_path, &printers_json); | 143 file_util::ReadFileToString(list_path, &printers_json); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 } | 213 } |
213 | 214 |
214 bool CloudPrintProxyService::InvokeServiceTask(const base::Closure& task) { | 215 bool CloudPrintProxyService::InvokeServiceTask(const base::Closure& task) { |
215 GetServiceProcessControl()->Launch(task, base::Closure()); | 216 GetServiceProcessControl()->Launch(task, base::Closure()); |
216 return true; | 217 return true; |
217 } | 218 } |
218 | 219 |
219 ServiceProcessControl* CloudPrintProxyService::GetServiceProcessControl() { | 220 ServiceProcessControl* CloudPrintProxyService::GetServiceProcessControl() { |
220 return ServiceProcessControl::GetInstance(); | 221 return ServiceProcessControl::GetInstance(); |
221 } | 222 } |
OLD | NEW |