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

Unified Diff: chrome/browser/chrome_to_mobile/receive/chrome_to_mobile_receive_util.h

Issue 11038063: Support chrome_to_mobile job receiving Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix format Created 8 years, 1 month 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/chrome_to_mobile/receive/chrome_to_mobile_receive_util.h
diff --git a/chrome/browser/chrome_to_mobile/receive/chrome_to_mobile_receive_util.h b/chrome/browser/chrome_to_mobile/receive/chrome_to_mobile_receive_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..41e8c74a232c56e2484535ddfda75b6f95de2895
--- /dev/null
+++ b/chrome/browser/chrome_to_mobile/receive/chrome_to_mobile_receive_util.h
@@ -0,0 +1,117 @@
+// Copyright 2012 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_CHROME_TO_MOBILE_RECEIVE_CHROME_TO_MOBILE_RECEIVE_UTIL_H_
+#define CHROME_BROWSER_CHROME_TO_MOBILE_RECEIVE_CHROME_TO_MOBILE_RECEIVE_UTIL_H_
+
+#include <map>
+#include <set>
+#include <string>
+
+#include "base/values.h"
+#include "googleurl/src/gurl.h"
+
+namespace cloud_print {
+class CloudPrintRequest;
+} // namespace cloud_print
+
+namespace chrome_to_mobile_receive {
+
+// Constants used in receiving chrome_to_mobile jobs.
+// The id of a snapshot.
+extern const char kSnapshotIdTag[];
+// The tag name of the type of print jobs for snapshots.
+extern const char kSnapshotTypeTag[];
+// The type of print jobs that contain url for snapshots that have only url.
+extern const char kSnapshotTypeURL[];
+// The type of print jobs that contain url for snapshots sent with offline data.
+extern const char kSnapshotTypeURLWithDelayedSnapshot[];
+// The type of print jobs that contain the offline data for snapshots.
+extern const char kSnapshotTypeSnapshot[];
+// The tag for the original url in a snapshot.
+extern const char kSnapshotOriginalUrlTag[];
+// The tag prefix of the proxy used to receive chrome_to_mobile jobs.
+extern const char kProxyTagPrefix[];
+// The tag name of the tags hash for the printer associated with this device
+// to receive chrome_to_mobile jobs.
+extern const char kTagsHashTagName[];
+
+extern const char kChromeToMobileClientParameter[];
+
+// Returns the URL of the google cloud print server.
+GURL GetCloudPrintServerURL();
+
+// Returns the id of the print proxy with which this device should be
+// registered. This method can be platform-specific.
+std::string GenerateProxyIdValue();
+
+// Returns the name of the printer associated with this device to receive
+// chrome-to-mobile jobs. This method can be platform-specific.
+std::string GenreatePrinterName();
+
+// Returns a description of the device as a cloud printer. This mehtod can be
+// platform-specific.
+std::string GeneratePrinterDescription();
+
+// Returns the type of this device as a cloud printer. This information is used
+// to check if the printer is a chrome-to-mobile job recipient when special
+// action is needed for chrome-to-mobile on cloud print server.
+std::string GeneratePrinterType();
+
+// Returns the post data for updating the printer with |printer_tags|. The
+// post mime boundary is returned in pointer parameter |post_mime_boundary|.
+std::string GeneratePrinterUpdatePostData(
+ const std::map<std::string, std::string>& printer_tags,
+ std::string* post_mime_boundary);
+
+// Returns the post data for registering the printer with |printer_tags|. The
+// post mime boundary is returned in |post_mime_boundary|.
+std::string GeneratePrinterRegistrationPostData(
+ const std::map<std::string, std::string>& printer_tags,
+ std::string* post_mime_boundary);
+
+// Parses the |index|th entry in |job_list| to get snapshot url job information,
+// where |job_list| is the job json returned in a cloud print fetch response.
+// If it is a valid snashot url job, the parsed data are returned in the pointer
+// parameters and true is returned. Otherwise, false is returned.
+bool ParseSnapshotURLJobInformationFromCloudPrintFetchJobList(
+ const ListValue* job_list,
+ int index,
+ std::string* job_id,
+ std::string* snapshot_id,
+ std::string* snapshot_type,
+ std::string* original_url,
+ std::string* title,
+ std::string* job_creation_time);
+
+// Parses the |index|th entry in |job_list| to get snapshot offline data job
+// information, where |job_list| is the job json returned in a cloud print fetch
+// response.
+// If it is a valid snashot offline data job, the parsed data are
+// returned in the pointer parameters and true is returned. Otherwise, false is
+// returned.
+bool ParseSnapshotOfflineDataJobInformationFromCloudPrintFetchJobList(
+ const ListValue* job_list,
+ int index,
+ std::string* job_id,
+ std::string* snapshot_id,
+ std::string* offline_data_download_url);
+
+// This method parses print-to-phone job information from the |index|th entry in
+// |job_list|, where |job_list| is the job json returned in a cloud print fetch
+// response.
+// It returns true if the |index|th entry in |job_list| is a print-to-phone job;
+// parsed data are returned in the pointer parameters. It returns false therwise
+// and the values in the pointer parameters should be ignored.
+bool ParseQueuedPrintToPhoneJobFromFetchJobList(
+ const ListValue* job_list,
+ int index,
+ std::string* job_id,
+ std::string* title,
+ std::string* data_download_url);
+
+} // namespace chrome_to_mobile_receive
+
+
+#endif // CHROME_BROWSER_CHROME_TO_MOBILE_RECEIVE_CHROME_TO_MOBILE_RECEIVE_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698