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

Side by Side Diff: tools/memory_watcher/hotkey.h

Issue 314253003: Remove memory_watcher tool as well as --memory-profile command line flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile issue on non-ChromeOS platforms Created 6 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
« no previous file with comments | « tools/memory_watcher/dllmain.cc ('k') | tools/memory_watcher/ia32_modrm_map.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) 2009 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 TOOLS_MEMORY_WATCHER_HOTKEY_H_
6 #define TOOLS_MEMORY_WATCHER_HOTKEY_H_
7
8 #include "ui/gfx/rect.h"
9 #include "ui/gfx/win/msg_util.h"
10 #include "ui/gfx/win/window_impl.h"
11
12 // HotKey handler.
13 // Programs wishing to register a hotkey can use this.
14 class HotKeyHandler : public gfx::WindowImpl {
15 public:
16 HotKeyHandler(UINT modifiers, UINT vk)
17 : modifiers_(modifiers),
18 vkey_(vk) {
19 Start();
20 }
21 ~HotKeyHandler() { Stop(); }
22
23 CR_BEGIN_MSG_MAP_EX(HotKeyHandler)
24 CR_MSG_WM_HOTKEY(OnHotKey)
25 CR_END_MSG_MAP()
26
27 private:
28 static const int hotkey_id = 0x0000baba;
29
30 bool Start() {
31 set_window_style(WS_POPUP);
32 Init(NULL, gfx::Rect());
33 return RegisterHotKey(hwnd(), hotkey_id, modifiers_, vkey_) == TRUE;
34 }
35
36 void Stop() {
37 UnregisterHotKey(hwnd(), hotkey_id);
38 DestroyWindow(hwnd());
39 }
40
41 // Handle the registered Hotkey being pressed.
42 virtual void OnHotKey(UINT /*uMsg*/,
43 WPARAM /*wParam*/,
44 LPARAM /*lParam*/) = 0;
45
46 UINT modifiers_;
47 UINT vkey_;
48 };
49
50 #endif // TOOLS_MEMORY_WATCHER_HOTKEY_H_
OLDNEW
« no previous file with comments | « tools/memory_watcher/dllmain.cc ('k') | tools/memory_watcher/ia32_modrm_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698