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

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

Issue 7231016: Move app/win/* files to base/win/, ui/base/win and chrome/common/ directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: brettw review Created 9 years, 6 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 | « chrome/chrome_common.gypi ('k') | chrome/common/scoped_co_mem.h » ('j') | 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) 2006-2008 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_internal.h" 5 #include "chrome/common/chrome_paths_internal.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <knownfolders.h> 8 #include <knownfolders.h>
9 #include <shellapi.h> 9 #include <shellapi.h>
10 #include <shlobj.h> 10 #include <shlobj.h>
11 #include <shobjidl.h> 11 #include <shobjidl.h>
12 12
13 #include "app/win/scoped_co_mem.h"
14 #include "base/file_path.h" 13 #include "base/file_path.h"
15 #include "base/path_service.h" 14 #include "base/path_service.h"
16 #include "chrome/common/chrome_constants.h" 15 #include "chrome/common/chrome_constants.h"
16 #include "chrome/common/scoped_co_mem.h"
17 #include "chrome/installer/util/browser_distribution.h" 17 #include "chrome/installer/util/browser_distribution.h"
18 18
19 namespace chrome { 19 namespace chrome {
20 20
21 bool GetDefaultUserDataDirectory(FilePath* result) { 21 bool GetDefaultUserDataDirectory(FilePath* result) {
22 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result)) 22 if (!PathService::Get(base::DIR_LOCAL_APP_DATA, result))
23 return false; 23 return false;
24 BrowserDistribution* dist = BrowserDistribution::GetDistribution(); 24 BrowserDistribution* dist = BrowserDistribution::GetDistribution();
25 *result = result->Append(dist->GetInstallSubDir()); 25 *result = result->Append(dist->GetInstallSubDir());
26 *result = result->Append(chrome::kUserDataDirname); 26 *result = result->Append(chrome::kUserDataDirname);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 // On Vista and higher, use the downloads known folder. Since it can be 66 // On Vista and higher, use the downloads known folder. Since it can be
67 // relocated to point to a "dangerous" folder, callers should validate that the 67 // relocated to point to a "dangerous" folder, callers should validate that the
68 // returned path is not dangerous before using it. 68 // returned path is not dangerous before using it.
69 bool GetUserDownloadsDirectory(FilePath* result) { 69 bool GetUserDownloadsDirectory(FilePath* result) {
70 typedef HRESULT (WINAPI *GetKnownFolderPath)( 70 typedef HRESULT (WINAPI *GetKnownFolderPath)(
71 REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR*); 71 REFKNOWNFOLDERID, DWORD, HANDLE, PWSTR*);
72 GetKnownFolderPath f = reinterpret_cast<GetKnownFolderPath>( 72 GetKnownFolderPath f = reinterpret_cast<GetKnownFolderPath>(
73 GetProcAddress(GetModuleHandle(L"shell32.dll"), "SHGetKnownFolderPath")); 73 GetProcAddress(GetModuleHandle(L"shell32.dll"), "SHGetKnownFolderPath"));
74 app::win::ScopedCoMem<wchar_t> path_buf; 74 chrome::common::ScopedCoMem<wchar_t> path_buf;
75 if (f && SUCCEEDED(f(FOLDERID_Downloads, 0, NULL, &path_buf))) { 75 if (f && SUCCEEDED(f(FOLDERID_Downloads, 0, NULL, &path_buf))) {
76 *result = FilePath(std::wstring(path_buf)); 76 *result = FilePath(std::wstring(path_buf));
77 return true; 77 return true;
78 } 78 }
79 return GetUserDownloadsDirectorySafe(result); 79 return GetUserDownloadsDirectorySafe(result);
80 } 80 }
81 81
82 bool GetUserDesktop(FilePath* result) { 82 bool GetUserDesktop(FilePath* result) {
83 // We need to go compute the value. It would be nice to support paths 83 // We need to go compute the value. It would be nice to support paths
84 // with names longer than MAX_PATH, but the system functions don't seem 84 // with names longer than MAX_PATH, but the system functions don't seem
85 // to be designed for it either, with the exception of GetTempPath 85 // to be designed for it either, with the exception of GetTempPath
86 // (but other things will surely break if the temp path is too long, 86 // (but other things will surely break if the temp path is too long,
87 // so we don't bother handling it. 87 // so we don't bother handling it.
88 wchar_t system_buffer[MAX_PATH]; 88 wchar_t system_buffer[MAX_PATH];
89 system_buffer[0] = 0; 89 system_buffer[0] = 0;
90 if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL, 90 if (FAILED(SHGetFolderPath(NULL, CSIDL_DESKTOPDIRECTORY, NULL,
91 SHGFP_TYPE_CURRENT, system_buffer))) 91 SHGFP_TYPE_CURRENT, system_buffer)))
92 return false; 92 return false;
93 *result = FilePath(system_buffer); 93 *result = FilePath(system_buffer);
94 return true; 94 return true;
95 } 95 }
96 96
97 } // namespace chrome 97 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/chrome_common.gypi ('k') | chrome/common/scoped_co_mem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698