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/ui/webui/feedback_ui.h" | 5 #include "chrome/browser/ui/webui/feedback_ui.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 | 116 |
117 bool ScreenshotGDataTimestampComp(const gdata::DriveEntryProto& entry1, | 117 bool ScreenshotGDataTimestampComp(const gdata::DriveEntryProto& entry1, |
118 const gdata::DriveEntryProto& entry2) { | 118 const gdata::DriveEntryProto& entry2) { |
119 return entry1.file_info().last_modified() > | 119 return entry1.file_info().last_modified() > |
120 entry2.file_info().last_modified(); | 120 entry2.file_info().last_modified(); |
121 } | 121 } |
122 | 122 |
123 void ReadDirectoryCallback(size_t max_saved, | 123 void ReadDirectoryCallback(size_t max_saved, |
124 std::vector<std::string>* saved_screenshots, | 124 std::vector<std::string>* saved_screenshots, |
125 base::Closure callback, | 125 base::Closure callback, |
126 gdata::GDataFileError error, | 126 gdata::DriveFileError error, |
127 bool hide_hosted_documents, | 127 bool hide_hosted_documents, |
128 scoped_ptr<gdata::DriveEntryProtoVector> entries) { | 128 scoped_ptr<gdata::DriveEntryProtoVector> entries) { |
129 if (error != gdata::GDATA_FILE_OK) { | 129 if (error != gdata::DRIVE_FILE_OK) { |
130 callback.Run(); | 130 callback.Run(); |
131 return; | 131 return; |
132 } | 132 } |
133 | 133 |
134 size_t max_scan = std::min(kMaxNumScanFiles, entries->size()); | 134 size_t max_scan = std::min(kMaxNumScanFiles, entries->size()); |
135 std::vector<gdata::DriveEntryProto> screenshot_entries; | 135 std::vector<gdata::DriveEntryProto> screenshot_entries; |
136 for (size_t i = 0; i < max_scan; ++i) { | 136 for (size_t i = 0; i < max_scan; ++i) { |
137 const gdata::DriveEntryProto& entry = (*entries)[i]; | 137 const gdata::DriveEntryProto& entry = (*entries)[i]; |
138 if (StartsWithASCII(entry.base_name(), kScreenshotPrefix, true) && | 138 if (StartsWithASCII(entry.base_name(), kScreenshotPrefix, true) && |
139 EndsWith(entry.base_name(), kScreenshotSuffix, true)) { | 139 EndsWith(entry.base_name(), kScreenshotSuffix, true)) { |
(...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
747 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); | 747 size_t sort_size = std::min(max_saved, screenshot_filepaths.size()); |
748 std::partial_sort(screenshot_filepaths.begin(), | 748 std::partial_sort(screenshot_filepaths.begin(), |
749 screenshot_filepaths.begin() + sort_size, | 749 screenshot_filepaths.begin() + sort_size, |
750 screenshot_filepaths.end(), | 750 screenshot_filepaths.end(), |
751 ScreenshotTimestampComp); | 751 ScreenshotTimestampComp); |
752 for (size_t i = 0; i < sort_size; ++i) | 752 for (size_t i = 0; i < sort_size; ++i) |
753 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + | 753 saved_screenshots->push_back(std::string(kSavedScreenshotsUrl) + |
754 screenshot_filepaths[i]); | 754 screenshot_filepaths[i]); |
755 } | 755 } |
756 #endif | 756 #endif |
OLD | NEW |