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

Side by Side Diff: chrome/browser/win/browser_util.cc

Issue 2098713003: Moved a bunch of win-specific files to the new win folder in chrome/browser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 5 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 | « chrome/browser/win/browser_util.h ('k') | chrome/browser/win/chrome_elf_init.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) 2011 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/browser/browser_util_win.h" 5 #include "chrome/browser/win/browser_util.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
11 11
12 #include "base/base_paths.h" 12 #include "base/base_paths.h"
13 #include "base/files/file_path.h" 13 #include "base/files/file_path.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 15
16 namespace browser_util { 16 namespace browser_util {
17 17
18 bool IsBrowserAlreadyRunning() { 18 bool IsBrowserAlreadyRunning() {
19 static HANDLE handle = NULL; 19 static HANDLE handle = NULL;
20 base::FilePath exe_path; 20 base::FilePath exe_path;
21 PathService::Get(base::FILE_EXE, &exe_path); 21 PathService::Get(base::FILE_EXE, &exe_path);
22 std::wstring exe = exe_path.value(); 22 std::wstring exe = exe_path.value();
23 std::replace(exe.begin(), exe.end(), '\\', '!'); 23 std::replace(exe.begin(), exe.end(), '\\', '!');
24 std::transform(exe.begin(), exe.end(), exe.begin(), tolower); 24 std::transform(exe.begin(), exe.end(), exe.begin(), tolower);
25 exe = L"Global\\" + exe; 25 exe = L"Global\\" + exe;
26 if (handle != NULL) 26 if (handle != NULL)
27 CloseHandle(handle); 27 CloseHandle(handle);
28 handle = CreateEvent(NULL, TRUE, TRUE, exe.c_str()); 28 handle = CreateEvent(NULL, TRUE, TRUE, exe.c_str());
29 int error = GetLastError(); 29 int error = GetLastError();
30 return (error == ERROR_ALREADY_EXISTS || error == ERROR_ACCESS_DENIED); 30 return (error == ERROR_ALREADY_EXISTS || error == ERROR_ACCESS_DENIED);
31 } 31 }
32 32
33 } // namespace browser_util 33 } // namespace browser_util
OLDNEW
« no previous file with comments | « chrome/browser/win/browser_util.h ('k') | chrome/browser/win/chrome_elf_init.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698