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

Side by Side Diff: base/win/scoped_com_initializer.h

Issue 7265009: Revert 90464 - Move app/win/* files to base/win/, ui/base/win and chrome/common/ directories. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « base/win/iat_patch_function.cc ('k') | chrome/browser/aeropeek_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BASE_WIN_SCOPED_COM_INITIALIZER_H_
6 #define BASE_WIN_SCOPED_COM_INITIALIZER_H_
7 #pragma once
8
9 #include "base/basictypes.h"
10 #include "build/build_config.h"
11
12 #if defined(OS_WIN)
13
14 #include <objbase.h>
15
16 namespace base {
17 namespace win {
18
19 // Initializes COM in the constructor (STA), and uninitializes COM in the
20 // destructor.
21 class ScopedCOMInitializer {
22 public:
23 ScopedCOMInitializer() : hr_(CoInitialize(NULL)) {
24 }
25
26 ScopedCOMInitializer::~ScopedCOMInitializer() {
27 if (SUCCEEDED(hr_))
28 CoUninitialize();
29 }
30
31 private:
32 HRESULT hr_;
33
34 DISALLOW_COPY_AND_ASSIGN(ScopedCOMInitializer);
35 };
36
37 } // namespace win
38 } // namespace base
39
40 #else
41
42 namespace base {
43 namespace win {
44
45 // Do-nothing class for other platforms.
46 class ScopedCOMInitializer {
47 public:
48 ScopedCOMInitializer() {}
49 ~ScopedCOMInitializer() {}
50
51 private:
52 DISALLOW_COPY_AND_ASSIGN(ScopedCOMInitializer);
53 };
54
55 } // namespace win
56 } // namespace base
57
58 #endif
59
60 #endif // BASE_WIN_SCOPED_COM_INITIALIZER_H_
OLDNEW
« no previous file with comments | « base/win/iat_patch_function.cc ('k') | chrome/browser/aeropeek_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698