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

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

Issue 666693004: Stop fallback for empty local path in ui::SelectedFileInfo's constructor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: git cl format Created 6 years, 2 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
« no previous file with comments | « no previous file | ui/shell_dialogs/select_file_dialog.cc » ('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 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_util.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/private_api_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 for (size_t i = params->selected_files.size(); 112 for (size_t i = params->selected_files.size();
113 i < params->file_paths.size(); ++i) { 113 i < params->file_paths.size(); ++i) {
114 const base::FilePath& file_path = params->file_paths[i]; 114 const base::FilePath& file_path = params->file_paths[i];
115 115
116 if (file_manager::util::IsUnderNonNativeLocalPath(profile, file_path)) { 116 if (file_manager::util::IsUnderNonNativeLocalPath(profile, file_path)) {
117 // When the caller of the select file dialog wants local file paths, and 117 // When the caller of the select file dialog wants local file paths, and
118 // the selected path does not point to a native local path (e.g., Drive, 118 // the selected path does not point to a native local path (e.g., Drive,
119 // MTP, or provided file system), we should resolve the path. 119 // MTP, or provided file system), we should resolve the path.
120 switch (params->local_path_option) { 120 switch (params->local_path_option) {
121 case NO_LOCAL_PATH_RESOLUTION: 121 case NO_LOCAL_PATH_RESOLUTION:
122 break; // No special handling needed. 122 // Pass empty local path.
123 params->selected_files.push_back(
124 ui::SelectedFileInfo(file_path, base::FilePath()));
125 break;
123 case NEED_LOCAL_PATH_FOR_OPENING: 126 case NEED_LOCAL_PATH_FOR_OPENING:
124 GetFileNativeLocalPathForOpening( 127 GetFileNativeLocalPathForOpening(
125 profile, 128 profile,
126 file_path, 129 file_path,
127 base::Bind(&ContinueGetSelectedFileInfo, 130 base::Bind(&ContinueGetSelectedFileInfo,
128 profile, 131 profile,
129 base::Passed(&params))); 132 base::Passed(&params)));
130 return; // Remaining work is done in ContinueGetSelectedFileInfo. 133 return; // Remaining work is done in ContinueGetSelectedFileInfo.
131 case NEED_LOCAL_PATH_FOR_SAVING: 134 case NEED_LOCAL_PATH_FOR_SAVING:
132 GetFileNativeLocalPathForSaving( 135 GetFileNativeLocalPathForSaving(
133 profile, 136 profile,
134 file_path, 137 file_path,
135 base::Bind(&ContinueGetSelectedFileInfo, 138 base::Bind(&ContinueGetSelectedFileInfo,
136 profile, 139 profile,
137 base::Passed(&params))); 140 base::Passed(&params)));
138 return; // Remaining work is done in ContinueGetSelectedFileInfo. 141 return; // Remaining work is done in ContinueGetSelectedFileInfo.
139 } 142 }
143 } else {
144 params->selected_files.push_back(
145 ui::SelectedFileInfo(file_path, file_path));
140 } 146 }
141 params->selected_files.push_back(
142 ui::SelectedFileInfo(file_path, base::FilePath()));
143 } 147 }
144 params->callback.Run(params->selected_files); 148 params->callback.Run(params->selected_files);
145 } 149 }
146 150
147 // Part of GetSelectedFileInfo(). 151 // Part of GetSelectedFileInfo().
148 void ContinueGetSelectedFileInfo(Profile* profile, 152 void ContinueGetSelectedFileInfo(Profile* profile,
149 scoped_ptr<GetSelectedFileInfoParams> params, 153 scoped_ptr<GetSelectedFileInfoParams> params,
150 const base::FilePath& local_path) { 154 const base::FilePath& local_path) {
151 if (local_path.empty()) { 155 if (local_path.empty()) {
152 params->callback.Run(std::vector<ui::SelectedFileInfo>()); 156 params->callback.Run(std::vector<ui::SelectedFileInfo>());
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 } 334 }
331 335
332 drive::EventLogger* GetLogger(Profile* profile) { 336 drive::EventLogger* GetLogger(Profile* profile) {
333 drive::DriveIntegrationService* service = 337 drive::DriveIntegrationService* service =
334 drive::DriveIntegrationServiceFactory::FindForProfile(profile); 338 drive::DriveIntegrationServiceFactory::FindForProfile(profile);
335 return service ? service->event_logger() : NULL; 339 return service ? service->event_logger() : NULL;
336 } 340 }
337 341
338 } // namespace util 342 } // namespace util
339 } // namespace file_manager 343 } // namespace file_manager
OLDNEW
« no previous file with comments | « no previous file | ui/shell_dialogs/select_file_dialog.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698