Revert 67201 - Revert 67191 - chrome_paths: refactor and sanitize cache directory handling

[Checking to see if this build failures on Windows.] [[Nope. Failure was a
flake.]]

Previously we had a bunch of logic in profile_impl.cc that computed
where the cache directory lives.  This change relocates it to
chrome_paths.cc.

Some background on cache directories.
There are two possible places to store cache files:
1) in the user data directory
2) in an OS-specific user cache directory

On Windows, we always pick (1).  On Mac and Linux, we currently use
(2) in some circumstances.  This patch changes both Mac and Linux to
have the same behavior with respect to (2).

The Mac/Linux shared behavior is that if the profile directory
is in the standard location for profiles, we put the cache files
into a matching directory name in the standard system cache directory
(e.g. on Linux if you're using ~/.config/google-chrome, your cache
ends up in ~/.cache/google-chrome; on Mac, the directories are
~/Library/Application Support versus ~/Library/Caches).  If your user
data directory is not in the standard location, we use behavior (1).

The semantic changes of this patch should be:
- On Mac, previously we checked whether the (2) directory had some
  particular subdirectories already when picking which one to use.
  This was removed; which directory is used is solely a question of
  whether the profile directory is in the standard location.
  I think the previous behavior was unpredictable.
- On Linux, previously we only used behavior (2) if you hadn't changed
  your user-data-directory at all.  Now, to match Mac, as long as
  your user-data-dir is in the standard place, you use the system
  cache dir.  So e.g. using ~/.config/foobar puts your cache in
  ~/.cache/foobar.
- On Linux, previously the default cache would end up as directories
  under ~/.cache/google-chrome/; now it ends up as directories under
  ~/.cache/google-chrome/Default/.

(In all instances above, on Linux we continue to obey $XDG_CACHE_HOME.)

BUG=59824
TEST=New test ChromePaths.UserCacheDir

Review URL: http://codereview.chromium.org/5123004

TBR=evan@chromium.org
Review URL: http://codereview.chromium.org/5344003

TBR=viettrungluu@chromium.org

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@67202 0039d316-1c4b-4281-b951-d872f2087c98


CrOS-Libchrome-Original-Commit: b411da300f6a750553c2d4e30150a83a2be4895a
5 files changed
tree: a811955c04c10b40384fa2027a7597ae964c7a0c
  1. base/
  2. build/
  3. ipc/
  4. testing/