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

Unified Diff: chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h

Issue 1566047: First cut of Cloud Print Proxy implementation. The code is not enabled for no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Final review changes Created 10 years, 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h
===================================================================
--- chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h (revision 0)
+++ chrome/browser/printing/cloud_print/cloud_print_proxy_backend.h (revision 0)
@@ -0,0 +1,70 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_
+#define CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_
+
+#include <map>
+#include <string>
+
+#include "base/thread.h"
+#include "chrome/browser/net/url_fetcher.h"
+#include "chrome/browser/printing/cloud_print/printer_info.h"
+
+class CloudPrintProxyService;
+class DictionaryValue;
+
+// CloudPrintProxyFrontend is the interface used by CloudPrintProxyBackend to
+// communicate with the entity that created it and, presumably, is interested in
+// cloud print proxy related activity.
+// NOTE: All methods will be invoked by a CloudPrintProxyBackend on the same
+// thread used to create that CloudPrintProxyBackend.
+class CloudPrintProxyFrontend {
+ public:
+ CloudPrintProxyFrontend() {}
+
+ // There is a list of printers available that can be registered.
+ virtual void OnPrinterListAvailable(
+ const cloud_print::PrinterList& printer_list) = 0;
+
+ protected:
+ // Don't delete through SyncFrontend interface.
+ virtual ~CloudPrintProxyFrontend() {
+ }
+ private:
+ DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyFrontend);
+};
+
+class CloudPrintProxyBackend {
+ public:
+ explicit CloudPrintProxyBackend(CloudPrintProxyFrontend* frontend);
+ ~CloudPrintProxyBackend();
+
+ bool Initialize(const std::string& auth_token, const std::string& proxy_id);
+ void Shutdown();
+ void RegisterPrinters(const cloud_print::PrinterList& printer_list);
+ void HandlePrinterNotification(const std::string& printer_id);
+
+ private:
+ // The real guts of SyncBackendHost, to keep the public client API clean.
+ class Core;
+ // A thread we dedicate for use to perform initialization and
+ // authentication.
+ base::Thread core_thread_;
+ // Our core, which communicates with AuthWatcher for GAIA authentication and
+ // which contains printer registration code.
+ scoped_refptr<Core> core_;
+ // A reference to the MessageLoop used to construct |this|, so we know how
+ // to safely talk back to the SyncFrontend.
+ MessageLoop* const frontend_loop_;
+ // The frontend which is responsible for displaying UI and updating Prefs
+ CloudPrintProxyFrontend* frontend_;
+
+ friend class base::RefCountedThreadSafe<CloudPrintProxyBackend::Core>;
+
+ DISALLOW_COPY_AND_ASSIGN(CloudPrintProxyBackend);
+};
+
+#endif // CHROME_BROWSER_PRINTING_CLOUD_PRINT_CLOUD_PRINT_PROXY_BACKEND_H_
+
Property changes on: chrome\browser\printing\cloud_print\cloud_print_proxy_backend.h
___________________________________________________________________
Added: svn:eol-style
+ LF

Powered by Google App Engine
This is Rietveld 408576698