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

Side by Side Diff: chrome/common/chrome_paths.cc

Issue 7718021: Add external extensions json source in proper mac location. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use IsParent() Created 9 years, 3 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
« base/file_util_unittest.cc ('K') | « chrome/common/chrome_paths.h ('k') | 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/chrome_paths.h" 5 #include "chrome/common/chrome_paths.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/path_service.h" 10 #include "base/path_service.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 #if defined(OS_CHROMEOS) 320 #if defined(OS_CHROMEOS)
321 case chrome::DIR_USER_EXTERNAL_EXTENSIONS: { 321 case chrome::DIR_USER_EXTERNAL_EXTENSIONS: {
322 if (!PathService::Get(chrome::DIR_USER_DATA, &cur)) 322 if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
323 return false; 323 return false;
324 cur = cur.Append(FILE_PATH_LITERAL("External Extensions")); 324 cur = cur.Append(FILE_PATH_LITERAL("External Extensions"));
325 break; 325 break;
326 } 326 }
327 #endif 327 #endif
328 case chrome::DIR_EXTERNAL_EXTENSIONS: 328 case chrome::DIR_EXTERNAL_EXTENSIONS:
329 #if defined(OS_MACOSX) 329 #if defined(OS_MACOSX)
330 if (!PathService::Get(base::DIR_EXE, &cur)) 330 cur = FilePath(
331 return false; 331 FILE_PATH_LITERAL("/Library/Application Support/Google/Chrome"));
TVL 2011/08/30 15:32:40 This should probably use base::mac::GetLocalDirect
Sam Kerner (Chrome) 2011/09/16 18:12:59 Done.
332 332 cur = cur.Append("External Extensions");
333 // On Mac, built-in extensions are in Contents/Extensions, a sibling of
334 // the App dir. If there are none, it may not exist.
335 // TODO(skerner): Reading external extensions from a file inside the
336 // app budle causes several problems. Change this path to be outside
337 // the app bundle. crbug/67203
338 cur = cur.DirName();
339 cur = cur.Append(FILE_PATH_LITERAL("Extensions"));
340 create_dir = false; 333 create_dir = false;
341 #else 334 #else
342 if (!PathService::Get(base::DIR_MODULE, &cur)) 335 if (!PathService::Get(base::DIR_MODULE, &cur))
343 return false; 336 return false;
344 337
345 cur = cur.Append(FILE_PATH_LITERAL("extensions")); 338 cur = cur.Append(FILE_PATH_LITERAL("extensions"));
346 create_dir = true; 339 create_dir = true;
347 #endif 340 #endif
348 break; 341 break;
342
343 #if defined(OS_MACOSX)
344 case DIR_DEPRICATED_EXTERNAL_EXTENSIONS:
345 // TODO(skerner): Reading external extensions from a file inside the
346 // app budle causes several problems. Once users have a chance to
347 // migrate, remove this path. crbug/67203
348 if (!PathService::Get(base::DIR_EXE, &cur))
349 return false;
350
351 cur = cur.DirName();
352 cur = cur.Append(FILE_PATH_LITERAL("Extensions"));
353 create_dir = false;
354
355 break;
356 #endif
357
349 default: 358 default:
350 return false; 359 return false;
351 } 360 }
352 361
353 if (create_dir && !file_util::PathExists(cur) && 362 if (create_dir && !file_util::PathExists(cur) &&
354 !file_util::CreateDirectory(cur)) 363 !file_util::CreateDirectory(cur))
355 return false; 364 return false;
356 365
357 *result = cur; 366 *result = cur;
358 return true; 367 return true;
359 } 368 }
360 369
361 // This cannot be done as a static initializer sadly since Visual Studio will 370 // This cannot be done as a static initializer sadly since Visual Studio will
362 // eliminate this object file if there is no direct entry point into it. 371 // eliminate this object file if there is no direct entry point into it.
363 void RegisterPathProvider() { 372 void RegisterPathProvider() {
364 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END); 373 PathService::RegisterProvider(PathProvider, PATH_START, PATH_END);
365 } 374 }
366 375
367 } // namespace chrome 376 } // namespace chrome
OLDNEW
« base/file_util_unittest.cc ('K') | « chrome/common/chrome_paths.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698