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

Side by Side Diff: webrtc/base/proxydetect.cc

Issue 2395593002: Remove deprecated FSRef-manipulation methods. (Closed)
Patch Set: comments from magjed Created 4 years, 2 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
« no previous file with comments | « no previous file | webrtc/base/unixfilesystem.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 /* 1 /*
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/base/proxydetect.h" 11 #include "webrtc/base/proxydetect.h"
12 12
13 #if defined(WEBRTC_WIN) 13 #if defined(WEBRTC_WIN)
14 #include "webrtc/base/win32.h" 14 #include "webrtc/base/win32.h"
15 #include <shlobj.h> 15 #include <shlobj.h>
16 #endif // WEBRTC_WIN 16 #endif // WEBRTC_WIN
17 17
18 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) 18 #if defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
19 #include <SystemConfiguration/SystemConfiguration.h> 19 #include <SystemConfiguration/SystemConfiguration.h>
20 #include <CoreFoundation/CoreFoundation.h> 20 #include <CoreFoundation/CoreFoundation.h>
21 #include <CoreServices/CoreServices.h> 21 #include <CoreServices/CoreServices.h>
22 #include <Security/Security.h> 22 #include <Security/Security.h>
23 #include "macconversion.h" 23 #include "macconversion.h"
24 #include "webrtc/base/unixfilesystem.h"
24 #endif 25 #endif
25 26
26 #ifdef WEBRTC_IOS 27 #ifdef WEBRTC_IOS
27 #include <CFNetwork/CFNetwork.h> 28 #include <CFNetwork/CFNetwork.h>
28 #include "macconversion.h" 29 #include "macconversion.h"
29 #endif 30 #endif
30 31
31 #include <map> 32 #include <map>
32 #include <memory> 33 #include <memory>
33 34
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after
385 wchar_t w_path[MAX_PATH]; 386 wchar_t w_path[MAX_PATH];
386 if (SHGetFolderPath(0, CSIDL_APPDATA, 0, SHGFP_TYPE_CURRENT, w_path) != 387 if (SHGetFolderPath(0, CSIDL_APPDATA, 0, SHGFP_TYPE_CURRENT, w_path) !=
387 S_OK) { 388 S_OK) {
388 LOG(LS_ERROR) << "SHGetFolderPath failed"; 389 LOG(LS_ERROR) << "SHGetFolderPath failed";
389 return false; 390 return false;
390 } 391 }
391 path->SetFolder(ToUtf8(w_path, wcslen(w_path))); 392 path->SetFolder(ToUtf8(w_path, wcslen(w_path)));
392 path->AppendFolder("Mozilla"); 393 path->AppendFolder("Mozilla");
393 path->AppendFolder("Firefox"); 394 path->AppendFolder("Firefox");
394 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS) 395 #elif defined(WEBRTC_MAC) && !defined(WEBRTC_IOS)
395 FSRef fr; 396 rtc::UnixFilesystem filesystem;
396 if (0 != FSFindFolder(kUserDomain, kApplicationSupportFolderType, 397 filesystem.SetApplicationName("Firefox");
397 kCreateFolder, &fr)) { 398 bool result = filesystem.GetAppDataFolder(path, true);
398 LOG(LS_ERROR) << "FSFindFolder failed"; 399 return result;
399 return false;
400 }
401 char buffer[NAME_MAX + 1];
402 if (0 != FSRefMakePath(&fr, reinterpret_cast<uint8_t*>(buffer),
403 arraysize(buffer))) {
404 LOG(LS_ERROR) << "FSRefMakePath failed";
405 return false;
406 }
407 path->SetFolder(std::string(buffer));
408 path->AppendFolder("Firefox");
409 #else 400 #else
410 char* user_home = getenv("HOME"); 401 char* user_home = getenv("HOME");
411 if (user_home == NULL) { 402 if (user_home == NULL) {
412 return false; 403 return false;
413 } 404 }
414 path->SetFolder(std::string(user_home)); 405 path->SetFolder(std::string(user_home));
415 path->AppendFolder(".mozilla"); 406 path->AppendFolder(".mozilla");
416 path->AppendFolder("firefox"); 407 path->AppendFolder("firefox");
417 #endif // WEBRTC_WIN 408 #endif // WEBRTC_WIN
418 return true; 409 return true;
(...skipping 871 matching lines...) Expand 10 before | Expand all | Expand 10 after
1290 if (!result) { 1281 if (!result) {
1291 // Either auto detection is not supported or we simply didn't 1282 // Either auto detection is not supported or we simply didn't
1292 // find any proxy, reset type. 1283 // find any proxy, reset type.
1293 proxy->type = rtc::PROXY_NONE; 1284 proxy->type = rtc::PROXY_NONE;
1294 } 1285 }
1295 } 1286 }
1296 return result; 1287 return result;
1297 } 1288 }
1298 1289
1299 } // namespace rtc 1290 } // namespace rtc
OLDNEW
« no previous file with comments | « no previous file | webrtc/base/unixfilesystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698