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

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

Issue 12811017: chromeos: Fix inappropriate NULL check in AddDriveMountPoint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 7 years, 9 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_browser_private_api.h" 5 #include "chrome/browser/chromeos/extensions/file_browser_private_api.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 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 const base::FilePath mount_point = drive::util::GetDriveMountPointPath(); 235 const base::FilePath mount_point = drive::util::GetDriveMountPointPath();
236 // Grant R/W permissions to drive 'folder'. File API layer still 236 // Grant R/W permissions to drive 'folder'. File API layer still
237 // expects this to be satisfied. 237 // expects this to be satisfied.
238 GrantFilePermissionsToHost(render_view_host, 238 GrantFilePermissionsToHost(render_view_host,
239 mount_point, 239 mount_point,
240 file_handler_util::GetReadWritePermissions()); 240 file_handler_util::GetReadWritePermissions());
241 241
242 // Grant R/W permission for tmp and pinned cache folder. 242 // Grant R/W permission for tmp and pinned cache folder.
243 drive::DriveSystemService* system_service = 243 drive::DriveSystemService* system_service =
244 drive::DriveSystemServiceFactory::GetForProfile(profile); 244 drive::DriveSystemServiceFactory::GetForProfile(profile);
245 drive::DriveCache* cache = system_service ? system_service->cache() : NULL;
245 // |system_service| is NULL if Drive is disabled. 246 // |system_service| is NULL if Drive is disabled.
246 if (!system_service || !system_service->file_system()) 247 if (!cache)
247 return; 248 return;
248 drive::DriveCache* cache = system_service->cache();
249 249
250 // We check permissions for raw cache file paths only for read-only 250 // We check permissions for raw cache file paths only for read-only
251 // operations (when fileEntry.file() is called), so read only permissions 251 // operations (when fileEntry.file() is called), so read only permissions
252 // should be sufficient for all cache paths. For the rest of supported 252 // should be sufficient for all cache paths. For the rest of supported
253 // operations the file access check is done for drive/ paths. 253 // operations the file access check is done for drive/ paths.
254 GrantFilePermissionsToHost(render_view_host, 254 GrantFilePermissionsToHost(render_view_host,
255 cache->GetCacheDirectoryPath( 255 cache->GetCacheDirectoryPath(
256 drive::DriveCache::CACHE_TYPE_TMP), 256 drive::DriveCache::CACHE_TYPE_TMP),
257 file_handler_util::GetReadOnlyPermissions()); 257 file_handler_util::GetReadOnlyPermissions());
258 GrantFilePermissionsToHost( 258 GrantFilePermissionsToHost(
(...skipping 3078 matching lines...) Expand 10 before | Expand all | Expand 10 after
3337 OpenNewWindowFunction::OpenNewWindowFunction() {} 3337 OpenNewWindowFunction::OpenNewWindowFunction() {}
3338 3338
3339 OpenNewWindowFunction::~OpenNewWindowFunction() {} 3339 OpenNewWindowFunction::~OpenNewWindowFunction() {}
3340 3340
3341 bool OpenNewWindowFunction::RunImpl() { 3341 bool OpenNewWindowFunction::RunImpl() {
3342 std::string url; 3342 std::string url;
3343 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url)); 3343 EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &url));
3344 file_manager_util::OpenNewWindow(profile_, GURL(url)); 3344 file_manager_util::OpenNewWindow(profile_, GURL(url));
3345 return true; 3345 return true;
3346 } 3346 }
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