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

Side by Side Diff: ui/views/widget/root_view.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 7 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 | « ui/views/view.cc ('k') | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/widget/root_view.h" 5 #include "ui/views/widget/root_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 // Input ----------------------------------------------------------------------- 110 // Input -----------------------------------------------------------------------
111 111
112 void RootView::DispatchKeyEvent(ui::KeyEvent* event) { 112 void RootView::DispatchKeyEvent(ui::KeyEvent* event) {
113 View* v = NULL; 113 View* v = NULL;
114 if (GetFocusManager()) // NULL in unittests. 114 if (GetFocusManager()) // NULL in unittests.
115 v = GetFocusManager()->GetFocusedView(); 115 v = GetFocusManager()->GetFocusedView();
116 // Special case to handle right-click context menus triggered by the 116 // Special case to handle right-click context menus triggered by the
117 // keyboard. 117 // keyboard.
118 if (v && v->enabled() && ((event->key_code() == ui::VKEY_APPS) || 118 if (v && v->enabled() && ((event->key_code() == ui::VKEY_APPS) ||
119 (event->key_code() == ui::VKEY_F10 && event->IsShiftDown()))) { 119 (event->key_code() == ui::VKEY_F10 && event->IsShiftDown()))) {
120 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(), false); 120 v->ShowContextMenu(v->GetKeyboardContextMenuLocation(),
121 ui::MENU_SOURCE_KEYBOARD);
121 event->StopPropagation(); 122 event->StopPropagation();
122 return; 123 return;
123 } 124 }
124 125
125 for (; v && v != this && !event->handled(); v = v->parent()) 126 for (; v && v != this && !event->handled(); v = v->parent())
126 DispatchEventToTarget(v, event); 127 DispatchEventToTarget(v, event);
127 } 128 }
128 129
129 void RootView::DispatchScrollEvent(ui::ScrollEvent* event) { 130 void RootView::DispatchScrollEvent(ui::ScrollEvent* event) {
130 for (View* v = GetEventHandlerForPoint(event->location()); 131 for (View* v = GetEventHandlerForPoint(event->location());
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 DispatchEventToTarget(p, &notify_event); 684 DispatchEventToTarget(p, &notify_event);
684 } 685 }
685 } 686 }
686 687
687 bool RootView::CanDispatchToTarget(ui::EventTarget* target) { 688 bool RootView::CanDispatchToTarget(ui::EventTarget* target) {
688 return event_dispatch_target_ == target; 689 return event_dispatch_target_ == target;
689 } 690 }
690 691
691 } // namespace internal 692 } // namespace internal
692 } // namespace views 693 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/view.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698