| OLD | NEW |
| 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/google_apis/fake_drive_service.h" | 5 #include "chrome/browser/google_apis/fake_drive_service.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 574 link->GetString("href", &href) && | 574 link->GetString("href", &href) && |
| 575 rel == "http://schemas.google.com/docs/2007#parent" && | 575 rel == "http://schemas.google.com/docs/2007#parent" && |
| 576 GURL(href) == parent_content_url) { | 576 GURL(href) == parent_content_url) { |
| 577 links->Remove(i, NULL); | 577 links->Remove(i, NULL); |
| 578 AddNewChangestamp(entry); | 578 AddNewChangestamp(entry); |
| 579 MessageLoop::current()->PostTask( | 579 MessageLoop::current()->PostTask( |
| 580 FROM_HERE, base::Bind(callback, HTTP_SUCCESS)); | 580 FROM_HERE, base::Bind(callback, HTTP_SUCCESS)); |
| 581 return; | 581 return; |
| 582 } | 582 } |
| 583 } | 583 } |
| 584 |
| 585 // We are dealing with a no-"parent"-link file as in the root directory. |
| 586 if (parent_content_url.is_empty()) { |
| 587 AddNewChangestamp(entry); |
| 588 MessageLoop::current()->PostTask( |
| 589 FROM_HERE, base::Bind(callback, HTTP_SUCCESS)); |
| 590 return; |
| 591 } |
| 584 } | 592 } |
| 585 } | 593 } |
| 586 | 594 |
| 587 MessageLoop::current()->PostTask( | 595 MessageLoop::current()->PostTask( |
| 588 FROM_HERE, base::Bind(callback, HTTP_NOT_FOUND)); | 596 FROM_HERE, base::Bind(callback, HTTP_NOT_FOUND)); |
| 589 } | 597 } |
| 590 | 598 |
| 591 void FakeDriveService::AddNewDirectory( | 599 void FakeDriveService::AddNewDirectory( |
| 592 const GURL& parent_content_url, | 600 const GURL& parent_content_url, |
| 593 const std::string& directory_name, | 601 const std::string& directory_name, |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 return base::StringPrintf("resource_id_%d", resource_id_count_); | 797 return base::StringPrintf("resource_id_%d", resource_id_count_); |
| 790 } | 798 } |
| 791 | 799 |
| 792 void FakeDriveService::AddNewChangestamp(base::DictionaryValue* entry) { | 800 void FakeDriveService::AddNewChangestamp(base::DictionaryValue* entry) { |
| 793 ++largest_changestamp_; | 801 ++largest_changestamp_; |
| 794 entry->SetString("docs$changestamp.value", | 802 entry->SetString("docs$changestamp.value", |
| 795 base::Int64ToString(largest_changestamp_)); | 803 base::Int64ToString(largest_changestamp_)); |
| 796 } | 804 } |
| 797 | 805 |
| 798 } // namespace google_apis | 806 } // namespace google_apis |
| OLD | NEW |