diff options
author | cpu <cpu@chromium.org> | 2014-10-27 16:14:05 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-27 23:14:50 +0000 |
commit | 1b29da2e5a43c42752b8bf489880a82eaf04b930 (patch) | |
tree | 15e770f027b30be98da17c794b1ff8892ff87440 | |
parent | 7e150a9045108133f5515342f1da6fcc3c23eff8 (diff) | |
download | chromium_src-1b29da2e5a43c42752b8bf489880a82eaf04b930.zip chromium_src-1b29da2e5a43c42752b8bf489880a82eaf04b930.tar.gz chromium_src-1b29da2e5a43c42752b8bf489880a82eaf04b930.tar.bz2 |
remove DIR_LOCAL_APP_DATA_LOW from base.
Not used except for cloud print.
BUG=426573
TBR=rvargas
Review URL: https://codereview.chromium.org/681533002
Cr-Commit-Position: refs/heads/master@{#301473}
-rw-r--r-- | base/base_paths_win.cc | 10 | ||||
-rw-r--r-- | base/base_paths_win.h | 1 | ||||
-rw-r--r-- | base/path_service_unittest.cc | 14 | ||||
-rw-r--r-- | cloud_print/virtual_driver/win/port_monitor/port_monitor.cc | 20 |
4 files changed, 16 insertions, 29 deletions
diff --git a/base/base_paths_win.cc b/base/base_paths_win.cc index a9b31c7b..5bef310 100644 --- a/base/base_paths_win.cc +++ b/base/base_paths_win.cc @@ -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))) diff --git a/base/base_paths_win.h b/base/base_paths_win.h index 4620171..032de34 100644 --- a/base/base_paths_win.h +++ b/base/base_paths_win.h @@ -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\ diff --git a/base/path_service_unittest.cc b/base/path_service_unittest.cc index c6cc0e6..543deb6 100644 --- a/base/path_service_unittest.cc +++ b/base/path_service_unittest.cc @@ -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; diff --git a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc index 26f7b3f..28c4a3b 100644 --- a/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc +++ b/cloud_print/virtual_driver/win/port_monitor/port_monitor.cc @@ -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); } |