| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/service/cloud_print/cloud_print_proxy.h" | 5 #include "chrome/service/cloud_print/cloud_print_proxy.h" |
| 6 | 6 |
| 7 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 8 #include "base/path_service.h" | 9 #include "base/path_service.h" |
| 9 #include "base/process_util.h" | 10 #include "base/process_util.h" |
| 10 #include "base/values.h" | 11 #include "base/values.h" |
| 11 #include "chrome/common/chrome_switches.h" | 12 #include "chrome/common/chrome_switches.h" |
| 12 #include "chrome/common/cloud_print/cloud_print_proxy_info.h" | 13 #include "chrome/common/cloud_print/cloud_print_proxy_info.h" |
| 13 #include "chrome/common/net/gaia/gaia_oauth_client.h" | 14 #include "chrome/common/net/gaia/gaia_oauth_client.h" |
| 14 #include "chrome/common/pref_names.h" | 15 #include "chrome/common/pref_names.h" |
| 15 #include "chrome/service/cloud_print/cloud_print_consts.h" | 16 #include "chrome/service/cloud_print/cloud_print_consts.h" |
| 16 #include "chrome/service/cloud_print/print_system.h" | 17 #include "chrome/service/cloud_print/print_system.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 // Also delete the cached robot credentials since they may not be valid any | 215 // Also delete the cached robot credentials since they may not be valid any |
| 215 // longer. | 216 // longer. |
| 216 service_prefs_->RemovePref(prefs::kCloudPrintRobotRefreshToken); | 217 service_prefs_->RemovePref(prefs::kCloudPrintRobotRefreshToken); |
| 217 service_prefs_->RemovePref(prefs::kCloudPrintRobotEmail); | 218 service_prefs_->RemovePref(prefs::kCloudPrintRobotEmail); |
| 218 service_prefs_->WritePrefs(); | 219 service_prefs_->WritePrefs(); |
| 219 | 220 |
| 220 // Launch the browser to display a notification that the credentials have | 221 // Launch the browser to display a notification that the credentials have |
| 221 // expired (unless error dialogs are disabled). | 222 // expired (unless error dialogs are disabled). |
| 222 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoErrorDialogs)) | 223 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoErrorDialogs)) |
| 223 g_service_process->io_thread()->message_loop_proxy()->PostTask( | 224 g_service_process->io_thread()->message_loop_proxy()->PostTask( |
| 224 FROM_HERE, NewRunnableFunction(&ShowTokenExpiredNotificationInBrowser)); | 225 FROM_HERE, base::Bind(&ShowTokenExpiredNotificationInBrowser)); |
| 225 } | 226 } |
| 226 | 227 |
| 227 void CloudPrintProxy::OnPrintSystemUnavailable() { | 228 void CloudPrintProxy::OnPrintSystemUnavailable() { |
| 228 // If the print system is unavailable, we want to shutdown the proxy and | 229 // If the print system is unavailable, we want to shutdown the proxy and |
| 229 // disable it non-persistently. | 230 // disable it non-persistently. |
| 230 Shutdown(); | 231 Shutdown(); |
| 231 if (client_) { | 232 if (client_) { |
| 232 client_->OnCloudPrintProxyDisabled(false); | 233 client_->OnCloudPrintProxyDisabled(false); |
| 233 } | 234 } |
| 234 } | 235 } |
| 235 | 236 |
| 236 void CloudPrintProxy::Shutdown() { | 237 void CloudPrintProxy::Shutdown() { |
| 237 DCHECK(CalledOnValidThread()); | 238 DCHECK(CalledOnValidThread()); |
| 238 if (backend_.get()) | 239 if (backend_.get()) |
| 239 backend_->Shutdown(); | 240 backend_->Shutdown(); |
| 240 backend_.reset(); | 241 backend_.reset(); |
| 241 } | 242 } |
| 242 | 243 |
| OLD | NEW |