diff options
57 files changed, 269 insertions, 245 deletions
diff --git a/app/win/win_util.cc b/app/win/win_util.cc index 116b89f..7076a5f 100644 --- a/app/win/win_util.cc +++ b/app/win/win_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,7 +17,6 @@ #include "base/i18n/rtl.h" #include "base/logging.h" #include "base/scoped_handle.h" -#include "base/scoped_handle_win.h" #include "base/string_util.h" #include "base/win/scoped_gdi_object.h" #include "base/win/scoped_hdc.h" diff --git a/base/file_util_unittest.cc b/base/file_util_unittest.cc index bbd888a..6ea94e4 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -19,7 +19,6 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" -#include "base/scoped_handle.h" #include "base/scoped_temp_dir.h" #include "base/threading/platform_thread.h" #include "base/time.h" @@ -27,6 +26,10 @@ #include "testing/gtest/include/gtest/gtest.h" #include "testing/platform_test.h" +#if defined(OS_WIN) +#include "base/win/scoped_handle.h" +#endif + // This macro helps avoid wrapped lines in the test structs. #define FPL(x) FILE_PATH_LITERAL(x) @@ -471,7 +474,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) { FilePath to_sub_a = base_b.Append(FPL("to_sub_a")); ASSERT_TRUE(file_util::CreateDirectory(to_sub_a)); - ScopedHandle reparse_to_sub_a( + base::win::ScopedHandle reparse_to_sub_a( ::CreateFile(to_sub_a.value().c_str(), FILE_ALL_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -484,7 +487,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) { FilePath to_base_b = base_b.Append(FPL("to_base_b")); ASSERT_TRUE(file_util::CreateDirectory(to_base_b)); - ScopedHandle reparse_to_base_b( + base::win::ScopedHandle reparse_to_base_b( ::CreateFile(to_base_b.value().c_str(), FILE_ALL_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -497,7 +500,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) { FilePath to_sub_long = base_b.Append(FPL("to_sub_long")); ASSERT_TRUE(file_util::CreateDirectory(to_sub_long)); - ScopedHandle reparse_to_sub_long( + base::win::ScopedHandle reparse_to_sub_long( ::CreateFile(to_sub_long.value().c_str(), FILE_ALL_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc index e926c57..c471e38 100644 --- a/base/message_loop_unittest.cc +++ b/base/message_loop_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,7 +15,7 @@ #if defined(OS_WIN) #include "base/message_pump_win.h" -#include "base/scoped_handle.h" +#include "base/win/scoped_handle.h" #endif #if defined(OS_POSIX) #include "base/message_pump_libevent.h" @@ -937,7 +937,7 @@ void RunTest_RecursiveDenial2(MessageLoop::Type message_loop_type) { options.message_loop_type = message_loop_type; ASSERT_EQ(true, worker.StartWithOptions(options)); TaskList order; - ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL)); + base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL)); worker.message_loop()->PostTask(FROM_HERE, new Recursive2Tasks(MessageLoop::current(), event, @@ -980,7 +980,7 @@ void RunTest_RecursiveSupport2(MessageLoop::Type message_loop_type) { options.message_loop_type = message_loop_type; ASSERT_EQ(true, worker.StartWithOptions(options)); TaskList order; - ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL)); + base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL)); worker.message_loop()->PostTask(FROM_HERE, new Recursive2Tasks(MessageLoop::current(), event, @@ -1187,7 +1187,7 @@ class TestIOHandler : public MessageLoopForIO::IOHandler { char buffer_[48]; MessageLoopForIO::IOContext context_; HANDLE signal_; - ScopedHandle file_; + base::win::ScopedHandle file_; bool wait_; }; @@ -1235,12 +1235,12 @@ class IOHandlerTask : public Task { }; void RunTest_IOHandler() { - ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL)); + base::win::ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL)); ASSERT_TRUE(callback_called.IsValid()); const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe"; - ScopedHandle server(CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, - 0, 0, 0, NULL)); + base::win::ScopedHandle server( + CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL)); ASSERT_TRUE(server.IsValid()); Thread thread("IOHandler test"); @@ -1267,17 +1267,19 @@ void RunTest_IOHandler() { } void RunTest_WaitForIO() { - ScopedHandle callback1_called(CreateEvent(NULL, TRUE, FALSE, NULL)); - ScopedHandle callback2_called(CreateEvent(NULL, TRUE, FALSE, NULL)); + base::win::ScopedHandle callback1_called( + CreateEvent(NULL, TRUE, FALSE, NULL)); + base::win::ScopedHandle callback2_called( + CreateEvent(NULL, TRUE, FALSE, NULL)); ASSERT_TRUE(callback1_called.IsValid()); ASSERT_TRUE(callback2_called.IsValid()); const wchar_t* kPipeName1 = L"\\\\.\\pipe\\iohandler_pipe1"; const wchar_t* kPipeName2 = L"\\\\.\\pipe\\iohandler_pipe2"; - ScopedHandle server1(CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1, - 0, 0, 0, NULL)); - ScopedHandle server2(CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1, - 0, 0, 0, NULL)); + base::win::ScopedHandle server1( + CreateNamedPipe(kPipeName1, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL)); + base::win::ScopedHandle server2( + CreateNamedPipe(kPipeName2, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL)); ASSERT_TRUE(server1.IsValid()); ASSERT_TRUE(server2.IsValid()); diff --git a/base/message_pump_win.h b/base/message_pump_win.h index ea7dd39..af97530 100644 --- a/base/message_pump_win.h +++ b/base/message_pump_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,8 +13,8 @@ #include "base/basictypes.h" #include "base/message_pump.h" #include "base/observer_list.h" -#include "base/scoped_handle.h" #include "base/time.h" +#include "base/win/scoped_handle.h" namespace base { @@ -356,7 +356,7 @@ class MessagePumpForIO : public MessagePumpWin { void DidProcessIOEvent(); // The completion port associated with this thread. - ScopedHandle port_; + win::ScopedHandle port_; // This list will be empty almost always. It stores IO completions that have // not been delivered yet because somebody was doing cleanup. std::list<IOItem> completed_io_; diff --git a/base/scoped_handle.h b/base/scoped_handle.h index 43ee975..90cb5d5 100644 --- a/base/scoped_handle.h +++ b/base/scoped_handle.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,10 +10,6 @@ #include "base/basictypes.h" -#if defined(OS_WIN) -#include "base/scoped_handle_win.h" -#endif - class ScopedStdioHandle { public: ScopedStdioHandle() diff --git a/base/scoped_handle_win.h b/base/scoped_handle_win.h deleted file mode 100644 index a7c4b2e..0000000 --- a/base/scoped_handle_win.h +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// TODO(brettw) remove this file when all callers are converted to using the -// new location/namespace -#include "base/win/scoped_handle.h" - -using base::win::ScopedHandle; diff --git a/base/test/test_file_util_win.cc b/base/test/test_file_util_win.cc index 0917570..7ca7e84 100644 --- a/base/test/test_file_util_win.cc +++ b/base/test/test_file_util_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,7 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" -#include "base/scoped_handle.h" +#include "base/win/scoped_handle.h" #include "base/threading/platform_thread.h" namespace file_util { @@ -39,7 +39,7 @@ bool DieFileDie(const FilePath& file, bool recurse) { bool EvictFileFromSystemCache(const FilePath& file) { // Request exclusive access to the file and overwrite it with no buffering. - ScopedHandle file_handle( + base::win::ScopedHandle file_handle( CreateFile(file.value().c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_FLAG_NO_BUFFERING, NULL)); if (!file_handle) diff --git a/base/win/event_trace_consumer_unittest.cc b/base/win/event_trace_consumer_unittest.cc index f11f459..efbfdf9 100644 --- a/base/win/event_trace_consumer_unittest.cc +++ b/base/win/event_trace_consumer_unittest.cc @@ -4,14 +4,16 @@ // // Unit tests for event trace consumer_ base class. #include "base/win/event_trace_consumer.h" + #include <list> + #include "base/basictypes.h" -#include "base/win/event_trace_controller.h" -#include "base/win/event_trace_provider.h" #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" -#include "base/scoped_handle.h" +#include "base/win/event_trace_controller.h" +#include "base/win/event_trace_provider.h" +#include "base/win/scoped_handle.h" #include "testing/gtest/include/gtest/gtest.h" #include <initguid.h> // NOLINT - has to be last @@ -63,14 +65,14 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> { ::SetEvent(sank_event_.Get()); } - static ScopedHandle sank_event_; + static base::win::ScopedHandle sank_event_; static EventQueue events_; private: DISALLOW_COPY_AND_ASSIGN(TestConsumer); }; -ScopedHandle TestConsumer::sank_event_; +base::win::ScopedHandle TestConsumer::sank_event_; EventQueue TestConsumer::events_; const wchar_t* const kTestSessionName = L"TestLogSession"; @@ -175,8 +177,8 @@ class EtwTraceConsumerRealtimeTest: public testing::Test { } TestConsumer consumer_; - ScopedHandle consumer_ready_; - ScopedHandle consumer_thread_; + base::win::ScopedHandle consumer_ready_; + base::win::ScopedHandle consumer_thread_; }; } // namespace diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc index 2b3cd66..8eab40a 100644 --- a/base/win/event_trace_controller_unittest.cc +++ b/base/win/event_trace_controller_unittest.cc @@ -1,17 +1,19 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // Unit tests for event trace controller. -#include "base/win/event_trace_controller.h" -#include "base/win/event_trace_provider.h" + +#include <initguid.h> // NOLINT. + #include "base/file_path.h" #include "base/file_util.h" #include "base/logging.h" -#include "base/scoped_handle.h" #include "base/sys_info.h" +#include "base/win/event_trace_controller.h" +#include "base/win/event_trace_provider.h" +#include "base/win/scoped_handle.h" #include "testing/gtest/include/gtest/gtest.h" -#include <initguid.h> // NOLINT - must be last. namespace { @@ -50,7 +52,7 @@ class TestingProvider: public EtwTraceProvider { ::SetEvent(callback_event_.Get()); } - ScopedHandle callback_event_; + base::win::ScopedHandle callback_event_; DISALLOW_COPY_AND_ASSIGN(TestingProvider); }; diff --git a/base/win/win_util.cc b/base/win/win_util.cc index afd16f4..87905ea 100644 --- a/base/win/win_util.cc +++ b/base/win/win_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,11 +13,11 @@ #include "base/logging.h" #include "base/win/registry.h" -#include "base/scoped_handle.h" #include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/threading/thread_restrictions.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" namespace base { @@ -47,7 +47,7 @@ bool GetUserSidString(std::wstring* user_sid) { HANDLE token = NULL; if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) return false; - ScopedHandle token_scoped(token); + base::win::ScopedHandle token_scoped(token); DWORD size = sizeof(TOKEN_USER) + SECURITY_MAX_SID_SIZE; scoped_array<BYTE> user_bytes(new BYTE[size]); diff --git a/ceee/common/process_utils_win.cc b/ceee/common/process_utils_win.cc index 80df821..239bbfe 100644 --- a/ceee/common/process_utils_win.cc +++ b/ceee/common/process_utils_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -9,24 +9,23 @@ #include <sddl.h> #include "base/logging.h" -#include "base/scoped_handle.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "ceee/common/com_utils.h" - namespace process_utils_win { HRESULT SetThreadIntegrityLevel(HANDLE* thread, const std::wstring& level) { HANDLE temp_handle = NULL; BOOL success = ::OpenProcessToken( ::GetCurrentProcess(), MAXIMUM_ALLOWED, &temp_handle); - ScopedHandle process_token(temp_handle); + base::win::ScopedHandle process_token(temp_handle); temp_handle = NULL; if (success) { success = ::DuplicateTokenEx( process_token, MAXIMUM_ALLOWED, NULL, SecurityImpersonation, TokenImpersonation, &temp_handle); - ScopedHandle mic_token(temp_handle); + base::win::ScopedHandle mic_token(temp_handle); temp_handle = NULL; if (success) { PSID mic_sid = NULL; @@ -98,7 +97,7 @@ HRESULT IsCurrentProcessUacElevated(bool* running_as_admin) { // All that for an admin-group member, who can run in elevated mode. // This logic applies to Vista/Win7. The case of earlier systems is handled // at the start. - ScopedHandle process_token(temp_handle); + base::win::ScopedHandle process_token(temp_handle); TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault; DWORD variable_len_dummy = 0; if (!::GetTokenInformation(process_token, TokenElevationType, &elevation_type, @@ -331,4 +330,4 @@ void ProcessCompatibilityCheck::ResetState() { GetInstance()->StandardInitialize(); } -} // namespace com +} // namespace process_utils_win diff --git a/ceee/ie/common/chrome_frame_host.h b/ceee/ie/common/chrome_frame_host.h index 4703e71..59e5c9f 100644 --- a/ceee/ie/common/chrome_frame_host.h +++ b/ceee/ie/common/chrome_frame_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -12,7 +12,7 @@ #include <list> #include "base/basictypes.h" -#include "base/scoped_handle.h" +#include "base/win/scoped_handle.h" #include "ceee/common/initializing_coclass.h" #include "chrome_tab.h" // NOLINT @@ -212,7 +212,7 @@ class ATL_NO_VTABLE ChromeFrameHost #ifndef NDEBUG // We use a cross process event to make sure there is only one chrome frame // host that returns ExtensionApisToAutomate... But only needed for a DCHECK. - ScopedHandle automating_extension_api_; + base::win::ScopedHandle automating_extension_api_; #endif // A cached BSTR for the posted messages origin (which is kAutomationOrigin). diff --git a/ceee/ie/plugin/bho/executor_com_unittest.cc b/ceee/ie/plugin/bho/executor_com_unittest.cc index 8478825..61d5a47 100644 --- a/ceee/ie/plugin/bho/executor_com_unittest.cc +++ b/ceee/ie/plugin/bho/executor_com_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -8,6 +8,7 @@ #include <shlobj.h> #include <atlbase.h> + #include "base/command_line.h" #include "base/file_path.h" #include "base/message_loop.h" @@ -15,6 +16,7 @@ #include "base/process_util.h" #include "base/threading/thread.h" #include "base/win/registry.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "ceee/common/initializing_coclass.h" #include "ceee/ie/plugin/toolband/toolband_proxy.h" @@ -159,7 +161,7 @@ class RemoteObjectHost { } void RunSync(Task* task) { - ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); + base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); remote_thread_.message_loop()->PostTask(FROM_HERE, task); remote_thread_.message_loop()->PostTask(FROM_HERE, diff --git a/chrome/browser/aeropeek_manager.cc b/chrome/browser/aeropeek_manager.cc index 3e1413a..92ce3b8 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,6 @@ #include "app/win/shell.h" #include "base/command_line.h" #include "base/scoped_comptr_win.h" -#include "base/scoped_handle_win.h" #include "base/scoped_native_library.h" #include "base/synchronization/waitable_event.h" #include "base/win/scoped_gdi_object.h" diff --git a/chrome/browser/enumerate_modules_model_win.cc b/chrome/browser/enumerate_modules_model_win.cc index f7f7f99..8e8ba0b 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -14,7 +14,6 @@ #include "base/file_path.h" #include "base/file_version_info_win.h" #include "base/metrics/histogram.h" -#include "base/scoped_handle.h" #include "base/sha2.h" #include "base/string_number_conversions.h" #include "base/string_util.h" @@ -23,6 +22,7 @@ #include "base/values.h" #include "base/version.h" #include "base/win/registry.h" +#include "base/win/scoped_handle.h" #include "chrome/browser/net/service_providers_win.h" #include "chrome/common/chrome_constants.h" #include "chrome/common/chrome_switches.h" @@ -384,8 +384,8 @@ void ModuleEnumerator::ScanImpl() { void ModuleEnumerator::EnumerateLoadedModules() { // Get all modules in the current process. - ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, - ::GetCurrentProcessId())); + base::win::ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, + ::GetCurrentProcessId())); if (!snap.Get()) return; diff --git a/chrome/browser/importer/ie_importer.cc b/chrome/browser/importer/ie_importer.cc index 35f4ad4..b26c306 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -27,6 +27,7 @@ #include "base/values.h" #include "base/utf_string_conversions.h" #include "base/win/registry.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "chrome/browser/bookmarks/bookmark_model.h" #include "chrome/browser/importer/importer_bridge.h" @@ -49,7 +50,7 @@ namespace { // Gets the creation time of the given file or directory. static Time GetFileCreationTime(const std::wstring& file) { Time creation_time; - ScopedHandle file_handle( + base::win::ScopedHandle file_handle( CreateFile(file.c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, diff --git a/chrome/browser/memory_details_win.cc b/chrome/browser/memory_details_win.cc index d49a852..4684fd0 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -1,8 +1,9 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/browser/memory_details.h" + #include <psapi.h> #include "app/l10n_util.h" @@ -10,6 +11,7 @@ #include "base/file_version_info.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" +#include "base/win/scoped_handle.h" #include "chrome/browser/browser_child_process_host.h" #include "chrome/browser/browser_thread.h" #include "chrome/browser/renderer_host/backing_store_manager.h" @@ -74,7 +76,8 @@ void MemoryDetails::CollectProcessData( bool is_64bit_os = system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; - ScopedHandle snapshot(::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); + base::win::ScopedHandle snapshot( + ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)}; if (!snapshot.Get()) { LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError(); @@ -86,7 +89,7 @@ void MemoryDetails::CollectProcessData( } do { base::ProcessId pid = process_entry.th32ProcessID; - ScopedHandle handle(::OpenProcess( + base::win::ScopedHandle handle(::OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, pid)); if (!handle.Get()) continue; diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc index a52700e..47e28dd 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,8 +11,8 @@ #include "base/file_path.h" #include "base/path_service.h" #include "base/process_util.h" -#include "base/scoped_handle.h" #include "base/utf_string_conversions.h" +#include "base/win/scoped_handle.h" #include "chrome/browser/browser_process.h" #include "chrome/browser/extensions/extensions_startup.h" #include "chrome/browser/platform_util.h" @@ -53,7 +53,8 @@ ProcessSingleton::ProcessSingleton(const FilePath& user_data_dir) // since it isn't guaranteed we will get it. It is better to create it // without ownership and explicitly get the ownership afterward. std::wstring mutex_name(L"Local\\ChromeProcessSingletonStartup!"); - ScopedHandle only_me(CreateMutex(NULL, FALSE, mutex_name.c_str())); + base::win::ScopedHandle only_me( + CreateMutex(NULL, FALSE, mutex_name.c_str())); DCHECK(only_me.Get() != NULL) << "GetLastError = " << GetLastError(); // This is how we acquire the mutex (as opposed to the initial ownership). diff --git a/chrome/browser/tab_contents/tab_contents.h b/chrome/browser/tab_contents/tab_contents.h index 79ab5f7..7ef622c 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -39,6 +39,10 @@ #include "gfx/native_widget_types.h" #include "net/base/load_states.h" +#if defined(OS_WIN) +#include "base/win/scoped_handle.h" +#endif + namespace gfx { class Rect; } @@ -1280,7 +1284,7 @@ class TabContents : public PageNavigator, // Handle to an event that's set when the page is showing a message box (or // equivalent constrained window). Plugin processes check this to know if // they should pump messages then. - ScopedHandle message_box_active_; + base::win::ScopedHandle message_box_active_; #endif // The time that the last javascript message was dismissed. diff --git a/chrome/common/service_process_util_win.cc b/chrome/common/service_process_util_win.cc index d30e696..eb784a5 100644 --- a/chrome/common/service_process_util_win.cc +++ b/chrome/common/service_process_util_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,10 +8,10 @@ #include "base/file_util.h" #include "base/logging.h" #include "base/path_service.h" -#include "base/scoped_handle_win.h" #include "base/string16.h" #include "base/utf_string_conversions.h" #include "base/win/object_watcher.h" +#include "base/win/scoped_handle.h" #include "base/win/win_util.h" #include "chrome/common/chrome_switches.h" @@ -47,7 +47,7 @@ class ServiceProcessShutdownMonitor } private: - ScopedHandle shutdown_event_; + base::win::ScopedHandle shutdown_event_; base::win::ObjectWatcher watcher_; scoped_ptr<Task> shutdown_task_; }; @@ -55,7 +55,7 @@ class ServiceProcessShutdownMonitor } // namespace bool ForceServiceProcessShutdown(const std::string& version) { - ScopedHandle shutdown_event; + base::win::ScopedHandle shutdown_event; std::string versioned_name = version; versioned_name.append("_service_shutdown_evt"); string16 event_name = @@ -69,7 +69,7 @@ bool ForceServiceProcessShutdown(const std::string& version) { bool CheckServiceProcessReady() { string16 event_name = GetServiceProcessReadyEventName(); - ScopedHandle event( + base::win::ScopedHandle event( OpenEvent(SYNCHRONIZE | READ_CONTROL, false, event_name.c_str())); if (!event.IsValid()) return false; @@ -79,7 +79,7 @@ bool CheckServiceProcessReady() { struct ServiceProcessState::StateData { // An event that is signaled when a service process is ready. - ScopedHandle ready_event; + base::win::ScopedHandle ready_event; scoped_ptr<ServiceProcessShutdownMonitor> shutdown_monitor; }; @@ -87,7 +87,7 @@ bool ServiceProcessState::TakeSingletonLock() { DCHECK(!state_); string16 event_name = GetServiceProcessReadyEventName(); CHECK(event_name.length() <= MAX_PATH); - ScopedHandle service_process_ready_event; + base::win::ScopedHandle service_process_ready_event; service_process_ready_event.Set( CreateEvent(NULL, TRUE, FALSE, event_name.c_str())); DWORD error = GetLastError(); diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc index a204072..8520da5 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,11 +16,11 @@ #include "base/file_version_info.h" #include "base/path_service.h" #include "base/process_util.h" -#include "base/scoped_handle_win.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/values.h" +#include "base/win/scoped_handle.h" #include "base/win/win_util.h" #include "base/win/windows_version.h" #include "breakpad/src/client/windows/handler/exception_handler.h" @@ -694,7 +694,7 @@ bool ShowRebootDialog() { // Use a ScopedHandle to keep track of and eventually close our handle. // TODO(robertshield): Add a Receive() method to base's ScopedHandle. - ScopedHandle scoped_handle(token); + base::win::ScopedHandle scoped_handle(token); // Get the LUID for the shutdown privilege. TOKEN_PRIVILEGES tkp = {0}; diff --git a/chrome/installer/setup/uninstall.cc b/chrome/installer/setup/uninstall.cc index 0d3d193..f07e703 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -8,11 +8,11 @@ #include "base/file_util.h" #include "base/path_service.h" -#include "base/scoped_handle.h" #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/utf_string_conversions.h" #include "base/win/registry.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "chrome/common/result_codes.h" #include "chrome/common/chrome_constants.h" @@ -146,7 +146,7 @@ void CloseChromeFrameHelperProcess() { DWORD pid = 0; ::GetWindowThreadProcessId(window, &pid); DCHECK_NE(pid, 0U); - ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); + base::win::ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); PLOG_IF(INFO, !process) << "Failed to open process: " << pid; bool kill = true; diff --git a/chrome/installer/util/package_unittest.cc b/chrome/installer/util/package_unittest.cc index 851f188..89ed2cb 100644 --- a/chrome/installer/util/package_unittest.cc +++ b/chrome/installer/util/package_unittest.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/command_line.h" #include "base/logging.h" -#include "base/scoped_handle.h" #include "base/utf_string_conversions.h" +#include "base/win/scoped_handle.h" #include "chrome/installer/util/browser_distribution.h" #include "chrome/installer/util/google_update_constants.h" #include "chrome/installer/util/master_preferences.h" @@ -16,7 +16,6 @@ #include "chrome/installer/util/util_constants.h" using base::win::RegKey; -using base::win::ScopedHandle; using installer::ChromePackageProperties; using installer::ChromiumPackageProperties; using installer::Package; @@ -72,8 +71,9 @@ TEST_F(PackageTest, Basic) { // Hold on to the file exclusively to prevent the directory from // being deleted. - ScopedHandle file(::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ, - 0, NULL, OPEN_ALWAYS, 0, NULL)); + base::win::ScopedHandle file( + ::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ, + 0, NULL, OPEN_ALWAYS, 0, NULL)); EXPECT_TRUE(file.IsValid()); EXPECT_TRUE(file_util::PathExists(old_chrome_dll)); diff --git a/chrome/installer/util/product_unittest.cc b/chrome/installer/util/product_unittest.cc index b6f8f27..c03b253 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc @@ -1,11 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome/installer/util/product_unittest.h" #include "base/logging.h" -#include "base/scoped_handle.h" #include "base/utf_string_conversions.h" #include "chrome/installer/util/chrome_frame_distribution.h" #include "chrome/installer/util/google_update_constants.h" @@ -16,7 +15,6 @@ #include "chrome/installer/util/product.h" using base::win::RegKey; -using base::win::ScopedHandle; using installer::ChromePackageProperties; using installer::ChromiumPackageProperties; using installer::Package; diff --git a/chrome/service/service_utility_process_host.cc b/chrome/service/service_utility_process_host.cc index 859e725..f531169 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,6 +17,10 @@ #include "printing/native_metafile.h" #include "printing/page_range.h" +#if defined(OS_WIN) +#include "base/win/scoped_handle.h" +#endif + ServiceUtilityProcessHost::ServiceUtilityProcessHost( Client* client, base::MessageLoopProxy* client_message_loop_proxy) : ServiceChildProcessHost(ChildProcessInfo::UTILITY_PROCESS), @@ -50,7 +54,7 @@ bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( if (!StartProcess(false, scratch_metafile_dir_->path())) return false; - ScopedHandle pdf_file( + base::win::ScopedHandle pdf_file( ::CreateFile(pdf_path.value().c_str(), GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc index 2349f07..5c2c29e 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -29,6 +29,7 @@ #if defined(OS_WIN) #include "app/win/iat_patch_function.h" +#include "base/win/scoped_handle.h" #endif namespace { @@ -204,7 +205,7 @@ bool UtilityThread::RenderPDFToWinMetafile( printing::NativeMetafile* metafile, int* highest_rendered_page_number) { *highest_rendered_page_number = -1; - ScopedHandle file(pdf_file); + base::win::ScopedHandle file(pdf_file); FilePath pdf_module_path; PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_module_path); HMODULE pdf_module = GetModuleHandle(pdf_module_path.value().c_str()); diff --git a/chrome_frame/crash_reporting/minidump_test.cc b/chrome_frame/crash_reporting/minidump_test.cc index 9b4ef22..106b4df 100644 --- a/chrome_frame/crash_reporting/minidump_test.cc +++ b/chrome_frame/crash_reporting/minidump_test.cc @@ -1,6 +1,7 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + #include <windows.h> #include <objbase.h> #include <dbghelp.h> @@ -11,7 +12,7 @@ #include "base/file_util.h" #include "base/file_version_info.h" #include "base/logging.h" -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "gtest/gtest.h" namespace { @@ -277,8 +278,8 @@ class MinidumpTest: public testing::Test { } protected: - ScopedHandle dump_file_handle_; - ScopedHandle dump_file_mapping_; + base::win::ScopedHandle dump_file_handle_; + base::win::ScopedHandle dump_file_mapping_; void* dump_file_view_; FilePath dump_file_; diff --git a/chrome_frame/crash_reporting/nt_loader_unittest.cc b/chrome_frame/crash_reporting/nt_loader_unittest.cc index 2d1f838..eba363e 100644 --- a/chrome_frame/crash_reporting/nt_loader_unittest.cc +++ b/chrome_frame/crash_reporting/nt_loader_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -10,12 +10,12 @@ #include "base/at_exit.h" #include "base/environment.h" #include "base/message_loop.h" -#include "base/scoped_handle.h" #include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/sys_info.h" #include "base/threading/thread.h" #include "base/utf_string_conversions.h" +#include "base/win/scoped_handle.h" #include "chrome_frame/crash_reporting/crash_dll.h" #include "gtest/gtest.h" @@ -83,7 +83,7 @@ TEST(NtLoader, OwnsCriticalSection) { other.message_loop()->PostTask( FROM_HERE, NewRunnableFunction(::EnterCriticalSection, &cs)); - ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL)); + base::win::ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL)); other.message_loop()->PostTask( FROM_HERE, NewRunnableFunction(::SetEvent, event.Get())); @@ -125,8 +125,8 @@ TEST(NtLoader, OwnsLoaderLock) { TEST(NtLoader, GetLoaderEntry) { // Get all modules in the current process. - ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, - ::GetCurrentProcessId())); + base::win::ScopedHandle snap( + ::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ::GetCurrentProcessId())); EXPECT_TRUE(snap.Get() != NULL); // Walk them, while checking we get an entry for each, and that it diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index 2fc8372..51a9025 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,12 +16,12 @@ #include "base/file_version_info.h" #include "base/path_service.h" #include "base/process_util.h" -#include "base/scoped_handle.h" #include "base/scoped_ptr.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "base/win/registry.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "ceee/ie/common/ceee_util.h" #include "chrome/common/chrome_switches.h" @@ -95,7 +95,8 @@ int CloseVisibleWindowsOnAllThreads(HANDLE process) { return 0; } - ScopedHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0)); + base::win::ScopedHandle snapshot( + CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0)); if (!snapshot.IsValid()) { NOTREACHED(); return 0; @@ -309,7 +310,7 @@ BOOL LowIntegrityToken::Impersonate() { return ok; } - ScopedHandle process_token(process_token_handle); + base::win::ScopedHandle process_token(process_token_handle); // Create impersonation low integrity token. HANDLE impersonation_token_handle = NULL; ok = ::DuplicateTokenEx(process_token, @@ -322,7 +323,7 @@ BOOL LowIntegrityToken::Impersonate() { // TODO(stoyan): sandbox/src/restricted_token_utils.cc has // SetTokenIntegrityLevel function already. - ScopedHandle impersonation_token(impersonation_token_handle); + base::win::ScopedHandle impersonation_token(impersonation_token_handle); PSID integrity_sid = NULL; TOKEN_MANDATORY_LABEL tml = {0}; ok = ::ConvertStringSidToSid(SDDL_ML_LOW, &integrity_sid); @@ -540,7 +541,7 @@ CloseIeAtEndOfScope::~CloseIeAtEndOfScope() { bool DetectRunningCrashService(int timeout_ms) { // Wait for the crash_service.exe to be ready for clients. base::Time start = base::Time::Now(); - ScopedHandle new_pipe; + base::win::ScopedHandle new_pipe; while (true) { new_pipe.Set(::CreateFile(kCrashServicePipeName, diff --git a/chrome_frame/test/dll_redirector_test.cc b/chrome_frame/test/dll_redirector_test.cc index f052cf4..13959dc 100644 --- a/chrome_frame/test/dll_redirector_test.cc +++ b/chrome_frame/test/dll_redirector_test.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome_frame/dll_redirector.h" -#include "base/scoped_handle.h" #include "base/shared_memory.h" #include "base/sys_info.h" #include "base/utf_string_conversions.h" #include "base/version.h" +#include "base/win/scoped_handle.h" #include "chrome_frame/test/chrome_frame_test_utils.h" #include "gtest/gtest.h" @@ -27,8 +27,6 @@ const uint32 kSharedMemorySize = 128; // before failing. const uint32 kWaitTestTimeout = 20000; -using base::win::ScopedHandle; - class MockDllRedirector : public DllRedirector { public: explicit MockDllRedirector(const char* beacon_name) @@ -231,8 +229,8 @@ TEST_F(DllRedirectorTest, TestBeaconOwnershipHandoff) { } struct LockSquattingThreadParams { - ScopedHandle is_squatting; - ScopedHandle time_to_die; + base::win::ScopedHandle is_squatting; + base::win::ScopedHandle time_to_die; }; DWORD WINAPI LockSquattingThread(void* in_params) { @@ -268,7 +266,7 @@ TEST_F(DllRedirectorTest, LockSquatting) { params.is_squatting.Set(::CreateEvent(NULL, FALSE, FALSE, NULL)); params.time_to_die.Set(::CreateEvent(NULL, FALSE, FALSE, NULL)); DWORD tid = 0; - ScopedHandle lock_squat_thread( + base::win::ScopedHandle lock_squat_thread( ::CreateThread(NULL, 0, LockSquattingThread, ¶ms, 0, &tid)); // Make sure the squatter has started squatting. diff --git a/chrome_frame/test/ie_event_sink.cc b/chrome_frame/test/ie_event_sink.cc index 1649e2a..c570558 100644 --- a/chrome_frame/test/ie_event_sink.cc +++ b/chrome_frame/test/ie_event_sink.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome_frame/test/ie_event_sink.h" -#include "base/scoped_handle.h" #include "base/string_util.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" #include "base/win/scoped_bstr.h" +#include "base/win/scoped_handle.h" #include "base/win/scoped_variant.h" #include "chrome_frame/test/chrome_frame_test_utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -147,9 +147,8 @@ void IEEventSink::Uninitialize() { web_browser2_->Quit(); } - ScopedHandle process; - process.Set(OpenProcess(SYNCHRONIZE, FALSE, - ie_process_id_)); + base::win::ScopedHandle process; + process.Set(OpenProcess(SYNCHRONIZE, FALSE, ie_process_id_)); web_browser2_.Release(); if (!process.IsValid()) { diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 0cb72d1..ca30329 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -21,6 +21,7 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "base/threading/platform_thread.h" +#include "base/win/scoped_handle.h" #include "chrome/browser/automation/automation_provider_list.h" #include "chrome/browser/plugin_service.h" #include "chrome/browser/prefs/browser_prefs.h" @@ -279,7 +280,7 @@ void CFUrlRequestUnittestRunner::StartChromeFrameInHostBrowser() { kTestServerPort).c_str()); // Launch IE. This launches IE correctly on Vista too. - ScopedHandle ie_process(chrome_frame_test::LaunchIE(url)); + base::win::ScopedHandle ie_process(chrome_frame_test::LaunchIE(url)); EXPECT_TRUE(ie_process.IsValid()); // NOTE: If you're running IE8 and CF is not being loaded, you need to diff --git a/chrome_frame/test/net/fake_external_tab.h b/chrome_frame/test/net/fake_external_tab.h index ea7cb6b..9b9842c 100644 --- a/chrome_frame/test/net/fake_external_tab.h +++ b/chrome_frame/test/net/fake_external_tab.h @@ -1,22 +1,22 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_ #define CHROME_FRAME_TEST_NET_FAKE_EXTERNAL_TAB_H_ +#pragma once #include <string> #include "base/file_path.h" #include "base/message_loop.h" - +#include "base/win/scoped_handle.h" #include "chrome/app/scoped_ole_initializer.h" #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/browser_thread.h" #include "chrome_frame/test/test_server.h" #include "chrome_frame/test/net/test_automation_provider.h" #include "chrome_frame/test/net/process_singleton_subclass.h" - #include "net/base/net_test_suite.h" class ProcessSingleton; @@ -87,7 +87,7 @@ class CFUrlRequestUnittestRunner protected: protected: - ScopedHandle test_thread_; + base::win::ScopedHandle test_thread_; DWORD test_thread_id_; scoped_ptr<test_server::SimpleWebServer> test_http_server_; diff --git a/chrome_frame/test/test_server_test.cc b/chrome_frame/test/test_server_test.cc index 9040e22..23073e3e 100644 --- a/chrome_frame/test/test_server_test.cc +++ b/chrome_frame/test/test_server_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/path_service.h" -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "chrome_frame/test/test_server.h" #include "net/base/cookie_monster.h" #include "net/base/host_resolver_proc.h" @@ -192,7 +192,8 @@ TEST_F(TestServerTest, TestServer) { UrlTaskChain goog_task("http://localhost:1337/goog", &file_task); DWORD tid = 0; - ScopedHandle worker(::CreateThread(NULL, 0, FetchUrl, &goog_task, 0, &tid)); + base::win::ScopedHandle worker(::CreateThread( + NULL, 0, FetchUrl, &goog_task, 0, &tid)); loop.MessageLoop::Run(); EXPECT_FALSE(quit_msg.hit_); diff --git a/chrome_frame/test/test_with_web_server.h b/chrome_frame/test/test_with_web_server.h index 3b424f3..eaecbef 100644 --- a/chrome_frame/test/test_with_web_server.h +++ b/chrome_frame/test/test_with_web_server.h @@ -1,9 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ #define CHROME_FRAME_TEST_TEST_WITH_WEB_SERVER_H_ +#pragma once #include <windows.h> #include <string> @@ -11,6 +12,7 @@ #include "base/string_util.h" #include "base/stringprintf.h" #include "base/utf_string_conversions.h" +#include "base/win/scoped_handle.h" #include "chrome_frame/test/chrome_frame_test_utils.h" #include "chrome_frame/test/http_server.h" #include "chrome_frame/test/test_server.h" @@ -216,7 +218,7 @@ class ChromeFrameTestWithWebServer: public testing::Test { BrowserKind browser_; FilePath results_dir_; - ScopedHandle browser_handle_; + base::win::ScopedHandle browser_handle_; // The on-disk path to our html test files. FilePath test_file_path_; diff --git a/chrome_frame/test/urlmon_moniker_integration_test.cc b/chrome_frame/test/urlmon_moniker_integration_test.cc index 4e9c29b9..b27b90d 100644 --- a/chrome_frame/test/urlmon_moniker_integration_test.cc +++ b/chrome_frame/test/urlmon_moniker_integration_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,6 +6,7 @@ #include <atlcom.h> #include "base/scoped_comptr_win.h" +#include "base/win/scoped_handle.h" #include "base/threading/thread.h" #include "chrome_frame/bho.h" //#include "chrome_frame/urlmon_moniker.h" @@ -82,7 +83,7 @@ class RunTestServer : public base::Thread { protected: scoped_ptr<test_server::SimpleWebServer> server_; test_server::SimpleResponse default_response_; - ScopedHandle ready_; + base::win::ScopedHandle ready_; }; // Helper class for running tests that rely on the NavigationManager. diff --git a/chrome_frame/test_utils.cc b/chrome_frame/test_utils.cc index d146079..65b172d 100644 --- a/chrome_frame/test_utils.cc +++ b/chrome_frame/test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,8 +13,8 @@ #include "base/logging.h" #include "base/path_service.h" #include "base/process_util.h" -#include "base/scoped_handle.h" #include "base/string_util.h" +#include "base/win/scoped_handle.h" #include "chrome/common/chrome_paths.h" #include "chrome/common/chrome_switches.h" #include "testing/gtest/include/gtest/gtest.h" @@ -177,10 +177,10 @@ bool GetCommandLineForProcess(uint32 process_id, std::wstring* cmd_line) { DCHECK(cmd_line); // Open the process - ScopedHandle process_handle(::OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, - false, - process_id)); + base::win::ScopedHandle process_handle(::OpenProcess( + PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, + false, + process_id)); if (!process_handle) { DLOG(ERROR) << "Failed to open process " << process_id << ", last error = " << GetLastError(); diff --git a/chrome_frame/vtable_patch_manager_unittest.cc b/chrome_frame/vtable_patch_manager_unittest.cc index 4e04796..842a32a 100644 --- a/chrome_frame/vtable_patch_manager_unittest.cc +++ b/chrome_frame/vtable_patch_manager_unittest.cc @@ -1,12 +1,14 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "chrome_frame/vtable_patch_manager.h" + #include <unknwn.h> + #include "base/message_loop.h" #include "base/threading/thread.h" -#include "base/scoped_handle.h" +#include "base/win/scoped_handle.h" #include "gtest/gtest.h" #include "gmock/gmock.h" @@ -209,7 +211,7 @@ TEST_F(VtablePatchManagerTest, ThreadSafePatching) { base::Thread background("Background Test Thread"); EXPECT_TRUE(background.Start()); - ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); + base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); // Grab the patch lock. vtable_patch::patch_lock_.Acquire(); diff --git a/gfx/icon_util.cc b/gfx/icon_util.cc index 6a4e51c..cabc505 100644 --- a/gfx/icon_util.cc +++ b/gfx/icon_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,8 +6,8 @@ #include "base/file_util.h" #include "base/logging.h" -#include "base/scoped_handle.h" #include "base/scoped_ptr.h" +#include "base/win/scoped_handle.h" #include "gfx/size.h" #include "skia/ext/image_operations.h" #include "third_party/skia/include/core/SkBitmap.h" @@ -197,7 +197,7 @@ bool IconUtil::CreateIconFileFromSkBitmap(const SkBitmap& bitmap, return false; // We start by creating the file. - ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(), + base::win::ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL)); if (icon_file.Get() == INVALID_HANDLE_VALUE) diff --git a/ipc/ipc_channel_win.cc b/ipc/ipc_channel_win.cc index ee58701..f549d34 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -13,6 +13,7 @@ #include "base/logging.h" #include "base/threading/non_thread_safe.h" #include "base/utf_string_conversions.h" +#include "base/win/scoped_handle.h" #include "ipc/ipc_logging.h" #include "ipc/ipc_message_utils.h" @@ -29,7 +30,7 @@ bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor) { HANDLE token = NULL; if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) return false; - ScopedHandle token_scoped(token); + base::win::ScopedHandle token_scoped(token); // Get the size of the TokenGroups structure. DWORD size = 0; diff --git a/media/audio/win/wavein_input_win.h b/media/audio/win/wavein_input_win.h index 7dd4781..5cc8913 100644 --- a/media/audio/win/wavein_input_win.h +++ b/media/audio/win/wavein_input_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,7 +9,7 @@ #include <mmsystem.h> #include "base/basictypes.h" -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "media/audio/audio_io.h" #include "media/audio/audio_parameters.h" @@ -93,7 +93,7 @@ class PCMWaveInAudioInputStream : public AudioInputStream { WAVEHDR* buffer_; // An event that is signaled when the callback thread is ready to stop. - ScopedHandle stopped_event_; + base::win::ScopedHandle stopped_event_; DISALLOW_COPY_AND_ASSIGN(PCMWaveInAudioInputStream); }; diff --git a/media/audio/win/waveout_output_win.h b/media/audio/win/waveout_output_win.h index 651c9d2..74717a0 100644 --- a/media/audio/win/waveout_output_win.h +++ b/media/audio/win/waveout_output_win.h @@ -1,16 +1,17 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_ #define MEDIA_AUDIO_WIN_WAVEOUT_OUTPUT_WIN_H_ +#pragma once #include <windows.h> #include <mmsystem.h> #include <mmreg.h> #include "base/basictypes.h" -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "media/audio/audio_io.h" #include "media/audio/audio_parameters.h" @@ -110,7 +111,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { WAVEHDR* buffer_; // An event that is signaled when the callback thread is ready to stop. - ScopedHandle stopped_event_; + base::win::ScopedHandle stopped_event_; DISALLOW_COPY_AND_ASSIGN(PCMWaveOutAudioOutputStream); }; diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index eaa00eb..05f17f6 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,6 +20,10 @@ #include "net/disk_cache/mem_backend_impl.h" #include "testing/gtest/include/gtest/gtest.h" +#if defined(OS_WIN) +#include "base/win/scoped_handle.h" +#endif + using base::Time; // Tests that can run with different types of caches. @@ -1929,8 +1933,8 @@ TEST_F(DiskCacheBackendTest, FileSharing) { #if defined(OS_WIN) DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; DWORD access = GENERIC_READ | GENERIC_WRITE; - ScopedHandle file2(CreateFile(name.value().c_str(), access, sharing, NULL, - OPEN_EXISTING, 0, NULL)); + base::win::ScopedHandle file2(CreateFile( + name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL)); EXPECT_FALSE(file2.IsValid()); sharing |= FILE_SHARE_DELETE; diff --git a/net/disk_cache/cache_util_win.cc b/net/disk_cache/cache_util_win.cc index cbe6b87..65fc064 100644 --- a/net/disk_cache/cache_util_win.cc +++ b/net/disk_cache/cache_util_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,9 +6,10 @@ #include <windows.h> +#include "base/file_util.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/file_util.h" +#include "base/win/scoped_handle.h" namespace { @@ -66,8 +67,8 @@ bool DeleteCacheFile(const FilePath& name) { // us from opening the file again (unless it was deleted). DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; DWORD access = SYNCHRONIZE; - ScopedHandle file(CreateFile(name.value().c_str(), access, sharing, NULL, - OPEN_EXISTING, 0, NULL)); + base::win::ScopedHandle file(CreateFile( + name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL)); if (file.IsValid()) return false; diff --git a/net/test/test_server.h b/net/test/test_server.h index 9686aef..6d93fc8 100644 --- a/net/test/test_server.h +++ b/net/test/test_server.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -20,7 +20,7 @@ #include "net/base/net_util.h" #if defined(OS_WIN) -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #endif class CommandLine; @@ -177,13 +177,13 @@ class TestServer { #if defined(OS_WIN) // JobObject used to clean up orphaned child processes. - ScopedHandle job_handle_; + base::win::ScopedHandle job_handle_; // The pipe file handle we read from. - ScopedHandle child_read_fd_; + base::win::ScopedHandle child_read_fd_; // The pipe file handle the child and we write to. - ScopedHandle child_write_fd_; + base::win::ScopedHandle child_write_fd_; #endif #if defined(OS_POSIX) diff --git a/net/test/test_server_win.cc b/net/test/test_server_win.cc index 075b484..9fc13cd 100644 --- a/net/test/test_server_win.cc +++ b/net/test/test_server_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -17,6 +17,7 @@ #include "base/test/test_timeouts.h" #include "base/threading/thread.h" #include "base/utf_string_conversions.h" +#include "base/win/scoped_handle.h" #pragma comment(lib, "crypt32.lib") @@ -25,7 +26,7 @@ namespace { bool LaunchTestServerAsJob(const CommandLine& cmdline, bool start_hidden, base::ProcessHandle* process_handle, - ScopedHandle* job_handle) { + base::win::ScopedHandle* job_handle) { // Launch test server process. STARTUPINFO startup_info = {0}; startup_info.cb = sizeof(startup_info); @@ -191,8 +192,8 @@ bool TestServer::LaunchPython(const FilePath& testserver_path) { } bool TestServer::WaitToStart() { - ScopedHandle read_fd(child_read_fd_.Take()); - ScopedHandle write_fd(child_write_fd_.Take()); + base::win::ScopedHandle read_fd(child_read_fd_.Take()); + base::win::ScopedHandle write_fd(child_write_fd_.Take()); uint32 server_data_len = 0; if (!ReadData(read_fd.Get(), write_fd.Get(), sizeof(server_data_len), diff --git a/net/tools/dump_cache/dump_cache.cc b/net/tools/dump_cache/dump_cache.cc index 3561fb7..53dd121 100644 --- a/net/tools/dump_cache/dump_cache.cc +++ b/net/tools/dump_cache/dump_cache.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,10 +11,9 @@ #include "base/at_exit.h" #include "base/command_line.h" #include "base/process_util.h" -#include "base/scoped_handle.h" #include "base/string_util.h" #include "base/stringprintf.h" - +#include "base/win/scoped_handle.h" #include "net/disk_cache/disk_format.h" enum Errors { @@ -156,7 +155,7 @@ int main(int argc, const char* argv[]) { if (command_line.HasSwitch(kSlave) && slave_required) return RunSlave(input_path, pipe_number); - ScopedHandle server; + base::win::ScopedHandle server; if (slave_required) { server.Set(CreateServer(&pipe_number)); if (!server.IsValid()) { diff --git a/net/tools/dump_cache/upgrade.cc b/net/tools/dump_cache/upgrade.cc index fae924c..7b86237 100644 --- a/net/tools/dump_cache/upgrade.cc +++ b/net/tools/dump_cache/upgrade.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,6 +9,7 @@ #include "base/string_number_conversions.h" #include "base/string_util.h" #include "base/threading/thread.h" +#include "base/win/scoped_handle.h" #include "googleurl/src/gurl.h" #include "net/base/io_buffer.h" #include "net/base/test_completion_callback.h" @@ -912,7 +913,7 @@ int CopyCache(const std::wstring& output_path, HANDLE pipe, bool copy_to_text) { int RunSlave(const std::wstring& input_path, const std::wstring& pipe_number) { MessageLoop loop(MessageLoop::TYPE_IO); - ScopedHandle pipe(OpenServer(pipe_number)); + base::win::ScopedHandle pipe(OpenServer(pipe_number)); if (!pipe.IsValid()) { printf("Unable to open the server pipe\n"); return -1; diff --git a/printing/emf_win_unittest.cc b/printing/emf_win_unittest.cc index edef14a..4312b2c 100644 --- a/printing/emf_win_unittest.cc +++ b/printing/emf_win_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -12,7 +12,6 @@ #include "base/file_path.h" #include "base/file_util.h" #include "base/path_service.h" -#include "base/scoped_handle_win.h" #include "base/scoped_ptr.h" #include "base/scoped_temp_dir.h" #include "base/win/scoped_hdc.h" diff --git a/sandbox/src/file_policy_test.cc b/sandbox/src/file_policy_test.cc index 2abf6e2..df1e903 100644 --- a/sandbox/src/file_policy_test.cc +++ b/sandbox/src/file_policy_test.cc @@ -1,13 +1,14 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. + #include <algorithm> #include <cctype> #include <windows.h> #include <winioctl.h> -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "sandbox/src/nt_internals.h" #include "sandbox/src/sandbox.h" #include "sandbox/src/sandbox_factory.h" @@ -35,19 +36,20 @@ SBOX_TESTS_COMMAND int File_Create(int argc, wchar_t **argv) { bool read = (_wcsicmp(argv[0], L"Read") == 0); if (read) { - ScopedHandle file1(CreateFile(argv[1], GENERIC_READ, kSharing, NULL, - OPEN_EXISTING, 0, NULL)); - ScopedHandle file2(CreateFile(argv[1], FILE_EXECUTE, kSharing, NULL, - OPEN_EXISTING, 0, NULL)); + base::win::ScopedHandle file1(CreateFile( + argv[1], GENERIC_READ, kSharing, NULL, OPEN_EXISTING, 0, NULL)); + base::win::ScopedHandle file2(CreateFile( + argv[1], FILE_EXECUTE, kSharing, NULL, OPEN_EXISTING, 0, NULL)); if (file1.Get() && file2.Get()) return SBOX_TEST_SUCCEEDED; return SBOX_TEST_DENIED; } else { - ScopedHandle file1(CreateFile(argv[1], GENERIC_ALL, kSharing, NULL, - OPEN_EXISTING, 0, NULL)); - ScopedHandle file2(CreateFile(argv[1], GENERIC_READ | FILE_WRITE_DATA, - kSharing, NULL, OPEN_EXISTING, 0, NULL)); + base::win::ScopedHandle file1(CreateFile( + argv[1], GENERIC_ALL, kSharing, NULL, OPEN_EXISTING, 0, NULL)); + base::win::ScopedHandle file2(CreateFile( + argv[1], GENERIC_READ | FILE_WRITE_DATA, kSharing, NULL, OPEN_EXISTING, + 0, NULL)); if (file1.Get() && file2.Get()) return SBOX_TEST_SUCCEEDED; diff --git a/sandbox/src/filesystem_policy.cc b/sandbox/src/filesystem_policy.cc index 2a15555..385f4ae 100644 --- a/sandbox/src/filesystem_policy.cc +++ b/sandbox/src/filesystem_policy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -7,7 +7,7 @@ #include "sandbox/src/filesystem_policy.h" #include "base/logging.h" -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "sandbox/src/ipc_tags.h" #include "sandbox/src/policy_engine_opcodes.h" #include "sandbox/src/policy_params.h" @@ -363,7 +363,7 @@ bool FileSystemPolicy::SetInformationFileAction( return true; } - ScopedHandle handle(local_handle); + base::win::ScopedHandle handle(local_handle); FILE_INFORMATION_CLASS file_info_class = static_cast<FILE_INFORMATION_CLASS>(info_class); diff --git a/sandbox/src/process_policy_test.cc b/sandbox/src/process_policy_test.cc index 0fbf204..8681671 100644 --- a/sandbox/src/process_policy_test.cc +++ b/sandbox/src/process_policy_test.cc @@ -1,17 +1,17 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <string> #include <memory> +#include <string> -#include "base/scoped_handle_win.h" -#include "testing/gtest/include/gtest/gtest.h" +#include "base/win/scoped_handle.h" #include "sandbox/src/sandbox.h" #include "sandbox/src/sandbox_policy.h" #include "sandbox/src/sandbox_factory.h" #include "sandbox/src/sandbox_utils.h" #include "sandbox/tests/common/controller.h" +#include "testing/gtest/include/gtest/gtest.h" namespace { @@ -178,14 +178,14 @@ SBOX_TESTS_COMMAND int Process_GetChildProcessToken(int argc, wchar_t **argv) { return SBOX_TEST_FAILED; } - ScopedHandle process(pi.hProcess); - ScopedHandle thread(pi.hThread); + base::win::ScopedHandle process(pi.hProcess); + base::win::ScopedHandle thread(pi.hThread); HANDLE token = NULL; BOOL result = ::OpenProcessToken(process.Get(), TOKEN_IMPERSONATE, &token); DWORD error = ::GetLastError(); - ScopedHandle token_handle(token); + base::win::ScopedHandle token_handle(token); if (!::TerminateProcess(process.Get(), 0)) return SBOX_TEST_FAILED; diff --git a/sandbox/src/registry_dispatcher.cc b/sandbox/src/registry_dispatcher.cc index 5f53770..f86c76a 100644 --- a/sandbox/src/registry_dispatcher.cc +++ b/sandbox/src/registry_dispatcher.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "sandbox/src/registry_dispatcher.h" -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "sandbox/src/crosscall_client.h" #include "sandbox/src/interception.h" @@ -74,7 +74,7 @@ bool RegistryDispatcher::SetupService(InterceptionManager* manager, bool RegistryDispatcher::NtCreateKey( IPCInfo* ipc, std::wstring* name, DWORD attributes, HANDLE root, DWORD desired_access, DWORD title_index, DWORD create_options) { - ScopedHandle root_handle; + base::win::ScopedHandle root_handle; std::wstring real_path = *name; // If there is a root directory, we need to duplicate the handle to make @@ -120,7 +120,7 @@ bool RegistryDispatcher::NtCreateKey( bool RegistryDispatcher::NtOpenKey(IPCInfo* ipc, std::wstring* name, DWORD attributes, HANDLE root, DWORD desired_access) { - ScopedHandle root_handle; + base::win::ScopedHandle root_handle; std::wstring real_path = *name; // If there is a root directory, we need to duplicate the handle to make diff --git a/sandbox/src/restricted_token_utils.cc b/sandbox/src/restricted_token_utils.cc index 8842865..b036e51 100644 --- a/sandbox/src/restricted_token_utils.cc +++ b/sandbox/src/restricted_token_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -9,7 +9,7 @@ #include "sandbox/src/restricted_token_utils.h" #include "base/logging.h" -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "base/win/windows_version.h" #include "sandbox/src/job.h" #include "sandbox/src/restricted_token.h" @@ -166,7 +166,7 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line, if (ERROR_SUCCESS != err_code) { return err_code; } - ScopedHandle primary_token(primary_token_handle); + base::win::ScopedHandle primary_token(primary_token_handle); // Create the impersonation token (restricted) to be able to start the // process. @@ -178,7 +178,7 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line, if (ERROR_SUCCESS != err_code) { return err_code; } - ScopedHandle impersonation_token(impersonation_token_handle); + base::win::ScopedHandle impersonation_token(impersonation_token_handle); // Start the process STARTUPINFO startup_info = {0}; @@ -198,8 +198,8 @@ DWORD StartRestrictedProcessInJob(wchar_t *command_line, return ::GetLastError(); } - ScopedHandle thread_handle(process_info.hThread); - ScopedHandle process_handle(process_info.hProcess); + base::win::ScopedHandle thread_handle(process_info.hThread); + base::win::ScopedHandle process_handle(process_info.hProcess); // Change the token of the main thread of the new process for the // impersonation token with more rights. @@ -335,10 +335,9 @@ DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) { &token_handle)) return ::GetLastError(); - ScopedHandle token(token_handle); + base::win::ScopedHandle token(token_handle); return SetTokenIntegrityLevel(token.Get(), integrity_level); } - } // namespace sandbox diff --git a/sandbox/src/sync_policy_test.cc b/sandbox/src/sync_policy_test.cc index 835a578..3c87243 100644 --- a/sandbox/src/sync_policy_test.cc +++ b/sandbox/src/sync_policy_test.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/scoped_handle_win.h" -#include "testing/gtest/include/gtest/gtest.h" +#include "base/win/scoped_handle.h" #include "sandbox/src/sandbox.h" #include "sandbox/src/sandbox_policy.h" #include "sandbox/src/sandbox_factory.h" #include "sandbox/src/nt_internals.h" #include "sandbox/tests/common/controller.h" +#include "testing/gtest/include/gtest/gtest.h" namespace sandbox { @@ -20,7 +20,8 @@ SBOX_TESTS_COMMAND int Event_Open(int argc, wchar_t **argv) { if (L'f' == argv[0][0]) desired_access = EVENT_ALL_ACCESS; - ScopedHandle event_open(::OpenEvent(desired_access, FALSE, argv[1])); + base::win::ScopedHandle event_open(::OpenEvent( + desired_access, FALSE, argv[1])); DWORD error_open = ::GetLastError(); if (event_open.Get()) @@ -48,10 +49,10 @@ SBOX_TESTS_COMMAND int Event_CreateOpen(int argc, wchar_t **argv) { if (L't' == argv[1][0]) initial_state = TRUE; - ScopedHandle event_create(::CreateEvent(NULL, manual_reset, initial_state, - event_name)); + base::win::ScopedHandle event_create(::CreateEvent( + NULL, manual_reset, initial_state, event_name)); DWORD error_create = ::GetLastError(); - ScopedHandle event_open; + base::win::ScopedHandle event_open; if (event_name) event_open.Set(::OpenEvent(EVENT_ALL_ACCESS, FALSE, event_name)); @@ -124,10 +125,10 @@ TEST(SyncPolicyTest, TestEventReadOnly) { TargetPolicy::EVENTS_ALLOW_READONLY, L"test6")); - ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"test1")); - ScopedHandle handle2(::CreateEvent(NULL, FALSE, FALSE, L"test2")); - ScopedHandle handle3(::CreateEvent(NULL, FALSE, FALSE, L"test3")); - ScopedHandle handle4(::CreateEvent(NULL, FALSE, FALSE, L"test4")); + base::win::ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"test1")); + base::win::ScopedHandle handle2(::CreateEvent(NULL, FALSE, FALSE, L"test2")); + base::win::ScopedHandle handle3(::CreateEvent(NULL, FALSE, FALSE, L"test3")); + base::win::ScopedHandle handle4(::CreateEvent(NULL, FALSE, FALSE, L"test4")); EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Event_CreateOpen f f")); EXPECT_EQ(SBOX_TEST_SUCCEEDED, runner.RunTest(L"Event_CreateOpen t f")); diff --git a/sandbox/src/unload_dll_test.cc b/sandbox/src/unload_dll_test.cc index 063f43f..a50f1aa 100644 --- a/sandbox/src/unload_dll_test.cc +++ b/sandbox/src/unload_dll_test.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/scoped_handle_win.h" -#include "testing/gtest/include/gtest/gtest.h" +#include "base/win/scoped_handle.h" #include "sandbox/src/sandbox.h" #include "sandbox/src/sandbox_factory.h" #include "sandbox/src/target_services.h" #include "sandbox/tests/common/controller.h" +#include "testing/gtest/include/gtest/gtest.h" namespace sandbox { @@ -36,7 +36,7 @@ SBOX_TESTS_COMMAND int SimpleOpenEvent(int argc, wchar_t **argv) { if (argc != 1) return SBOX_TEST_FAILED_TO_EXECUTE_COMMAND; - ScopedHandle event_open(::OpenEvent(SYNCHRONIZE, FALSE, argv[0])); + base::win::ScopedHandle event_open(::OpenEvent(SYNCHRONIZE, FALSE, argv[0])); return event_open.Get() ? SBOX_TEST_SUCCEEDED : SBOX_TEST_FAILED; } @@ -73,7 +73,8 @@ TEST(UnloadDllTest, FLAKY_UnloadAviCapDllWithPatching) { sandbox::TargetPolicy* policy = runner.GetPolicy(); policy->AddDllToUnload(L"avicap32.dll"); - ScopedHandle handle1(::CreateEvent(NULL, FALSE, FALSE, L"tst0001")); + base::win::ScopedHandle handle1(::CreateEvent( + NULL, FALSE, FALSE, L"tst0001")); // Add a couple of rules that ensures that the interception agent add EAT // patching on the client which makes sure that the unload dll record does diff --git a/sandbox/src/win_utils_unittest.cc b/sandbox/src/win_utils_unittest.cc index 99ce7e2..0f445ef 100644 --- a/sandbox/src/win_utils_unittest.cc +++ b/sandbox/src/win_utils_unittest.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include <windows.h> -#include "base/scoped_handle_win.h" +#include "base/win/scoped_handle.h" #include "sandbox/src/win_utils.h" #include "sandbox/tests/common/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -67,8 +67,9 @@ TEST(WinUtils, SameObject) { std::wstring folder(my_folder); std::wstring file_name = folder + L"\\foo.txt"; const ULONG kSharing = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE; - ScopedHandle file(CreateFile(file_name.c_str(), GENERIC_WRITE, kSharing, NULL, - CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, NULL)); + base::win::ScopedHandle file(CreateFile( + file_name.c_str(), GENERIC_WRITE, kSharing, NULL, CREATE_ALWAYS, + FILE_FLAG_DELETE_ON_CLOSE, NULL)); EXPECT_TRUE(file.IsValid()); std::wstring file_name_nt1 = std::wstring(L"\\??\\") + file_name; |