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

Side by Side Diff: chrome/browser/ui/webui/feedback_ui.cc

Issue 10836354: Rename GData* to Drive* in gdata.proto (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for comments. Created 8 years, 4 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
« no previous file with comments | « chrome/browser/ui/webui/chromeos/drive_internals_ui.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "grit/locale_settings.h" 52 #include "grit/locale_settings.h"
53 #include "net/base/escape.h" 53 #include "net/base/escape.h"
54 #include "ui/base/resource/resource_bundle.h" 54 #include "ui/base/resource/resource_bundle.h"
55 55
56 #if defined(OS_CHROMEOS) 56 #if defined(OS_CHROMEOS)
57 #include "ash/shell.h" 57 #include "ash/shell.h"
58 #include "ash/shell_delegate.h" 58 #include "ash/shell_delegate.h"
59 #include "base/file_util.h" 59 #include "base/file_util.h"
60 #include "base/path_service.h" 60 #include "base/path_service.h"
61 #include "chrome/browser/chromeos/cros/cros_library.h" 61 #include "chrome/browser/chromeos/cros/cros_library.h"
62 #include "chrome/browser/chromeos/gdata/drive.pb.h"
62 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h" 63 #include "chrome/browser/chromeos/gdata/gdata_file_system_interface.h"
63 #include "chrome/browser/chromeos/gdata/gdata.pb.h"
64 #include "chrome/browser/chromeos/gdata/gdata_system_service.h" 64 #include "chrome/browser/chromeos/gdata/gdata_system_service.h"
65 #include "chrome/browser/chromeos/gdata/gdata_util.h" 65 #include "chrome/browser/chromeos/gdata/gdata_util.h"
66 #include "chrome/browser/chromeos/login/user_manager.h" 66 #include "chrome/browser/chromeos/login/user_manager.h"
67 #include "chrome/browser/chromeos/system/syslogs_provider.h" 67 #include "chrome/browser/chromeos/system/syslogs_provider.h"
68 #include "ui/aura/root_window.h" 68 #include "ui/aura/root_window.h"
69 #include "ui/aura/window.h" 69 #include "ui/aura/window.h"
70 #endif 70 #endif
71 71
72 using content::BrowserThread; 72 using content::BrowserThread;
73 using content::WebContents; 73 using content::WebContents;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 } 107 }
108 108
109 std::string GetUserEmail() { 109 std::string GetUserEmail() {
110 chromeos::UserManager* manager = chromeos::UserManager::Get(); 110 chromeos::UserManager* manager = chromeos::UserManager::Get();
111 if (!manager) 111 if (!manager)
112 return std::string(); 112 return std::string();
113 else 113 else
114 return manager->GetLoggedInUser().display_email(); 114 return manager->GetLoggedInUser().display_email();
115 } 115 }
116 116
117 bool ScreenshotGDataTimestampComp(const gdata::GDataEntryProto& entry1, 117 bool ScreenshotGDataTimestampComp(const gdata::DriveEntryProto& entry1,
118 const gdata::GDataEntryProto& 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::GDataFileError error,
127 bool hide_hosted_documents, 127 bool hide_hosted_documents,
128 scoped_ptr<gdata::GDataEntryProtoVector> entries) { 128 scoped_ptr<gdata::DriveEntryProtoVector> entries) {
129 if (error != gdata::GDATA_FILE_OK) { 129 if (error != gdata::GDATA_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::GDataEntryProto> 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::GDataEntryProto& 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)) {
140 screenshot_entries.push_back(entry); 140 screenshot_entries.push_back(entry);
141 } 141 }
142 } 142 }
143 143
144 size_t sort_size = std::min(max_saved, screenshot_entries.size()); 144 size_t sort_size = std::min(max_saved, screenshot_entries.size());
145 std::partial_sort(screenshot_entries.begin(), 145 std::partial_sort(screenshot_entries.begin(),
146 screenshot_entries.begin() + sort_size, 146 screenshot_entries.begin() + sort_size,
147 screenshot_entries.end(), 147 screenshot_entries.end(),
148 ScreenshotGDataTimestampComp); 148 ScreenshotGDataTimestampComp);
149 for (size_t i = 0; i < sort_size; ++i) { 149 for (size_t i = 0; i < sort_size; ++i) {
150 const gdata::GDataEntryProto& entry = screenshot_entries[i]; 150 const gdata::DriveEntryProto& entry = screenshot_entries[i];
151 saved_screenshots->push_back( 151 saved_screenshots->push_back(
152 std::string(kSavedScreenshotsUrl) + entry.resource_id()); 152 std::string(kSavedScreenshotsUrl) + entry.resource_id());
153 } 153 }
154 callback.Run(); 154 callback.Run();
155 } 155 }
156 156
157 #else 157 #else
158 158
159 std::string GetUserEmail() { 159 std::string GetUserEmail() {
160 Profile* profile = ProfileManager::GetLastUsedProfile(); 160 Profile* profile = ProfileManager::GetLastUsedProfile();
(...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/drive_internals_ui.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698