diff options
57 files changed, 245 insertions, 269 deletions
diff --git a/app/win/win_util.cc b/app/win/win_util.cc index 7076a5f..116b89f 100644 --- a/app/win/win_util.cc +++ b/app/win/win_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -17,6 +17,7 @@ #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 6ea94e4..bbd888a 100644 --- a/base/file_util_unittest.cc +++ b/base/file_util_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -19,6 +19,7 @@ #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" @@ -26,10 +27,6 @@ #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) @@ -474,7 +471,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) { FilePath to_sub_a = base_b.Append(FPL("to_sub_a")); ASSERT_TRUE(file_util::CreateDirectory(to_sub_a)); - base::win::ScopedHandle reparse_to_sub_a( + ScopedHandle reparse_to_sub_a( ::CreateFile(to_sub_a.value().c_str(), FILE_ALL_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -487,7 +484,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) { FilePath to_base_b = base_b.Append(FPL("to_base_b")); ASSERT_TRUE(file_util::CreateDirectory(to_base_b)); - base::win::ScopedHandle reparse_to_base_b( + ScopedHandle reparse_to_base_b( ::CreateFile(to_base_b.value().c_str(), FILE_ALL_ACCESS, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, @@ -500,7 +497,7 @@ TEST_F(FileUtilTest, NormalizeFilePathReparsePoints) { FilePath to_sub_long = base_b.Append(FPL("to_sub_long")); ASSERT_TRUE(file_util::CreateDirectory(to_sub_long)); - base::win::ScopedHandle reparse_to_sub_long( + 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 c471e38..e926c57 100644 --- a/base/message_loop_unittest.cc +++ b/base/message_loop_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -15,7 +15,7 @@ #if defined(OS_WIN) #include "base/message_pump_win.h" -#include "base/win/scoped_handle.h" +#include "base/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; - base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL)); + 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; - base::win::ScopedHandle event(CreateEvent(NULL, FALSE, FALSE, NULL)); + 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_; - base::win::ScopedHandle file_; + ScopedHandle file_; bool wait_; }; @@ -1235,12 +1235,12 @@ class IOHandlerTask : public Task { }; void RunTest_IOHandler() { - base::win::ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL)); + ScopedHandle callback_called(CreateEvent(NULL, TRUE, FALSE, NULL)); ASSERT_TRUE(callback_called.IsValid()); const wchar_t* kPipeName = L"\\\\.\\pipe\\iohandler_pipe"; - base::win::ScopedHandle server( - CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, 0, 0, 0, NULL)); + ScopedHandle server(CreateNamedPipe(kPipeName, PIPE_ACCESS_OUTBOUND, 0, 1, + 0, 0, 0, NULL)); ASSERT_TRUE(server.IsValid()); Thread thread("IOHandler test"); @@ -1267,19 +1267,17 @@ void RunTest_IOHandler() { } void RunTest_WaitForIO() { - base::win::ScopedHandle callback1_called( - CreateEvent(NULL, TRUE, FALSE, NULL)); - base::win::ScopedHandle callback2_called( - CreateEvent(NULL, TRUE, FALSE, NULL)); + ScopedHandle callback1_called(CreateEvent(NULL, TRUE, FALSE, NULL)); + 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"; - 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)); + 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)); ASSERT_TRUE(server1.IsValid()); ASSERT_TRUE(server2.IsValid()); diff --git a/base/message_pump_win.h b/base/message_pump_win.h index af97530..ea7dd39 100644 --- a/base/message_pump_win.h +++ b/base/message_pump_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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. - win::ScopedHandle port_; + 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 90cb5d5..43ee975 100644 --- a/base/scoped_handle.h +++ b/base/scoped_handle.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -10,6 +10,10 @@ #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 new file mode 100644 index 0000000..a7c4b2e --- /dev/null +++ b/base/scoped_handle_win.h @@ -0,0 +1,9 @@ +// 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 7ca7e84..0917570 100644 --- a/base/test/test_file_util_win.cc +++ b/base/test/test_file_util_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2008 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/win/scoped_handle.h" +#include "base/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. - base::win::ScopedHandle file_handle( + 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 efbfdf9..f11f459 100644 --- a/base/win/event_trace_consumer_unittest.cc +++ b/base/win/event_trace_consumer_unittest.cc @@ -4,16 +4,14 @@ // // 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/win/event_trace_controller.h" -#include "base/win/event_trace_provider.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle.h" #include "testing/gtest/include/gtest/gtest.h" #include <initguid.h> // NOLINT - has to be last @@ -65,14 +63,14 @@ class TestConsumer: public EtwTraceConsumerBase<TestConsumer> { ::SetEvent(sank_event_.Get()); } - static base::win::ScopedHandle sank_event_; + static ScopedHandle sank_event_; static EventQueue events_; private: DISALLOW_COPY_AND_ASSIGN(TestConsumer); }; -base::win::ScopedHandle TestConsumer::sank_event_; +ScopedHandle TestConsumer::sank_event_; EventQueue TestConsumer::events_; const wchar_t* const kTestSessionName = L"TestLogSession"; @@ -177,8 +175,8 @@ class EtwTraceConsumerRealtimeTest: public testing::Test { } TestConsumer consumer_; - base::win::ScopedHandle consumer_ready_; - base::win::ScopedHandle consumer_thread_; + ScopedHandle consumer_ready_; + ScopedHandle consumer_thread_; }; } // namespace diff --git a/base/win/event_trace_controller_unittest.cc b/base/win/event_trace_controller_unittest.cc index 8eab40a..2b3cd66 100644 --- a/base/win/event_trace_controller_unittest.cc +++ b/base/win/event_trace_controller_unittest.cc @@ -1,19 +1,17 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. // // Unit tests for event trace controller. - -#include <initguid.h> // NOLINT. - +#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/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 { @@ -52,7 +50,7 @@ class TestingProvider: public EtwTraceProvider { ::SetEvent(callback_event_.Get()); } - base::win::ScopedHandle callback_event_; + ScopedHandle callback_event_; DISALLOW_COPY_AND_ASSIGN(TestingProvider); }; diff --git a/base/win/win_util.cc b/base/win/win_util.cc index 87905ea..afd16f4 100644 --- a/base/win/win_util.cc +++ b/base/win/win_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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; - base::win::ScopedHandle token_scoped(token); + 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 239bbfe..80df821 100644 --- a/ceee/common/process_utils_win.cc +++ b/ceee/common/process_utils_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. // @@ -9,23 +9,24 @@ #include <sddl.h> #include "base/logging.h" -#include "base/win/scoped_handle.h" +#include "base/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); - base::win::ScopedHandle process_token(temp_handle); + ScopedHandle process_token(temp_handle); temp_handle = NULL; if (success) { success = ::DuplicateTokenEx( process_token, MAXIMUM_ALLOWED, NULL, SecurityImpersonation, TokenImpersonation, &temp_handle); - base::win::ScopedHandle mic_token(temp_handle); + ScopedHandle mic_token(temp_handle); temp_handle = NULL; if (success) { PSID mic_sid = NULL; @@ -97,7 +98,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. - base::win::ScopedHandle process_token(temp_handle); + ScopedHandle process_token(temp_handle); TOKEN_ELEVATION_TYPE elevation_type = TokenElevationTypeDefault; DWORD variable_len_dummy = 0; if (!::GetTokenInformation(process_token, TokenElevationType, &elevation_type, @@ -330,4 +331,4 @@ void ProcessCompatibilityCheck::ResetState() { GetInstance()->StandardInitialize(); } -} // namespace process_utils_win +} // namespace com diff --git a/ceee/ie/common/chrome_frame_host.h b/ceee/ie/common/chrome_frame_host.h index 59e5c9f..4703e71 100644 --- a/ceee/ie/common/chrome_frame_host.h +++ b/ceee/ie/common/chrome_frame_host.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. // @@ -12,7 +12,7 @@ #include <list> #include "base/basictypes.h" -#include "base/win/scoped_handle.h" +#include "base/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. - base::win::ScopedHandle automating_extension_api_; + 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 61d5a47..8478825 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) 2011 The Chromium Authors. All rights reserved. +// 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. // @@ -8,7 +8,6 @@ #include <shlobj.h> #include <atlbase.h> - #include "base/command_line.h" #include "base/file_path.h" #include "base/message_loop.h" @@ -16,7 +15,6 @@ #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" @@ -161,7 +159,7 @@ class RemoteObjectHost { } void RunSync(Task* task) { - base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); + 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 92ce3b8..3e1413a 100644 --- a/chrome/browser/aeropeek_manager.cc +++ b/chrome/browser/aeropeek_manager.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -12,6 +12,7 @@ #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 8e8ba0b..f7f7f99 100644 --- a/chrome/browser/enumerate_modules_model_win.cc +++ b/chrome/browser/enumerate_modules_model_win.cc @@ -14,6 +14,7 @@ #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" @@ -22,7 +23,6 @@ #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. - base::win::ScopedHandle snap(::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, - ::GetCurrentProcessId())); + 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 b26c306..35f4ad4 100644 --- a/chrome/browser/importer/ie_importer.cc +++ b/chrome/browser/importer/ie_importer.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -27,7 +27,6 @@ #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" @@ -50,7 +49,7 @@ namespace { // Gets the creation time of the given file or directory. static Time GetFileCreationTime(const std::wstring& file) { Time creation_time; - base::win::ScopedHandle file_handle( + 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 4684fd0..d49a852 100644 --- a/chrome/browser/memory_details_win.cc +++ b/chrome/browser/memory_details_win.cc @@ -1,9 +1,8 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #include "chrome/browser/memory_details.h" - #include <psapi.h> #include "app/l10n_util.h" @@ -11,7 +10,6 @@ #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" @@ -76,8 +74,7 @@ void MemoryDetails::CollectProcessData( bool is_64bit_os = system_info.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64; - base::win::ScopedHandle snapshot( - ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); + ScopedHandle snapshot(::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0)); PROCESSENTRY32 process_entry = {sizeof(PROCESSENTRY32)}; if (!snapshot.Get()) { LOG(ERROR) << "CreateToolhelp32Snaphot failed: " << GetLastError(); @@ -89,7 +86,7 @@ void MemoryDetails::CollectProcessData( } do { base::ProcessId pid = process_entry.th32ProcessID; - base::win::ScopedHandle handle(::OpenProcess( + 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 47e28dd..a52700e 100644 --- a/chrome/browser/process_singleton_win.cc +++ b/chrome/browser/process_singleton_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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,8 +53,7 @@ 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!"); - base::win::ScopedHandle only_me( - CreateMutex(NULL, FALSE, mutex_name.c_str())); + 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 7ef622c..79ab5f7 100644 --- a/chrome/browser/tab_contents/tab_contents.h +++ b/chrome/browser/tab_contents/tab_contents.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -39,10 +39,6 @@ #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; } @@ -1284,7 +1280,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. - base::win::ScopedHandle message_box_active_; + 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 eb784a5..d30e696 100644 --- a/chrome/common/service_process_util_win.cc +++ b/chrome/common/service_process_util_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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: - base::win::ScopedHandle shutdown_event_; + 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) { - base::win::ScopedHandle shutdown_event; + 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(); - base::win::ScopedHandle event( + 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. - base::win::ScopedHandle ready_event; + 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); - base::win::ScopedHandle service_process_ready_event; + 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 8520da5..a204072 100644 --- a/chrome/installer/setup/setup_main.cc +++ b/chrome/installer/setup/setup_main.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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. - base::win::ScopedHandle scoped_handle(token); + 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 f07e703..0d3d193 100644 --- a/chrome/installer/setup/uninstall.cc +++ b/chrome/installer/setup/uninstall.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. // @@ -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); - base::win::ScopedHandle process(::OpenProcess(SYNCHRONIZE, FALSE, pid)); + 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 89ed2cb..851f188 100644 --- a/chrome/installer/util/package_unittest.cc +++ b/chrome/installer/util/package_unittest.cc @@ -1,11 +1,11 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #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,6 +16,7 @@ #include "chrome/installer/util/util_constants.h" using base::win::RegKey; +using base::win::ScopedHandle; using installer::ChromePackageProperties; using installer::ChromiumPackageProperties; using installer::Package; @@ -71,9 +72,8 @@ TEST_F(PackageTest, Basic) { // Hold on to the file exclusively to prevent the directory from // being deleted. - base::win::ScopedHandle file( - ::CreateFile(old_chrome_dll.value().c_str(), GENERIC_READ, - 0, NULL, OPEN_ALWAYS, 0, NULL)); + 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 c03b253..b6f8f27 100644 --- a/chrome/installer/util/product_unittest.cc +++ b/chrome/installer/util/product_unittest.cc @@ -1,10 +1,11 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #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" @@ -15,6 +16,7 @@ #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 f531169..859e725 100644 --- a/chrome/service/service_utility_process_host.cc +++ b/chrome/service/service_utility_process_host.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -17,10 +17,6 @@ #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), @@ -54,7 +50,7 @@ bool ServiceUtilityProcessHost::StartRenderPDFPagesToMetafile( if (!StartProcess(false, scratch_metafile_dir_->path())) return false; - base::win::ScopedHandle pdf_file( + 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 5c2c29e..2349f07 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -29,7 +29,6 @@ #if defined(OS_WIN) #include "app/win/iat_patch_function.h" -#include "base/win/scoped_handle.h" #endif namespace { @@ -205,7 +204,7 @@ bool UtilityThread::RenderPDFToWinMetafile( printing::NativeMetafile* metafile, int* highest_rendered_page_number) { *highest_rendered_page_number = -1; - base::win::ScopedHandle file(pdf_file); + 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 106b4df..9b4ef22 100644 --- a/chrome_frame/crash_reporting/minidump_test.cc +++ b/chrome_frame/crash_reporting/minidump_test.cc @@ -1,7 +1,6 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. - #include <windows.h> #include <objbase.h> #include <dbghelp.h> @@ -12,7 +11,7 @@ #include "base/file_util.h" #include "base/file_version_info.h" #include "base/logging.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.h" #include "gtest/gtest.h" namespace { @@ -278,8 +277,8 @@ class MinidumpTest: public testing::Test { } protected: - base::win::ScopedHandle dump_file_handle_; - base::win::ScopedHandle dump_file_mapping_; + ScopedHandle dump_file_handle_; + 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 eba363e..2d1f838 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) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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)); - base::win::ScopedHandle event(::CreateEvent(NULL, FALSE, FALSE, NULL)); + 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. - base::win::ScopedHandle snap( - ::CreateToolhelp32Snapshot(TH32CS_SNAPMODULE, ::GetCurrentProcessId())); + 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 51a9025..2fc8372 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) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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,8 +95,7 @@ int CloseVisibleWindowsOnAllThreads(HANDLE process) { return 0; } - base::win::ScopedHandle snapshot( - CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0)); + ScopedHandle snapshot(CreateToolhelp32Snapshot(TH32CS_SNAPTHREAD, 0)); if (!snapshot.IsValid()) { NOTREACHED(); return 0; @@ -310,7 +309,7 @@ BOOL LowIntegrityToken::Impersonate() { return ok; } - base::win::ScopedHandle process_token(process_token_handle); + ScopedHandle process_token(process_token_handle); // Create impersonation low integrity token. HANDLE impersonation_token_handle = NULL; ok = ::DuplicateTokenEx(process_token, @@ -323,7 +322,7 @@ BOOL LowIntegrityToken::Impersonate() { // TODO(stoyan): sandbox/src/restricted_token_utils.cc has // SetTokenIntegrityLevel function already. - base::win::ScopedHandle impersonation_token(impersonation_token_handle); + ScopedHandle impersonation_token(impersonation_token_handle); PSID integrity_sid = NULL; TOKEN_MANDATORY_LABEL tml = {0}; ok = ::ConvertStringSidToSid(SDDL_ML_LOW, &integrity_sid); @@ -541,7 +540,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(); - base::win::ScopedHandle new_pipe; + 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 13959dc..f052cf4 100644 --- a/chrome_frame/test/dll_redirector_test.cc +++ b/chrome_frame/test/dll_redirector_test.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #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,6 +27,8 @@ 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) @@ -229,8 +231,8 @@ TEST_F(DllRedirectorTest, TestBeaconOwnershipHandoff) { } struct LockSquattingThreadParams { - base::win::ScopedHandle is_squatting; - base::win::ScopedHandle time_to_die; + ScopedHandle is_squatting; + ScopedHandle time_to_die; }; DWORD WINAPI LockSquattingThread(void* in_params) { @@ -266,7 +268,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; - base::win::ScopedHandle lock_squat_thread( + 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 c570558..1649e2a 100644 --- a/chrome_frame/test/ie_event_sink.cc +++ b/chrome_frame/test/ie_event_sink.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #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,8 +147,9 @@ void IEEventSink::Uninitialize() { web_browser2_->Quit(); } - base::win::ScopedHandle process; - process.Set(OpenProcess(SYNCHRONIZE, FALSE, ie_process_id_)); + 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 ca30329..0cb72d1 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) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -21,7 +21,6 @@ #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" @@ -280,7 +279,7 @@ void CFUrlRequestUnittestRunner::StartChromeFrameInHostBrowser() { kTestServerPort).c_str()); // Launch IE. This launches IE correctly on Vista too. - base::win::ScopedHandle ie_process(chrome_frame_test::LaunchIE(url)); + 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 9b9842c..ea7cb6b 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) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 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: - base::win::ScopedHandle test_thread_; + 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 23073e3e..9040e22 100644 --- a/chrome_frame/test/test_server_test.cc +++ b/chrome_frame/test/test_server_test.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -7,7 +7,7 @@ #include "base/basictypes.h" #include "base/path_service.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.h" #include "chrome_frame/test/test_server.h" #include "net/base/cookie_monster.h" #include "net/base/host_resolver_proc.h" @@ -192,8 +192,7 @@ TEST_F(TestServerTest, TestServer) { UrlTaskChain goog_task("http://localhost:1337/goog", &file_task); DWORD tid = 0; - base::win::ScopedHandle worker(::CreateThread( - NULL, 0, FetchUrl, &goog_task, 0, &tid)); + 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 eaecbef..3b424f3 100644 --- a/chrome_frame/test/test_with_web_server.h +++ b/chrome_frame/test/test_with_web_server.h @@ -1,10 +1,9 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #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> @@ -12,7 +11,6 @@ #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" @@ -218,7 +216,7 @@ class ChromeFrameTestWithWebServer: public testing::Test { BrowserKind browser_; FilePath results_dir_; - base::win::ScopedHandle browser_handle_; + 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 b27b90d..4e9c29b9 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) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2009 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,7 +6,6 @@ #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" @@ -83,7 +82,7 @@ class RunTestServer : public base::Thread { protected: scoped_ptr<test_server::SimpleWebServer> server_; test_server::SimpleResponse default_response_; - base::win::ScopedHandle ready_; + 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 65b172d..d146079 100644 --- a/chrome_frame/test_utils.cc +++ b/chrome_frame/test_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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 - base::win::ScopedHandle process_handle(::OpenProcess( - PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, - false, - process_id)); + 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 842a32a..4e04796 100644 --- a/chrome_frame/vtable_patch_manager_unittest.cc +++ b/chrome_frame/vtable_patch_manager_unittest.cc @@ -1,14 +1,12 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #include "chrome_frame/vtable_patch_manager.h" - #include <unknwn.h> - #include "base/message_loop.h" #include "base/threading/thread.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle.h" #include "gtest/gtest.h" #include "gmock/gmock.h" @@ -211,7 +209,7 @@ TEST_F(VtablePatchManagerTest, ThreadSafePatching) { base::Thread background("Background Test Thread"); EXPECT_TRUE(background.Start()); - base::win::ScopedHandle event(::CreateEvent(NULL, TRUE, FALSE, NULL)); + 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 cabc505..6a4e51c 100644 --- a/gfx/icon_util.cc +++ b/gfx/icon_util.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -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. - base::win::ScopedHandle icon_file(::CreateFile(icon_path.value().c_str(), + 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 f549d34..ee58701 100644 --- a/ipc/ipc_channel_win.cc +++ b/ipc/ipc_channel_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -13,7 +13,6 @@ #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" @@ -30,7 +29,7 @@ bool GetLogonSessionOnlyDACL(SECURITY_DESCRIPTOR** security_descriptor) { HANDLE token = NULL; if (!::OpenProcessToken(::GetCurrentProcess(), TOKEN_QUERY, &token)) return false; - base::win::ScopedHandle token_scoped(token); + 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 5cc8913..7dd4781 100644 --- a/media/audio/win/wavein_input_win.h +++ b/media/audio/win/wavein_input_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -9,7 +9,7 @@ #include <mmsystem.h> #include "base/basictypes.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.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. - base::win::ScopedHandle stopped_event_; + 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 74717a0..651c9d2 100644 --- a/media/audio/win/waveout_output_win.h +++ b/media/audio/win/waveout_output_win.h @@ -1,17 +1,16 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #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/win/scoped_handle.h" +#include "base/scoped_handle_win.h" #include "media/audio/audio_io.h" #include "media/audio/audio_parameters.h" @@ -111,7 +110,7 @@ class PCMWaveOutAudioOutputStream : public AudioOutputStream { WAVEHDR* buffer_; // An event that is signaled when the callback thread is ready to stop. - base::win::ScopedHandle stopped_event_; + 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 05f17f6..eaa00eb 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-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. @@ -20,10 +20,6 @@ #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. @@ -1933,8 +1929,8 @@ TEST_F(DiskCacheBackendTest, FileSharing) { #if defined(OS_WIN) DWORD sharing = FILE_SHARE_READ | FILE_SHARE_WRITE; DWORD access = GENERIC_READ | GENERIC_WRITE; - base::win::ScopedHandle file2(CreateFile( - name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL)); + 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 65fc064..cbe6b87 100644 --- a/net/disk_cache/cache_util_win.cc +++ b/net/disk_cache/cache_util_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-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. @@ -6,10 +6,9 @@ #include <windows.h> -#include "base/file_util.h" #include "base/logging.h" #include "base/message_loop.h" -#include "base/win/scoped_handle.h" +#include "base/file_util.h" namespace { @@ -67,8 +66,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; - base::win::ScopedHandle file(CreateFile( - name.value().c_str(), access, sharing, NULL, OPEN_EXISTING, 0, NULL)); + 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 6d93fc8..9686aef 100644 --- a/net/test/test_server.h +++ b/net/test/test_server.h @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -20,7 +20,7 @@ #include "net/base/net_util.h" #if defined(OS_WIN) -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.h" #endif class CommandLine; @@ -177,13 +177,13 @@ class TestServer { #if defined(OS_WIN) // JobObject used to clean up orphaned child processes. - base::win::ScopedHandle job_handle_; + ScopedHandle job_handle_; // The pipe file handle we read from. - base::win::ScopedHandle child_read_fd_; + ScopedHandle child_read_fd_; // The pipe file handle the child and we write to. - base::win::ScopedHandle child_write_fd_; + 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 9fc13cd..075b484 100644 --- a/net/test/test_server_win.cc +++ b/net/test/test_server_win.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -17,7 +17,6 @@ #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") @@ -26,7 +25,7 @@ namespace { bool LaunchTestServerAsJob(const CommandLine& cmdline, bool start_hidden, base::ProcessHandle* process_handle, - base::win::ScopedHandle* job_handle) { + ScopedHandle* job_handle) { // Launch test server process. STARTUPINFO startup_info = {0}; startup_info.cb = sizeof(startup_info); @@ -192,8 +191,8 @@ bool TestServer::LaunchPython(const FilePath& testserver_path) { } bool TestServer::WaitToStart() { - base::win::ScopedHandle read_fd(child_read_fd_.Take()); - base::win::ScopedHandle write_fd(child_write_fd_.Take()); + ScopedHandle read_fd(child_read_fd_.Take()); + 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 53dd121..3561fb7 100644 --- a/net/tools/dump_cache/dump_cache.cc +++ b/net/tools/dump_cache/dump_cache.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -11,9 +11,10 @@ #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 { @@ -155,7 +156,7 @@ int main(int argc, const char* argv[]) { if (command_line.HasSwitch(kSlave) && slave_required) return RunSlave(input_path, pipe_number); - base::win::ScopedHandle server; + 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 7b86237..fae924c 100644 --- a/net/tools/dump_cache/upgrade.cc +++ b/net/tools/dump_cache/upgrade.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -9,7 +9,6 @@ #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" @@ -913,7 +912,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); - base::win::ScopedHandle pipe(OpenServer(pipe_number)); + 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 4312b2c..edef14a 100644 --- a/printing/emf_win_unittest.cc +++ b/printing/emf_win_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -12,6 +12,7 @@ #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 df1e903..2abf6e2 100644 --- a/sandbox/src/file_policy_test.cc +++ b/sandbox/src/file_policy_test.cc @@ -1,14 +1,13 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. - #include <algorithm> #include <cctype> #include <windows.h> #include <winioctl.h> -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.h" #include "sandbox/src/nt_internals.h" #include "sandbox/src/sandbox.h" #include "sandbox/src/sandbox_factory.h" @@ -36,20 +35,19 @@ SBOX_TESTS_COMMAND int File_Create(int argc, wchar_t **argv) { bool read = (_wcsicmp(argv[0], L"Read") == 0); if (read) { - 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)); + 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)); if (file1.Get() && file2.Get()) return SBOX_TEST_SUCCEEDED; return SBOX_TEST_DENIED; } else { - 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)); + 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)); if (file1.Get() && file2.Get()) return SBOX_TEST_SUCCEEDED; diff --git a/sandbox/src/filesystem_policy.cc b/sandbox/src/filesystem_policy.cc index 385f4ae..2a15555 100644 --- a/sandbox/src/filesystem_policy.cc +++ b/sandbox/src/filesystem_policy.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-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. @@ -7,7 +7,7 @@ #include "sandbox/src/filesystem_policy.h" #include "base/logging.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.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; } - base::win::ScopedHandle handle(local_handle); + 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 8681671..0fbf204 100644 --- a/sandbox/src/process_policy_test.cc +++ b/sandbox/src/process_policy_test.cc @@ -1,17 +1,17 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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 <memory> #include <string> +#include <memory> -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.h" +#include "testing/gtest/include/gtest/gtest.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; } - base::win::ScopedHandle process(pi.hProcess); - base::win::ScopedHandle thread(pi.hThread); + ScopedHandle process(pi.hProcess); + ScopedHandle thread(pi.hThread); HANDLE token = NULL; BOOL result = ::OpenProcessToken(process.Get(), TOKEN_IMPERSONATE, &token); DWORD error = ::GetLastError(); - base::win::ScopedHandle token_handle(token); + 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 f86c76a..5f53770 100644 --- a/sandbox/src/registry_dispatcher.cc +++ b/sandbox/src/registry_dispatcher.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #include "sandbox/src/registry_dispatcher.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.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) { - base::win::ScopedHandle root_handle; + 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) { - base::win::ScopedHandle root_handle; + 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 b036e51..8842865 100644 --- a/sandbox/src/restricted_token_utils.cc +++ b/sandbox/src/restricted_token_utils.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. @@ -9,7 +9,7 @@ #include "sandbox/src/restricted_token_utils.h" #include "base/logging.h" -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.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; } - base::win::ScopedHandle primary_token(primary_token_handle); + 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; } - base::win::ScopedHandle impersonation_token(impersonation_token_handle); + 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(); } - base::win::ScopedHandle thread_handle(process_info.hThread); - base::win::ScopedHandle process_handle(process_info.hProcess); + ScopedHandle thread_handle(process_info.hThread); + 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,9 +335,10 @@ DWORD SetProcessIntegrityLevel(IntegrityLevel integrity_level) { &token_handle)) return ::GetLastError(); - base::win::ScopedHandle token(token_handle); + 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 3c87243..835a578 100644 --- a/sandbox/src/sync_policy_test.cc +++ b/sandbox/src/sync_policy_test.cc @@ -1,14 +1,14 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2006-2008 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/win/scoped_handle.h" +#include "base/scoped_handle_win.h" +#include "testing/gtest/include/gtest/gtest.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,8 +20,7 @@ SBOX_TESTS_COMMAND int Event_Open(int argc, wchar_t **argv) { if (L'f' == argv[0][0]) desired_access = EVENT_ALL_ACCESS; - base::win::ScopedHandle event_open(::OpenEvent( - desired_access, FALSE, argv[1])); + ScopedHandle event_open(::OpenEvent(desired_access, FALSE, argv[1])); DWORD error_open = ::GetLastError(); if (event_open.Get()) @@ -49,10 +48,10 @@ SBOX_TESTS_COMMAND int Event_CreateOpen(int argc, wchar_t **argv) { if (L't' == argv[1][0]) initial_state = TRUE; - base::win::ScopedHandle event_create(::CreateEvent( - NULL, manual_reset, initial_state, event_name)); + ScopedHandle event_create(::CreateEvent(NULL, manual_reset, initial_state, + event_name)); DWORD error_create = ::GetLastError(); - base::win::ScopedHandle event_open; + ScopedHandle event_open; if (event_name) event_open.Set(::OpenEvent(EVENT_ALL_ACCESS, FALSE, event_name)); @@ -125,10 +124,10 @@ TEST(SyncPolicyTest, TestEventReadOnly) { TargetPolicy::EVENTS_ALLOW_READONLY, L"test6")); - 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")); + 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")); 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 a50f1aa..063f43f 100644 --- a/sandbox/src/unload_dll_test.cc +++ b/sandbox/src/unload_dll_test.cc @@ -1,13 +1,13 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.h" +#include "testing/gtest/include/gtest/gtest.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; - base::win::ScopedHandle event_open(::OpenEvent(SYNCHRONIZE, FALSE, argv[0])); + ScopedHandle event_open(::OpenEvent(SYNCHRONIZE, FALSE, argv[0])); return event_open.Get() ? SBOX_TEST_SUCCEEDED : SBOX_TEST_FAILED; } @@ -73,8 +73,7 @@ TEST(UnloadDllTest, FLAKY_UnloadAviCapDllWithPatching) { sandbox::TargetPolicy* policy = runner.GetPolicy(); policy->AddDllToUnload(L"avicap32.dll"); - base::win::ScopedHandle handle1(::CreateEvent( - NULL, FALSE, FALSE, L"tst0001")); + 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 0f445ef..99ce7e2 100644 --- a/sandbox/src/win_utils_unittest.cc +++ b/sandbox/src/win_utils_unittest.cc @@ -1,10 +1,10 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// 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. #include <windows.h> -#include "base/win/scoped_handle.h" +#include "base/scoped_handle_win.h" #include "sandbox/src/win_utils.h" #include "sandbox/tests/common/test_utils.h" #include "testing/gtest/include/gtest/gtest.h" @@ -67,9 +67,8 @@ 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; - base::win::ScopedHandle file(CreateFile( - file_name.c_str(), GENERIC_WRITE, kSharing, NULL, CREATE_ALWAYS, - FILE_FLAG_DELETE_ON_CLOSE, NULL)); + 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; |