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

Side by Side Diff: chrome/browser/chromeos/gdata/gdata_operations.cc

Issue 10384086: Moved url_utils from chrome/browser/net to chrome/common/net. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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) 2012 The Chromium Authors. All rights reserved. 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 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/browser/chromeos/gdata/gdata_operations.h" 5 #include "chrome/browser/chromeos/gdata/gdata_operations.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/string_number_conversions.h" 10 #include "base/string_number_conversions.h"
11 #include "base/values.h" 11 #include "base/values.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" 13 #include "chrome/browser/chromeos/gdata/gdata_file_system.h"
14 #include "chrome/browser/chromeos/gdata/gdata_util.h" 14 #include "chrome/browser/chromeos/gdata/gdata_util.h"
15 #include "chrome/browser/net/browser_url_util.h"
16 #include "chrome/common/libxml_utils.h" 15 #include "chrome/common/libxml_utils.h"
16 #include "chrome/common/net/gaia/gaia_urls.h"
17 #include "chrome/common/net/gaia/google_service_auth_error.h" 17 #include "chrome/common/net/gaia/google_service_auth_error.h"
18 #include "chrome/common/net/gaia/gaia_urls.h" 18 #include "chrome/common/net/url_util.h"
19 #include "net/base/escape.h" 19 #include "net/base/escape.h"
20 #include "net/http/http_util.h" 20 #include "net/http/http_util.h"
21 21
22 using content::BrowserThread; 22 using content::BrowserThread;
23 using content::URLFetcher; 23 using content::URLFetcher;
24 24
25 namespace { 25 namespace {
26 26
27 // Used for success ratio histograms. 0 for failure, 1 for success, 27 // Used for success ratio histograms. 0 for failure, 1 for success,
28 // 2 for no connection (likely offline). 28 // 2 for no connection (likely offline).
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 83
84 // OAuth scope for the documents API. 84 // OAuth scope for the documents API.
85 const char kDocsListScope[] = "https://docs.google.com/feeds/"; 85 const char kDocsListScope[] = "https://docs.google.com/feeds/";
86 const char kSpreadsheetsScope[] = "https://spreadsheets.google.com/feeds/"; 86 const char kSpreadsheetsScope[] = "https://spreadsheets.google.com/feeds/";
87 const char kUserContentScope[] = "https://docs.googleusercontent.com/"; 87 const char kUserContentScope[] = "https://docs.googleusercontent.com/";
88 88
89 // Adds additional parameters for API version, output content type and to show 89 // Adds additional parameters for API version, output content type and to show
90 // folders in the feed are added to document feed URLs. 90 // folders in the feed are added to document feed URLs.
91 GURL AddStandardUrlParams(const GURL& url) { 91 GURL AddStandardUrlParams(const GURL& url) {
92 GURL result = 92 GURL result =
93 chrome_browser_net::AppendOrReplaceQueryParameter(url, "v", "3"); 93 chrome_common_net::AppendOrReplaceQueryParameter(url, "v", "3");
94 result = 94 result =
95 chrome_browser_net::AppendOrReplaceQueryParameter(result, "alt", "json"); 95 chrome_common_net::AppendOrReplaceQueryParameter(result, "alt", "json");
96 return result; 96 return result;
97 } 97 }
98 98
99 // Adds additional parameters to metadata feed to include installed 3rd party 99 // Adds additional parameters to metadata feed to include installed 3rd party
100 // applications. 100 // applications.
101 GURL AddMetadataUrlParams(const GURL& url) { 101 GURL AddMetadataUrlParams(const GURL& url) {
102 GURL result = AddStandardUrlParams(url); 102 GURL result = AddStandardUrlParams(url);
103 result = chrome_browser_net::AppendOrReplaceQueryParameter( 103 result = chrome_common_net::AppendOrReplaceQueryParameter(
104 result, "include-installed-apps", "true"); 104 result, "include-installed-apps", "true");
105 return result; 105 return result;
106 } 106 }
107 107
108 // Adds additional parameters for API version, output content type and to show 108 // Adds additional parameters for API version, output content type and to show
109 // folders in the feed are added to document feed URLs. 109 // folders in the feed are added to document feed URLs.
110 GURL AddFeedUrlParams(const GURL& url, 110 GURL AddFeedUrlParams(const GURL& url,
111 int num_items_to_fetch, 111 int num_items_to_fetch,
112 int changestamp, 112 int changestamp,
113 const std::string& search_string) { 113 const std::string& search_string) {
114 GURL result = AddStandardUrlParams(url); 114 GURL result = AddStandardUrlParams(url);
115 result = chrome_browser_net::AppendOrReplaceQueryParameter( 115 result = chrome_common_net::AppendOrReplaceQueryParameter(
116 result, 116 result,
117 "showfolders", 117 "showfolders",
118 "true"); 118 "true");
119 result = chrome_browser_net::AppendOrReplaceQueryParameter( 119 result = chrome_common_net::AppendOrReplaceQueryParameter(
120 result, 120 result,
121 "max-results", 121 "max-results",
122 base::StringPrintf("%d", num_items_to_fetch)); 122 base::StringPrintf("%d", num_items_to_fetch));
123 result = chrome_browser_net::AppendOrReplaceQueryParameter( 123 result = chrome_common_net::AppendOrReplaceQueryParameter(
124 result, "include-installed-apps", "true"); 124 result, "include-installed-apps", "true");
125 125
126 if (changestamp) { 126 if (changestamp) {
127 result = chrome_browser_net::AppendQueryParameter( 127 result = chrome_common_net::AppendQueryParameter(
128 result, 128 result,
129 "start-index", 129 "start-index",
130 base::StringPrintf("%d", changestamp)); 130 base::StringPrintf("%d", changestamp));
131 } 131 }
132 132
133 if (!search_string.empty()) { 133 if (!search_string.empty()) {
134 result = chrome_browser_net::AppendOrReplaceQueryParameter( 134 result = chrome_common_net::AppendOrReplaceQueryParameter(
135 result, "q", search_string); 135 result, "q", search_string);
136 } 136 }
137 return result; 137 return result;
138 } 138 }
139 139
140 } // namespace 140 } // namespace
141 141
142 namespace gdata { 142 namespace gdata {
143 143
144 //================================ AuthOperation =============================== 144 //================================ AuthOperation ===============================
(...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after
829 GDataOperationRegistry* registry, 829 GDataOperationRegistry* registry,
830 Profile* profile, 830 Profile* profile,
831 const InitiateUploadCallback& callback, 831 const InitiateUploadCallback& callback,
832 const InitiateUploadParams& params) 832 const InitiateUploadParams& params)
833 : UrlFetchOperationBase(registry, 833 : UrlFetchOperationBase(registry,
834 GDataOperationRegistry::OPERATION_UPLOAD, 834 GDataOperationRegistry::OPERATION_UPLOAD,
835 params.virtual_path, 835 params.virtual_path,
836 profile), 836 profile),
837 callback_(callback), 837 callback_(callback),
838 params_(params), 838 params_(params),
839 initiate_upload_url_(chrome_browser_net::AppendOrReplaceQueryParameter( 839 initiate_upload_url_(chrome_common_net::AppendOrReplaceQueryParameter(
840 params.resumable_create_media_link, 840 params.resumable_create_media_link,
841 kUploadParamConvertKey, 841 kUploadParamConvertKey,
842 kUploadParamConvertValue)) { 842 kUploadParamConvertValue)) {
843 } 843 }
844 844
845 InitiateUploadOperation::~InitiateUploadOperation() {} 845 InitiateUploadOperation::~InitiateUploadOperation() {}
846 846
847 GURL InitiateUploadOperation::GetURL() const { 847 GURL InitiateUploadOperation::GetURL() const {
848 return initiate_upload_url_; 848 return initiate_upload_url_;
849 } 849 }
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
1042 return true; 1042 return true;
1043 } 1043 }
1044 1044
1045 void ResumeUploadOperation::OnURLFetchUploadProgress( 1045 void ResumeUploadOperation::OnURLFetchUploadProgress(
1046 const content::URLFetcher* source, int64 current, int64 total) { 1046 const content::URLFetcher* source, int64 current, int64 total) {
1047 // Adjust the progress values according to the range currently uploaded. 1047 // Adjust the progress values according to the range currently uploaded.
1048 NotifyProgress(params_.start_range + current, params_.content_length); 1048 NotifyProgress(params_.start_range + current, params_.content_length);
1049 } 1049 }
1050 1050
1051 } // namespace gdata 1051 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_documents_service.cc ('k') | chrome/browser/chromeos/login/existing_user_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698