Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: chrome/service/cloud_print/cloud_print_proxy_backend.cc

Issue 2802015: Massively simplify the NetworkChangeNotifier infrastructure:... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_backend.h" 5 #include "chrome/service/cloud_print/cloud_print_proxy_backend.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/md5.h" 8 #include "base/md5.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/service/cloud_print/cloud_print_consts.h" 12 #include "chrome/service/cloud_print/cloud_print_consts.h"
13 #include "chrome/service/cloud_print/cloud_print_helpers.h" 13 #include "chrome/service/cloud_print/cloud_print_helpers.h"
14 #include "chrome/service/cloud_print/printer_job_handler.h" 14 #include "chrome/service/cloud_print/printer_job_handler.h"
15 #include "chrome/common/net/notifier/listener/mediator_thread_impl.h" 15 #include "chrome/common/net/notifier/listener/mediator_thread_impl.h"
16 #include "chrome/common/net/notifier/listener/talk_mediator_impl.h" 16 #include "chrome/common/net/notifier/listener/talk_mediator_impl.h"
17 #include "chrome/service/gaia/service_gaia_authenticator.h" 17 #include "chrome/service/gaia/service_gaia_authenticator.h"
18 #include "chrome/service/net/service_network_change_notifier_thread.h"
19 #include "chrome/service/service_process.h" 18 #include "chrome/service/service_process.h"
20 19
21 #include "googleurl/src/gurl.h" 20 #include "googleurl/src/gurl.h"
22 #include "net/url_request/url_request_status.h" 21 #include "net/url_request/url_request_status.h"
23 22
24 // The real guts of SyncBackendHost, to keep the public client API clean. 23 // The real guts of SyncBackendHost, to keep the public client API clean.
25 class CloudPrintProxyBackend::Core 24 class CloudPrintProxyBackend::Core
26 : public base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>, 25 : public base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>,
27 public URLFetcherDelegate, 26 public URLFetcherDelegate,
28 public cloud_print::PrintServerWatcherDelegate, 27 public cloud_print::PrintServerWatcherDelegate,
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 return; // No print system available, fail initalization. 297 return; // No print system available, fail initalization.
299 } 298 }
300 299
301 // TODO(sanjeevr): Validate the tokens. 300 // TODO(sanjeevr): Validate the tokens.
302 auth_token_ = cloud_print_token; 301 auth_token_ = cloud_print_token;
303 302
304 const bool kInitializeSsl = true; 303 const bool kInitializeSsl = true;
305 const bool kConnectImmediately = false; 304 const bool kConnectImmediately = false;
306 const bool kInvalidateXmppAuthToken = false; 305 const bool kInvalidateXmppAuthToken = false;
307 talk_mediator_.reset(new notifier::TalkMediatorImpl( 306 talk_mediator_.reset(new notifier::TalkMediatorImpl(
308 new notifier::MediatorThreadImpl( 307 new notifier::MediatorThreadImpl(), kInitializeSsl, kConnectImmediately,
309 g_service_process->network_change_notifier_thread()), 308 kInvalidateXmppAuthToken));
310 kInitializeSsl, kConnectImmediately, kInvalidateXmppAuthToken));
311 talk_mediator_->AddSubscribedServiceUrl(kCloudPrintTalkServiceUrl); 309 talk_mediator_->AddSubscribedServiceUrl(kCloudPrintTalkServiceUrl);
312 talk_mediator_->SetDelegate(this); 310 talk_mediator_->SetDelegate(this);
313 talk_mediator_->SetAuthToken(email, cloud_print_xmpp_token, 311 talk_mediator_->SetAuthToken(email, cloud_print_xmpp_token,
314 kSyncGaiaServiceId); 312 kSyncGaiaServiceId);
315 talk_mediator_->Login(); 313 talk_mediator_->Login();
316 314
317 print_server_watcher_ = print_system_->CreatePrintServerWatcher(); 315 print_server_watcher_ = print_system_->CreatePrintServerWatcher();
318 print_server_watcher_->StartWatching(this); 316 print_server_watcher_->StartWatching(this);
319 317
320 proxy_id_ = proxy_id; 318 proxy_id_ = proxy_id;
(...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 StartRegistration(); 643 StartRegistration();
646 } 644 }
647 } 645 }
648 646
649 // PrinterJobHandler::Delegate implementation 647 // PrinterJobHandler::Delegate implementation
650 void CloudPrintProxyBackend::Core::OnPrinterJobHandlerShutdown( 648 void CloudPrintProxyBackend::Core::OnPrinterJobHandlerShutdown(
651 PrinterJobHandler* job_handler, const std::string& printer_id) { 649 PrinterJobHandler* job_handler, const std::string& printer_id) {
652 job_handler_map_.erase(printer_id); 650 job_handler_map_.erase(printer_id);
653 } 651 }
654 652
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698