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

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: 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);
tbarzic 2013/08/12 21:09:49 afaik, ParseTaskID should never fail for non-empty
hshi1 2013/08/12 21:13:41 Done.
146 LOG(WARNING) << "Invalid task ID: " << default_task_id;
147 return;
148 }
149 146
150 ListValue* apps = new ListValue(); 147 ListValue* apps = new ListValue();
151 properties_->Set("driveApps", apps); 148 properties_->Set("driveApps", apps);
152 for (ScopedVector<drive::DriveAppInfo>::const_iterator it = 149 for (ScopedVector<drive::DriveAppInfo>::const_iterator it =
153 drive_apps.begin(); 150 drive_apps.begin();
154 it != drive_apps.end(); ++it) { 151 it != drive_apps.end(); ++it) {
155 const drive::DriveAppInfo* app_info = *it; 152 const drive::DriveAppInfo* app_info = *it;
156 DictionaryValue* app = new DictionaryValue(); 153 DictionaryValue* app = new DictionaryValue();
157 app->SetString("appId", app_info->app_id); 154 app->SetString("appId", app_info->app_id);
158 app->SetString("appName", app_info->app_name); 155 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."; 688 error_ = "Share Url for this item is not available.";
692 SendResponse(false); 689 SendResponse(false);
693 return; 690 return;
694 } 691 }
695 692
696 SetResult(new base::StringValue(share_url.spec())); 693 SetResult(new base::StringValue(share_url.spec()));
697 SendResponse(true); 694 SendResponse(true);
698 } 695 }
699 696
700 } // namespace file_manager 697 } // 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