summaryrefslogtreecommitdiffstats
path: root/base/scoped_native_library.h
diff options
context:
space:
mode:
authorhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 06:23:35 +0000
committerhbono@chromium.org <hbono@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-10 06:23:35 +0000
commitda2566e16fff66dd911994e17d649e478a7beea1 (patch)
treedcc1cc71232331e2d8c4dbe2173da7bc9119a496 /base/scoped_native_library.h
parentf988638e6ea5a3f16e289be9ac7ffd853f7a13e4 (diff)
downloadchromium_src-da2566e16fff66dd911994e17d649e478a7beea1.zip
chromium_src-da2566e16fff66dd911994e17d649e478a7beea1.tar.gz
chromium_src-da2566e16fff66dd911994e17d649e478a7beea1.tar.bz2
Implements AeroPeek of Windows 7.
This change integrates the custom AeroPeek implementation into Chromium, which shows the thumbnail list of all tabs and the preview image of the tab selected from the thumbnail list. It uses the AeroPeekManager object, which is a proxy between TabStripModel and Windows to translate events from TabStripModel for Windows, and vice versa. To listen events from TabStripModel without changing the existing part of Chromium, this AeroPeekManager class implements the TabStripModelObserver interface. Even though this change doesn't include any automated tests for AeroPeek, I would like to send its automated UI test as a separate change. Nevertheless, it just creates/deletes a tab and see this AeroPeekManager can create its thumbnail window correctly. BUG=6337 TEST=base_unittests.exe --gtest_filter=ScopedNativeLibrary.Basic Review URL: http://codereview.chromium.org/303033 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41133 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/scoped_native_library.h')
-rw-r--r--base/scoped_native_library.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/base/scoped_native_library.h b/base/scoped_native_library.h
new file mode 100644
index 0000000..e2609f4
--- /dev/null
+++ b/base/scoped_native_library.h
@@ -0,0 +1,39 @@
+// 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 BASE_SCOPED_NATIVE_LIBRARY_H_
+#define BASE_SCOPED_NATIVE_LIBRARY_H_
+
+#include "base/file_path.h"
+#include "base/native_library.h"
+
+namespace base {
+
+// A class which encapsulates a base::NativeLibrary object available only in a
+// scope.
+// This class automatically unloads the loaded library in its destructor.
+class ScopedNativeLibrary {
+ public:
+ explicit ScopedNativeLibrary(const FilePath& library_path) {
+ library_ = base::LoadNativeLibrary(library_path);
+ }
+
+ ~ScopedNativeLibrary() {
+ if (library_)
+ base::UnloadNativeLibrary(library_);
+ }
+
+ void* GetFunctionPointer(const char* function_name) {
+ if (!library_)
+ return NULL;
+ return base::GetFunctionPointerFromNativeLibrary(library_, function_name);
+ }
+
+ private:
+ base::NativeLibrary library_;
+};
+
+} // namespace base
+
+#endif // BASE_SCOPED_NATIVE_LIBRARY_H_