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

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/private_api_drive.cc

Issue 127683002: Less dependency for DriveAppRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/file_manager/private_api_drive.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_drive.h"
6 6
7 #include "chrome/browser/chromeos/drive/drive_app_registry.h" 7 #include "chrome/browser/chromeos/drive/drive_app_registry.h"
8 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 8 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
9 #include "chrome/browser/chromeos/drive/logging.h" 9 #include "chrome/browser/chromeos/drive/logging.h"
10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h" 10 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 if (entry.get() && !entry->has_file_specific_info()) { 137 if (entry.get() && !entry->has_file_specific_info()) {
138 CompleteGetFileProperties(error); 138 CompleteGetFileProperties(error);
139 return; 139 return;
140 } 140 }
141 141
142 const drive::FileSpecificInfo& file_specific_info = 142 const drive::FileSpecificInfo& file_specific_info =
143 entry->file_specific_info(); 143 entry->file_specific_info();
144 144
145 // Get drive WebApps that can accept this file. We just need to extract the 145 // Get drive WebApps that can accept this file. We just need to extract the
146 // doc icon for the drive app, which is set as default. 146 // doc icon for the drive app, which is set as default.
147 ScopedVector<drive::DriveAppInfo> drive_apps; 147 std::vector<drive::DriveAppInfo> drive_apps;
148 app_registry->GetAppsForFile(file_path_.Extension(), 148 app_registry->GetAppsForFile(file_path_.Extension(),
149 file_specific_info.content_mime_type(), 149 file_specific_info.content_mime_type(),
150 &drive_apps); 150 &drive_apps);
151 if (!drive_apps.empty()) { 151 if (!drive_apps.empty()) {
152 std::string default_task_id = 152 std::string default_task_id =
153 file_manager::file_tasks::GetDefaultTaskIdFromPrefs( 153 file_manager::file_tasks::GetDefaultTaskIdFromPrefs(
154 *GetProfile()->GetPrefs(), 154 *GetProfile()->GetPrefs(),
155 file_specific_info.content_mime_type(), 155 file_specific_info.content_mime_type(),
156 file_path_.Extension()); 156 file_path_.Extension());
157 file_manager::file_tasks::TaskDescriptor default_task; 157 file_manager::file_tasks::TaskDescriptor default_task;
158 file_manager::file_tasks::ParseTaskID(default_task_id, &default_task); 158 file_manager::file_tasks::ParseTaskID(default_task_id, &default_task);
159 DCHECK(default_task_id.empty() || !default_task.app_id.empty()); 159 DCHECK(default_task_id.empty() || !default_task.app_id.empty());
160 for (size_t i = 0; i < drive_apps.size(); ++i) { 160 for (size_t i = 0; i < drive_apps.size(); ++i) {
161 const drive::DriveAppInfo* app_info = drive_apps[i]; 161 const drive::DriveAppInfo& app_info = drive_apps[i];
162 if (default_task.app_id == app_info->app_id) { 162 if (default_task.app_id == app_info.app_id) {
163 // The drive app is set as default. Files.app should use the doc icon. 163 // The drive app is set as default. Files.app should use the doc icon.
164 const GURL doc_icon = 164 const GURL doc_icon =
165 drive::util::FindPreferredIcon(app_info->document_icons, 165 drive::util::FindPreferredIcon(app_info.document_icons,
166 drive::util::kPreferredIconSize); 166 drive::util::kPreferredIconSize);
167 properties_->custom_icon_url.reset(new std::string(doc_icon.spec())); 167 properties_->custom_icon_url.reset(new std::string(doc_icon.spec()));
168 } 168 }
169 } 169 }
170 } 170 }
171 171
172 file_system->GetCacheEntry( 172 file_system->GetCacheEntry(
173 file_path_, 173 file_path_,
174 base::Bind(&FileBrowserPrivateGetDriveEntryPropertiesFunction:: 174 base::Bind(&FileBrowserPrivateGetDriveEntryPropertiesFunction::
175 CacheStateReceived, this)); 175 CacheStateReceived, this));
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 error_ = "Share Url for this item is not available."; 602 error_ = "Share Url for this item is not available.";
603 SendResponse(false); 603 SendResponse(false);
604 return; 604 return;
605 } 605 }
606 606
607 SetResult(new base::StringValue(share_url.spec())); 607 SetResult(new base::StringValue(share_url.spec()));
608 SendResponse(true); 608 SendResponse(true);
609 } 609 }
610 610
611 } // namespace extensions 611 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/drive/drive_integration_service.cc ('k') | chrome/browser/chromeos/file_manager/file_tasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698