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

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

Issue 22931003: File manager drive API: handle case where no default task is associated. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Toni's comments. Created 7 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/prefs/pref_service.h" 7 #include "base/prefs/pref_service.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "chrome/browser/chromeos/drive/drive_app_registry.h" 9 #include "chrome/browser/chromeos/drive/drive_app_registry.h"
10 #include "chrome/browser/chromeos/drive/drive_integration_service.h" 10 #include "chrome/browser/chromeos/drive/drive_integration_service.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 // Get drive WebApps that can accept this file. 135 // Get drive WebApps that can accept this file.
136 ScopedVector<drive::DriveAppInfo> drive_apps; 136 ScopedVector<drive::DriveAppInfo> drive_apps;
137 integration_service->drive_app_registry()->GetAppsForFile( 137 integration_service->drive_app_registry()->GetAppsForFile(
138 file_path_, file_specific_info.content_mime_type(), &drive_apps); 138 file_path_, file_specific_info.content_mime_type(), &drive_apps);
139 if (!drive_apps.empty()) { 139 if (!drive_apps.empty()) {
140 std::string default_task_id = file_tasks::GetDefaultTaskIdFromPrefs( 140 std::string default_task_id = file_tasks::GetDefaultTaskIdFromPrefs(
141 profile_, 141 profile_,
142 file_specific_info.content_mime_type(), 142 file_specific_info.content_mime_type(),
143 file_path_.Extension()); 143 file_path_.Extension());
144 file_tasks::TaskDescriptor default_task; 144 file_tasks::TaskDescriptor default_task;
145 if (!file_tasks::ParseTaskID(default_task_id, &default_task)) { 145 file_tasks::ParseTaskID(default_task_id, &default_task);
146 LOG(WARNING) << "Invalid task ID: " << default_task_id; 146 DCHECK(default_task_id.empty() || !default_task.app_id.empty());
147 return;
148 }
149 147
150 ListValue* apps = new ListValue(); 148 ListValue* apps = new ListValue();
151 properties_->Set("driveApps", apps); 149 properties_->Set("driveApps", apps);
152 for (ScopedVector<drive::DriveAppInfo>::const_iterator it = 150 for (ScopedVector<drive::DriveAppInfo>::const_iterator it =
153 drive_apps.begin(); 151 drive_apps.begin();
154 it != drive_apps.end(); ++it) { 152 it != drive_apps.end(); ++it) {
155 const drive::DriveAppInfo* app_info = *it; 153 const drive::DriveAppInfo* app_info = *it;
156 DictionaryValue* app = new DictionaryValue(); 154 DictionaryValue* app = new DictionaryValue();
157 app->SetString("appId", app_info->app_id); 155 app->SetString("appId", app_info->app_id);
158 app->SetString("appName", app_info->app_name); 156 app->SetString("appName", app_info->app_name);
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 error_ = "Share Url for this item is not available."; 689 error_ = "Share Url for this item is not available.";
692 SendResponse(false); 690 SendResponse(false);
693 return; 691 return;
694 } 692 }
695 693
696 SetResult(new base::StringValue(share_url.spec())); 694 SetResult(new base::StringValue(share_url.spec()));
697 SendResponse(true); 695 SendResponse(true);
698 } 696 }
699 697
700 } // namespace file_manager 698 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698