Skip to content

Commit

Permalink
remove DIR_LOCAL_APP_DATA_LOW from base.
Browse files Browse the repository at this point in the history
Not used except for cloud print.

BUG=426573
TBR=rvargas

Review URL: https://codereview.chromium.org/681533002

Cr-Commit-Position: refs/heads/master@{#301473}
  • Loading branch information
cpu-chromium authored and Commit bot committed Oct 27, 2014
1 parent 7e150a9 commit 1b29da2
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 29 deletions.
10 changes: 0 additions & 10 deletions base/base_paths_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,16 +95,6 @@ bool PathProviderWin(int key, FilePath* result) {
return false;
cur = FilePath(system_buffer);
break;
case base::DIR_LOCAL_APP_DATA_LOW:
if (win::GetVersion() < win::VERSION_VISTA)
return false;

// TODO(nsylvain): We should use SHGetKnownFolderPath instead. Bug 1281128
if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT,
system_buffer)))
return false;
cur = FilePath(system_buffer).DirName().AppendASCII("LocalLow");
break;
case base::DIR_LOCAL_APP_DATA:
if (FAILED(SHGetFolderPath(NULL, CSIDL_LOCAL_APPDATA, NULL,
SHGFP_TYPE_CURRENT, system_buffer)))
Expand Down
1 change: 0 additions & 1 deletion base/base_paths_win.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ enum {
DIR_START_MENU, // Usually "C:\Documents and Settings\<user>\
// Start Menu\Programs"
DIR_APP_DATA, // Application Data directory under the user profile.
DIR_LOCAL_APP_DATA_LOW, // Local AppData directory for low integrity level.
DIR_LOCAL_APP_DATA, // "Local Settings\Application Data" directory under
// the user profile.
DIR_COMMON_APP_DATA, // W2K, XP, W2K3: "C:\Documents and Settings\
Expand Down
14 changes: 2 additions & 12 deletions base/path_service_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,8 @@ TEST_F(PathServiceTest, Get) {
#if defined(OS_WIN)
for (int key = base::PATH_WIN_START + 1; key < base::PATH_WIN_END; ++key) {
bool valid = true;
switch(key) {
case base::DIR_LOCAL_APP_DATA_LOW:
// DIR_LOCAL_APP_DATA_LOW is not supported prior Vista and is expected
// to fail.
valid = base::win::GetVersion() >= base::win::VERSION_VISTA;
break;
case base::DIR_APP_SHORTCUTS:
// DIR_APP_SHORTCUTS is not supported prior Windows 8 and is expected to
// fail.
valid = base::win::GetVersion() >= base::win::VERSION_WIN8;
break;
}
if (key == base::DIR_APP_SHORTCUTS)
valid = base::win::GetVersion() >= base::win::VERSION_WIN8;

if (valid)
EXPECT_TRUE(ReturnsValidPath(key)) << key;
Expand Down
20 changes: 14 additions & 6 deletions cloud_print/virtual_driver/win/port_monitor/port_monitor.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,22 @@ MONITOR2 g_monitor_2 = {
Monitor2Shutdown
};

base::FilePath GetLocalAppDataLow() {
wchar_t system_buffer[MAX_PATH];
if (FAILED(SHGetFolderPath(NULL, CSIDL_APPDATA, NULL, SHGFP_TYPE_CURRENT,
system_buffer)))
return base::FilePath();
return base::FilePath(system_buffer).DirName().AppendASCII("LocalLow");
}

base::FilePath GetAppDataDir() {
base::FilePath file_path;
base::win::Version version = base::win::GetVersion();
int path_id = (version >= base::win::VERSION_VISTA) ?
base::DIR_LOCAL_APP_DATA_LOW : base::DIR_LOCAL_APP_DATA;
if (!PathService::Get(path_id, &file_path)) {
LOG(ERROR) << "Can't get DIR_LOCAL_APP_DATA";
return base::FilePath();
if (base::win::GetVersion() >= base::win::VERSION_VISTA)
file_path = GetLocalAppDataLow();
else
PathService::Get(base::DIR_LOCAL_APP_DATA, &file_path);
if (file_path.empty()) {
LOG(ERROR) << "Can't get app data dir";
}
return file_path.Append(kAppDataDir);
}
Expand Down

0 comments on commit 1b29da2

Please sign in to comment.