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

Side by Side Diff: chrome/browser/google_apis/gdata_operations.cc

Issue 10920091: Move Drive API files to google_apis directory (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Disable some tests Created 8 years, 3 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/google_apis/gdata_operations.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/stringprintf.h" 8 #include "base/stringprintf.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chromeos/gdata/gdata_util.h" 10 #include "chrome/browser/google_apis/gdata_util.h"
11 #include "chrome/browser/chromeos/gdata/gdata_wapi_parser.h" 11 #include "chrome/browser/google_apis/gdata_wapi_parser.h"
12 #include "chrome/common/net/url_util.h" 12 #include "chrome/common/net/url_util.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "net/base/escape.h" 14 #include "net/base/escape.h"
15 #include "net/http/http_util.h" 15 #include "net/http/http_util.h"
16 #include "third_party/libxml/chromium/libxml_utils.h" 16 #include "third_party/libxml/chromium/libxml_utils.h"
17 17
18 using net::URLFetcher; 18 using net::URLFetcher;
19 19
20 namespace { 20 namespace {
21 21
(...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 xml_writer.StartElement("entry"); 411 xml_writer.StartElement("entry");
412 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom"); 412 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom");
413 413
414 xml_writer.StartElement("category"); 414 xml_writer.StartElement("category");
415 xml_writer.AddAttribute("scheme", 415 xml_writer.AddAttribute("scheme",
416 "http://schemas.google.com/g/2005#kind"); 416 "http://schemas.google.com/g/2005#kind");
417 xml_writer.AddAttribute("term", 417 xml_writer.AddAttribute("term",
418 "http://schemas.google.com/docs/2007#folder"); 418 "http://schemas.google.com/docs/2007#folder");
419 xml_writer.EndElement(); // Ends "category" element. 419 xml_writer.EndElement(); // Ends "category" element.
420 420
421 xml_writer.WriteElement("title", directory_name_); 421 xml_writer.WriteElement("title", FilePath(directory_name_).AsUTF8Unsafe());
422 422
423 xml_writer.EndElement(); // Ends "entry" element. 423 xml_writer.EndElement(); // Ends "entry" element.
424 xml_writer.StopWriting(); 424 xml_writer.StopWriting();
425 upload_content->assign(xml_writer.GetWrittenString()); 425 upload_content->assign(xml_writer.GetWrittenString());
426 DVLOG(1) << "CreateDirectory data: " << *upload_content_type << ", [" 426 DVLOG(1) << "CreateDirectory data: " << *upload_content_type << ", ["
427 << *upload_content << "]"; 427 << *upload_content << "]";
428 return true; 428 return true;
429 } 429 }
430 430
431 //============================ CopyDocumentOperation =========================== 431 //============================ CopyDocumentOperation ===========================
(...skipping 20 matching lines...) Expand all
452 452
453 bool CopyDocumentOperation::GetContentData(std::string* upload_content_type, 453 bool CopyDocumentOperation::GetContentData(std::string* upload_content_type,
454 std::string* upload_content) { 454 std::string* upload_content) {
455 upload_content_type->assign("application/atom+xml"); 455 upload_content_type->assign("application/atom+xml");
456 XmlWriter xml_writer; 456 XmlWriter xml_writer;
457 xml_writer.StartWriting(); 457 xml_writer.StartWriting();
458 xml_writer.StartElement("entry"); 458 xml_writer.StartElement("entry");
459 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom"); 459 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom");
460 460
461 xml_writer.WriteElement("id", resource_id_); 461 xml_writer.WriteElement("id", resource_id_);
462 xml_writer.WriteElement("title", new_name_); 462 xml_writer.WriteElement("title", FilePath(new_name_).AsUTF8Unsafe());
463 463
464 xml_writer.EndElement(); // Ends "entry" element. 464 xml_writer.EndElement(); // Ends "entry" element.
465 xml_writer.StopWriting(); 465 xml_writer.StopWriting();
466 upload_content->assign(xml_writer.GetWrittenString()); 466 upload_content->assign(xml_writer.GetWrittenString());
467 DVLOG(1) << "CopyDocumentOperation data: " << *upload_content_type << ", [" 467 DVLOG(1) << "CopyDocumentOperation data: " << *upload_content_type << ", ["
468 << *upload_content << "]"; 468 << *upload_content << "]";
469 return true; 469 return true;
470 } 470 }
471 471
472 //=========================== RenameResourceOperation ========================== 472 //=========================== RenameResourceOperation ==========================
(...skipping 25 matching lines...) Expand all
498 } 498 }
499 499
500 bool RenameResourceOperation::GetContentData(std::string* upload_content_type, 500 bool RenameResourceOperation::GetContentData(std::string* upload_content_type,
501 std::string* upload_content) { 501 std::string* upload_content) {
502 upload_content_type->assign("application/atom+xml"); 502 upload_content_type->assign("application/atom+xml");
503 XmlWriter xml_writer; 503 XmlWriter xml_writer;
504 xml_writer.StartWriting(); 504 xml_writer.StartWriting();
505 xml_writer.StartElement("entry"); 505 xml_writer.StartElement("entry");
506 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom"); 506 xml_writer.AddAttribute("xmlns", "http://www.w3.org/2005/Atom");
507 507
508 xml_writer.WriteElement("title", new_name_); 508 xml_writer.WriteElement("title", FilePath(new_name_).AsUTF8Unsafe());
509 509
510 xml_writer.EndElement(); // Ends "entry" element. 510 xml_writer.EndElement(); // Ends "entry" element.
511 xml_writer.StopWriting(); 511 xml_writer.StopWriting();
512 upload_content->assign(xml_writer.GetWrittenString()); 512 upload_content->assign(xml_writer.GetWrittenString());
513 DVLOG(1) << "RenameResourceOperation data: " << *upload_content_type << ", [" 513 DVLOG(1) << "RenameResourceOperation data: " << *upload_content_type << ", ["
514 << *upload_content << "]"; 514 << *upload_content << "]";
515 return true; 515 return true;
516 } 516 }
517 517
518 //=========================== AuthorizeAppOperation ========================== 518 //=========================== AuthorizeAppOperation ==========================
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1008 OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS); 1008 OnProcessURLFetchResultsComplete(code == HTTP_SUCCESS);
1009 } 1009 }
1010 1010
1011 void GetContactPhotoOperation::RunCallbackOnPrematureFailure( 1011 void GetContactPhotoOperation::RunCallbackOnPrematureFailure(
1012 GDataErrorCode code) { 1012 GDataErrorCode code) {
1013 scoped_ptr<std::string> data(new std::string); 1013 scoped_ptr<std::string> data(new std::string);
1014 callback_.Run(code, data.Pass()); 1014 callback_.Run(code, data.Pass());
1015 } 1015 }
1016 1016
1017 } // namespace gdata 1017 } // namespace gdata
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698