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