summaryrefslogtreecommitdiffstats
path: root/chrome/app/scoped_ole_initializer.h
diff options
context:
space:
mode:
authorpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-09 20:28:44 +0000
committerpinkerton@google.com <pinkerton@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-09 20:28:44 +0000
commita1a130f7da9191abecf15b3c27e2aa7ee1faacb3 (patch)
tree3a9c6ad25ec53f05a4380ffac1a7932f66107a0d /chrome/app/scoped_ole_initializer.h
parentfd26b925c589b600c7d12f55554ad1097bad6b87 (diff)
downloadchromium_src-a1a130f7da9191abecf15b3c27e2aa7ee1faacb3.zip
chromium_src-a1a130f7da9191abecf15b3c27e2aa7ee1faacb3.tar.gz
chromium_src-a1a130f7da9191abecf15b3c27e2aa7ee1faacb3.tar.bz2
remove chrome dependencies from win sandboxing headers. Wrap sandbox code to
make the main routine a little cleaner. Unify the parameters of each of the "main" entry points so we can more easily abstract platform differences in the future. BUG=5323 Review URL: http://codereview.chromium.org/17426 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7825 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/app/scoped_ole_initializer.h')
-rw-r--r--chrome/app/scoped_ole_initializer.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/chrome/app/scoped_ole_initializer.h b/chrome/app/scoped_ole_initializer.h
new file mode 100644
index 0000000..85e47a5
--- /dev/null
+++ b/chrome/app/scoped_ole_initializer.h
@@ -0,0 +1,36 @@
+// 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_APP_SCOPED_OLE_INITIALIZER_H_
+#define CHROME_APP_SCOPED_OLE_INITIALIZER_H_
+
+// Wraps OLE initialization in a cross-platform class meant to be used on the
+// stack so init/uninit is done with scoping. This class is ok for use by
+// non-windows platforms; it just doesn't do anything.
+
+#if defined(OS_WIN)
+
+class ScopedOleInitializer {
+ public:
+ ScopedOleInitializer() {
+ int ole_result = OleInitialize(NULL);
+ DCHECK(ole_result == S_OK);
+ }
+ ~ScopedOleInitializer() {
+ OleUninitialize();
+ }
+};
+
+#else
+
+class ScopedOleInitializer {
+ public:
+ // Empty, this class does nothing on non-win32 systems. Empty ctor is
+ // necessary to avoid "unused variable" warning on gcc.
+ ScopedOleInitializer() { }
+};
+
+#endif
+
+#endif // CHROME_APP_SCOPED_OLE_INITIALIZER_H_