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

Side by Side Diff: chrome/common/cloud_print/cloud_print_helpers.h

Issue 9443007: Add Chrome To Mobile Service and Views Page Action. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Put shared CloudPrint consts/helpers in chrome/common/; use CloudPrintURL. Created 8 years, 9 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_
6 #define CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_
7
8 #include <string>
9
10 class GURL;
11
12 namespace base {
13 class DictionaryValue;
14 }
15
16 // Helper consts and methods for both cloud print and chrome browser.
17 namespace cloud_print {
18
19 // Values in the respone JSON from the cloud print server
20 extern const char kPrinterListValue[];
21 extern const char kSuccessValue[];
22
23 extern const char kChromeCloudPrintProxyHeader[];
24
25 extern const char kDefaultCloudPrintOAuthClientId[];
26
27 // Appends a relative path to the url making sure to append a '/' if the
28 // URL's path does not end with a slash. It is assumed that |path| does not
29 // begin with a '/'.
30 // NOTE: Since we ALWAYS want to append here, we simply append the path string
31 // instead of calling url_utils::ResolveRelative. The input |url| may or may not
32 // contain a '/' at the end.
33 std::string AppendPathToUrl(const GURL& url, const std::string& path);
34
35 GURL GetUrlForSearch(const GURL& cloud_print_server_url);
36 GURL GetUrlForSubmit(const GURL& cloud_print_server_url);
37 GURL GetUrlForGetAuthCode(const GURL& cloud_print_server_url,
38 const std::string& oauth_client_id,
39 const std::string& proxy_id);
40
41 // Parses the response data for any cloud print server request. The method
42 // returns false if there was an error in parsing the JSON. The succeeded
43 // value returns the value of the "success" value in the response JSON.
44 // Returns the response as a dictionary value.
45 bool ParseResponseJSON(const std::string& response_data,
46 bool* succeeded,
47 base::DictionaryValue** response_dict);
48
49 // Prepares one value as part of a multi-part upload request.
50 void AddMultipartValueForUpload(const std::string& value_name,
51 const std::string& value,
52 const std::string& mime_boundary,
53 const std::string& content_type,
54 std::string* post_data);
55
56 // Create a MIME boundary marker (27 '-' characters followed by 16 hex digits).
57 void CreateMimeBoundaryForUpload(std::string *out);
58
59 // Generate a unique cloud print proxy id.
60 std::string GenerateProxyId();
61
62 } // namespace cloud_print
63
64 #endif // CHROME_COMMON_CLOUD_PRINT_CLOUD_PRINT_HELPERS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698