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

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

Issue 10274002: Add gdata content search (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: style nits 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"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
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_browser_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, int num_items_to_fetch, 110 GURL AddFeedUrlParams(const GURL& url,
111 int changestamp) { 111 int num_items_to_fetch,
112 int changestamp,
113 const std::string& search_string) {
112 GURL result = AddStandardUrlParams(url); 114 GURL result = AddStandardUrlParams(url);
113 result = chrome_browser_net::AppendOrReplaceQueryParameter( 115 result = chrome_browser_net::AppendOrReplaceQueryParameter(
114 result, 116 result,
115 "showfolders", 117 "showfolders",
116 "true"); 118 "true");
117 result = chrome_browser_net::AppendOrReplaceQueryParameter( 119 result = chrome_browser_net::AppendOrReplaceQueryParameter(
118 result, 120 result,
119 "max-results", 121 "max-results",
120 base::StringPrintf("%d", num_items_to_fetch)); 122 base::StringPrintf("%d", num_items_to_fetch));
121 123
122 if (changestamp) { 124 if (changestamp) {
123 result = chrome_browser_net::AppendQueryParameter( 125 result = chrome_browser_net::AppendQueryParameter(
124 result, 126 result,
125 "start-index", 127 "start-index",
126 base::StringPrintf("%d", changestamp)); 128 base::StringPrintf("%d", changestamp));
127 } 129 }
130
131 if (!search_string.empty()) {
132 result = chrome_browser_net::AppendOrReplaceQueryParameter(
133 result, "q", search_string);
134 }
128 return result; 135 return result;
129 } 136 }
130 137
131 } // namespace 138 } // namespace
132 139
133 namespace gdata { 140 namespace gdata {
134 141
135 //================================ AuthOperation =============================== 142 //================================ AuthOperation ===============================
136 143
137 AuthOperation::AuthOperation(GDataOperationRegistry* registry, 144 AuthOperation::AuthOperation(GDataOperationRegistry* registry,
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 return NULL; 456 return NULL;
450 } 457 }
451 return root_value.release(); 458 return root_value.release();
452 } 459 }
453 460
454 //============================ GetDocumentsOperation =========================== 461 //============================ GetDocumentsOperation ===========================
455 462
456 GetDocumentsOperation::GetDocumentsOperation(GDataOperationRegistry* registry, 463 GetDocumentsOperation::GetDocumentsOperation(GDataOperationRegistry* registry,
457 Profile* profile, 464 Profile* profile,
458 int start_changestamp, 465 int start_changestamp,
466 const std::string& search_string,
459 const GetDataCallback& callback) 467 const GetDataCallback& callback)
460 : GetDataOperation(registry, profile, callback), 468 : GetDataOperation(registry, profile, callback),
461 start_changestamp_(start_changestamp) { 469 start_changestamp_(start_changestamp),
470 search_string_(search_string) {
462 } 471 }
463 472
464 GetDocumentsOperation::~GetDocumentsOperation() {} 473 GetDocumentsOperation::~GetDocumentsOperation() {}
465 474
466 void GetDocumentsOperation::SetUrl(const GURL& url) { 475 void GetDocumentsOperation::SetUrl(const GURL& url) {
467 override_url_ = url; 476 override_url_ = url;
468 } 477 }
469 478
470 GURL GetDocumentsOperation::GetURL() const { 479 GURL GetDocumentsOperation::GetURL() const {
471 if (!override_url_.is_empty()) 480 if (!override_url_.is_empty())
472 return AddFeedUrlParams(override_url_, kMaxDocumentsPerFeed, 0); 481 return AddFeedUrlParams(override_url_,
482 kMaxDocumentsPerFeed,
483 0,
484 std::string());
473 485
474 if (start_changestamp_ == 0) { 486 if (start_changestamp_ == 0) {
475 return AddFeedUrlParams(GURL(kGetDocumentListURL), 487 return AddFeedUrlParams(GURL(kGetDocumentListURL),
476 kMaxDocumentsPerFeed, 488 kMaxDocumentsPerFeed,
477 0); 489 0,
490 search_string_);
478 } 491 }
479 492
480 return AddFeedUrlParams(GURL(kGetChangesListURL), 493 return AddFeedUrlParams(GURL(kGetChangesListURL),
481 kMaxDocumentsPerFeed, 494 kMaxDocumentsPerFeed,
482 start_changestamp_); 495 start_changestamp_,
496 std::string());
483 } 497 }
484 498
485 //========================= GetAccountMetadataOperation ======================== 499 //========================= GetAccountMetadataOperation ========================
486 500
487 GetAccountMetadataOperation::GetAccountMetadataOperation( 501 GetAccountMetadataOperation::GetAccountMetadataOperation(
488 GDataOperationRegistry* registry, 502 GDataOperationRegistry* registry,
489 Profile* profile, 503 Profile* profile,
490 const GetDataCallback& callback) 504 const GetDataCallback& callback)
491 : GetDataOperation(registry, profile, callback) { 505 : GetDataOperation(registry, profile, callback) {
492 } 506 }
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 return true; 1040 return true;
1027 } 1041 }
1028 1042
1029 void ResumeUploadOperation::OnURLFetchUploadProgress( 1043 void ResumeUploadOperation::OnURLFetchUploadProgress(
1030 const content::URLFetcher* source, int64 current, int64 total) { 1044 const content::URLFetcher* source, int64 current, int64 total) {
1031 // Adjust the progress values according to the range currently uploaded. 1045 // Adjust the progress values according to the range currently uploaded.
1032 NotifyProgress(params_.start_range + current, params_.content_length); 1046 NotifyProgress(params_.start_range + current, params_.content_length);
1033 } 1047 }
1034 1048
1035 } // namespace gdata 1049 } // namespace gdata
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/gdata/gdata_operations.h ('k') | chrome/browser/chromeos/gdata/gdata_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698