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

Side by Side Diff: views/controls/scrollbar/native_scroll_bar_win.cc

Issue 3361003: Revert 58215 - Revert 58186 - Move the keyboard files from base/ to app/.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "views/controls/scrollbar/native_scroll_bar_win.h" 5 #include "views/controls/scrollbar/native_scroll_bar_win.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/keyboard_codes.h" 10 #include "app/keyboard_codes.h"
11 #include "base/message_loop.h" 11 #include "base/message_loop.h"
12 #include "gfx/window_impl.h" 12 #include "gfx/window_impl.h"
13 #include "views/controls/scrollbar/native_scroll_bar.h" 13 #include "views/controls/scrollbar/native_scroll_bar.h"
14 #include "views/controls/scrollbar/scroll_bar.h" 14 #include "views/controls/scrollbar/scroll_bar.h"
15 #include "views/widget/widget.h" 15 #include "views/widget/widget.h"
16 16
17 namespace views { 17 namespace views {
18 18
19 ///////////////////////////////////////////////////////////////////////////// 19 /////////////////////////////////////////////////////////////////////////////
20 // 20 //
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 if (native_scroll_bar_->IsHorizontal()) 224 if (native_scroll_bar_->IsHorizontal())
225 return gfx::Size(0, GetHorizontalScrollBarHeight()); 225 return gfx::Size(0, GetHorizontalScrollBarHeight());
226 return gfx::Size(GetVerticalScrollBarWidth(), 0); 226 return gfx::Size(GetVerticalScrollBarWidth(), 0);
227 } 227 }
228 228
229 bool NativeScrollBarWin::OnKeyPressed(const KeyEvent& event) { 229 bool NativeScrollBarWin::OnKeyPressed(const KeyEvent& event) {
230 if (!sb_container_.get()) 230 if (!sb_container_.get())
231 return false; 231 return false;
232 int code = -1; 232 int code = -1;
233 switch (event.GetKeyCode()) { 233 switch (event.GetKeyCode()) {
234 case base::VKEY_UP: 234 case app::VKEY_UP:
235 if (!native_scroll_bar_->IsHorizontal()) 235 if (!native_scroll_bar_->IsHorizontal())
236 code = SB_LINEUP; 236 code = SB_LINEUP;
237 break; 237 break;
238 case base::VKEY_PRIOR: 238 case app::VKEY_PRIOR:
239 code = SB_PAGEUP; 239 code = SB_PAGEUP;
240 break; 240 break;
241 case base::VKEY_NEXT: 241 case app::VKEY_NEXT:
242 code = SB_PAGEDOWN; 242 code = SB_PAGEDOWN;
243 break; 243 break;
244 case base::VKEY_DOWN: 244 case app::VKEY_DOWN:
245 if (!native_scroll_bar_->IsHorizontal()) 245 if (!native_scroll_bar_->IsHorizontal())
246 code = SB_LINEDOWN; 246 code = SB_LINEDOWN;
247 break; 247 break;
248 case base::VKEY_HOME: 248 case app::VKEY_HOME:
249 code = SB_TOP; 249 code = SB_TOP;
250 break; 250 break;
251 case base::VKEY_END: 251 case app::VKEY_END:
252 code = SB_BOTTOM; 252 code = SB_BOTTOM;
253 break; 253 break;
254 case base::VKEY_LEFT: 254 case app::VKEY_LEFT:
255 if (native_scroll_bar_->IsHorizontal()) 255 if (native_scroll_bar_->IsHorizontal())
256 code = SB_LINELEFT; 256 code = SB_LINELEFT;
257 break; 257 break;
258 case base::VKEY_RIGHT: 258 case app::VKEY_RIGHT:
259 if (native_scroll_bar_->IsHorizontal()) 259 if (native_scroll_bar_->IsHorizontal())
260 code = SB_LINERIGHT; 260 code = SB_LINERIGHT;
261 break; 261 break;
262 } 262 }
263 if (code != -1) { 263 if (code != -1) {
264 SendMessage(sb_container_->hwnd(), 264 SendMessage(sb_container_->hwnd(),
265 native_scroll_bar_->IsHorizontal() ? WM_HSCROLL : WM_VSCROLL, 265 native_scroll_bar_->IsHorizontal() ? WM_HSCROLL : WM_VSCROLL,
266 MAKELONG(static_cast<WORD>(code), 0), 0L); 266 MAKELONG(static_cast<WORD>(code), 0), 0L);
267 return true; 267 return true;
268 } 268 }
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() { 340 int NativeScrollBarWrapper::GetHorizontalScrollBarHeight() {
341 return GetSystemMetrics(SM_CYHSCROLL); 341 return GetSystemMetrics(SM_CYHSCROLL);
342 } 342 }
343 343
344 // static 344 // static
345 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() { 345 int NativeScrollBarWrapper::GetVerticalScrollBarWidth() {
346 return GetSystemMetrics(SM_CXVSCROLL); 346 return GetSystemMetrics(SM_CXVSCROLL);
347 } 347 }
348 348
349 } // namespace views 349 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/scrollbar/native_scroll_bar_gtk.cc ('k') | views/controls/tabbed_pane/tabbed_pane.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698