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/chromeos/gdata/gdata_file_system.h" | 5 #include "chrome/browser/chromeos/gdata/gdata_file_system.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 3065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3076 base::Bind(&OnCacheUpdatedForAddUploadedFile, | 3076 base::Bind(&OnCacheUpdatedForAddUploadedFile, |
3077 params->callback)); | 3077 params->callback)); |
3078 } else if (params->upload_mode == UPLOAD_EXISTING_FILE) { | 3078 } else if (params->upload_mode == UPLOAD_EXISTING_FILE) { |
3079 // Clear the dirty bit if we have updated an existing file. | 3079 // Clear the dirty bit if we have updated an existing file. |
3080 cache_->ClearDirtyOnUIThread(params->resource_id, | 3080 cache_->ClearDirtyOnUIThread(params->resource_id, |
3081 params->md5, | 3081 params->md5, |
3082 base::Bind(&OnCacheUpdatedForAddUploadedFile, | 3082 base::Bind(&OnCacheUpdatedForAddUploadedFile, |
3083 params->callback)); | 3083 params->callback)); |
3084 } else { | 3084 } else { |
3085 NOTREACHED() << "Unexpected upload mode: " << params->upload_mode; | 3085 NOTREACHED() << "Unexpected upload mode: " << params->upload_mode; |
| 3086 // Shouldn't reach here, so the line below should not make much sense, but |
| 3087 // since calling |callback| exactly once is our obligation, we'd better call |
| 3088 // it for not to clutter further more. |
| 3089 params->callback.Run(); |
3086 } | 3090 } |
3087 params->callback.Run(); | |
3088 } | 3091 } |
3089 | 3092 |
3090 void GDataFileSystem::Observe(int type, | 3093 void GDataFileSystem::Observe(int type, |
3091 const content::NotificationSource& source, | 3094 const content::NotificationSource& source, |
3092 const content::NotificationDetails& details) { | 3095 const content::NotificationDetails& details) { |
3093 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 3096 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
3094 | 3097 |
3095 if (type == chrome::NOTIFICATION_PREF_CHANGED) { | 3098 if (type == chrome::NOTIFICATION_PREF_CHANGED) { |
3096 PrefService* pref_service = profile_->GetPrefs(); | 3099 PrefService* pref_service = profile_->GetPrefs(); |
3097 std::string* pref_name = content::Details<std::string>(details).ptr(); | 3100 std::string* pref_name = content::Details<std::string>(details).ptr(); |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3451 return; | 3454 return; |
3452 } | 3455 } |
3453 | 3456 |
3454 PlatformFileInfoProto entry_file_info; | 3457 PlatformFileInfoProto entry_file_info; |
3455 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); | 3458 GDataEntry::ConvertPlatformFileInfoToProto(*file_info, &entry_file_info); |
3456 *entry_proto->mutable_file_info() = entry_file_info; | 3459 *entry_proto->mutable_file_info() = entry_file_info; |
3457 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); | 3460 callback.Run(GDATA_FILE_OK, entry_proto.Pass()); |
3458 } | 3461 } |
3459 | 3462 |
3460 } // namespace gdata | 3463 } // namespace gdata |
OLD | NEW |