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

Side by Side Diff: webkit/plugins/npapi/webplugin_delegate_impl_win.cc

Issue 7978050: Don't cache keystate if not blocked by UIPI (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/plugins/npapi/webplugin_delegate_impl.h" 5 #include "webkit/plugins/npapi/webplugin_delegate_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 99
100 bool GetSavedKeyState(WPARAM vkey) { 100 bool GetSavedKeyState(WPARAM vkey) {
101 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state)); 101 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state));
102 if (g_saved_key_state[vkey / kBitsPerType] & 1 << (vkey % kBitsPerType)) 102 if (g_saved_key_state[vkey / kBitsPerType] & 1 << (vkey % kBitsPerType))
103 return true; 103 return true;
104 return false; 104 return false;
105 } 105 }
106 106
107 void SetSavedKeyState(WPARAM vkey) { 107 void SetSavedKeyState(WPARAM vkey) {
108 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state)); 108 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state));
109 g_saved_key_state[vkey / kBitsPerType] |= 1 << (vkey % kBitsPerType); 109 // Cache the key state only for keys blocked by UIPI.
110 if (g_iat_orig_get_key_state(vkey) == 0)
111 g_saved_key_state[vkey / kBitsPerType] |= 1 << (vkey % kBitsPerType);
110 } 112 }
111 113
112 void UnsetSavedKeyState(WPARAM vkey) { 114 void UnsetSavedKeyState(WPARAM vkey) {
113 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state)); 115 CHECK_LT(vkey, kBitsPerType * sizeof(g_saved_key_state));
114 g_saved_key_state[vkey / kBitsPerType] &= ~(1 << (vkey % kBitsPerType)); 116 g_saved_key_state[vkey / kBitsPerType] &= ~(1 << (vkey % kBitsPerType));
115 } 117 }
116 118
117 void ClearSavedKeyState() { 119 void ClearSavedKeyState() {
118 memset(g_saved_key_state, 0, sizeof(g_saved_key_state)); 120 memset(g_saved_key_state, 0, sizeof(g_saved_key_state));
119 } 121 }
(...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after
1515 ::ReleaseCapture(); 1517 ::ReleaseCapture();
1516 break; 1518 break;
1517 1519
1518 default: 1520 default:
1519 break; 1521 break;
1520 } 1522 }
1521 } 1523 }
1522 1524
1523 } // namespace npapi 1525 } // namespace npapi
1524 } // namespace webkit 1526 } // namespace webkit
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698