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

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

Issue 14320015: chromeos: Fix wrong ZipSelectionFunction src_dir check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 (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/extensions/file_manager/file_browser_private_a pi.h" 5 #include "chrome/browser/chromeos/extensions/file_manager/file_browser_private_a pi.h"
6 6
7 #include <sys/stat.h> 7 #include <sys/stat.h>
8 #include <sys/statvfs.h> 8 #include <sys/statvfs.h>
9 #include <sys/types.h> 9 #include <sys/types.h>
10 #include <utime.h> 10 #include <utime.h>
(...skipping 3204 matching lines...) Expand 10 before | Expand all | Expand 10 after
3215 if (path.empty()) 3215 if (path.empty())
3216 return false; 3216 return false;
3217 files.push_back(path); 3217 files.push_back(path);
3218 } 3218 }
3219 3219
3220 // Third param is the name of the output zip file. 3220 // Third param is the name of the output zip file.
3221 std::string dest_name; 3221 std::string dest_name;
3222 if (!args_->GetString(2, &dest_name) || dest_name.empty()) 3222 if (!args_->GetString(2, &dest_name) || dest_name.empty())
3223 return false; 3223 return false;
3224 3224
3225 // Check if the dir path is under Drive cache directory. 3225 // Check if the dir path is under Drive mount point.
3226 // TODO(hshi): support create zip file on Drive (crbug.com/158690). 3226 // TODO(hshi): support create zip file on Drive (crbug.com/158690).
3227 drive::DriveSystemService* system_service = 3227 if (drive::util::IsUnderDriveMountPoint(src_dir))
3228 drive::DriveSystemServiceFactory::GetForProfile(profile_);
3229 drive::DriveCache* cache = system_service ? system_service->cache() : NULL;
3230 if (cache && cache->IsUnderDriveCacheDirectory(src_dir))
3231 return false; 3228 return false;
3232 3229
3233 base::FilePath dest_file = src_dir.Append(dest_name); 3230 base::FilePath dest_file = src_dir.Append(dest_name);
3234 std::vector<base::FilePath> src_relative_paths; 3231 std::vector<base::FilePath> src_relative_paths;
3235 for (size_t i = 0; i != files.size(); ++i) { 3232 for (size_t i = 0; i != files.size(); ++i) {
3236 const base::FilePath& file_path = files[i]; 3233 const base::FilePath& file_path = files[i];
3237 3234
3238 // Obtain the relative path of |file_path| under |src_dir|. 3235 // Obtain the relative path of |file_path| under |src_dir|.
3239 base::FilePath relative_path; 3236 base::FilePath relative_path;
3240 if (!src_dir.AppendRelativePath(file_path, &relative_path)) 3237 if (!src_dir.AppendRelativePath(file_path, &relative_path))
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
3307 OpenNewWindowFunction::OpenNewWindowFunction() {} 3304 OpenNewWindowFunction::OpenNewWindowFunction() {}
3308 3305
3309 OpenNewWindowFunction::~OpenNewWindowFunction() {} 3306 OpenNewWindowFunction::~OpenNewWindowFunction() {}
3310 3307
3311 bool OpenNewWindowFunction::RunImpl() { 3308 bool OpenNewWindowFunction::RunImpl() {
3312 std::string url; 3309 std::string url;
3313 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); 3310 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
3314 file_manager_util::OpenNewWindow(profile_, GURL(url)); 3311 file_manager_util::OpenNewWindow(profile_, GURL(url));
3315 return true; 3312 return true;
3316 } 3313 }
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