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

Side by Side Diff: chrome/browser/chromeos/drive/drive_app_registry.cc

Issue 23503008: file_manager: Add DriveAppRegistry::UpdateFromAppList() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
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/chromeos/drive/drive_app_registry.h" 5 #include "chrome/browser/chromeos/drive/drive_app_registry.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 DCHECK(is_updating_); 155 DCHECK(is_updating_);
156 is_updating_ = false; 156 is_updating_ = false;
157 157
158 FileError error = GDataToFileError(gdata_error); 158 FileError error = GDataToFileError(gdata_error);
159 if (error != FILE_ERROR_OK) { 159 if (error != FILE_ERROR_OK) {
160 // Failed to fetch the data from the server. We can do nothing here. 160 // Failed to fetch the data from the server. We can do nothing here.
161 return; 161 return;
162 } 162 }
163 163
164 DCHECK(app_list); 164 DCHECK(app_list);
165 UpdateFromAppList(*app_list);
166 }
165 167
168 void DriveAppRegistry::UpdateFromAppList(
169 const google_apis::AppList& app_list) {
166 url_to_name_map_.clear(); 170 url_to_name_map_.clear();
167 STLDeleteValues(&app_extension_map_); 171 STLDeleteValues(&app_extension_map_);
168 STLDeleteValues(&app_mimetypes_map_); 172 STLDeleteValues(&app_mimetypes_map_);
169 for (size_t i = 0; i < app_list->items().size(); ++i) { 173 for (size_t i = 0; i < app_list.items().size(); ++i) {
170 const google_apis::AppResource& app = *app_list->items()[i]; 174 const google_apis::AppResource& app = *app_list.items()[i];
171 if (app.product_url().is_empty()) 175 if (app.product_url().is_empty())
172 continue; 176 continue;
173 177
174 google_apis::InstalledApp::IconList app_icons; 178 google_apis::InstalledApp::IconList app_icons;
175 google_apis::InstalledApp::IconList document_icons; 179 google_apis::InstalledApp::IconList document_icons;
176 for (size_t j = 0; j < app.icons().size(); ++j) { 180 for (size_t j = 0; j < app.icons().size(); ++j) {
177 const google_apis::DriveAppIcon& icon = *app.icons()[j]; 181 const google_apis::DriveAppIcon& icon = *app.icons()[j];
178 if (icon.icon_url().is_empty()) 182 if (icon.icon_url().is_empty())
179 continue; 183 continue;
180 if (icon.category() == google_apis::DriveAppIcon::APPLICATION) 184 if (icon.category() == google_apis::DriveAppIcon::APPLICATION)
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 for (google_apis::InstalledApp::IconList::const_reverse_iterator 298 for (google_apis::InstalledApp::IconList::const_reverse_iterator
295 iter = sorted_icons.rbegin(); 299 iter = sorted_icons.rbegin();
296 iter != sorted_icons.rend() && iter->first >= preferred_size; ++iter) { 300 iter != sorted_icons.rend() && iter->first >= preferred_size; ++iter) {
297 result = iter->second; 301 result = iter->second;
298 } 302 }
299 return result; 303 return result;
300 } 304 }
301 305
302 } // namespace util 306 } // namespace util
303 } // namespace drive 307 } // namespace drive
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_app_registry.h ('k') | chrome/browser/chromeos/drive/drive_app_registry_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698