OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/menu/menu_controller.h" | 5 #include "views/controls/menu/menu_controller.h" |
6 | 6 |
7 #include "app/gfx/canvas.h" | 7 #include "app/gfx/canvas.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/os_exchange_data.h" | 9 #include "app/os_exchange_data.h" |
10 #include "base/keyboard_codes.h" | 10 #include "base/keyboard_codes.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 // static | 135 // static |
136 MenuController* MenuController::GetActiveInstance() { | 136 MenuController* MenuController::GetActiveInstance() { |
137 return active_instance_; | 137 return active_instance_; |
138 } | 138 } |
139 | 139 |
140 #ifdef DEBUG_MENU | 140 #ifdef DEBUG_MENU |
141 static int instance_count = 0; | 141 static int instance_count = 0; |
142 static int nested_depth = 0; | 142 static int nested_depth = 0; |
143 #endif | 143 #endif |
144 | 144 |
145 MenuItemView* MenuController::Run(gfx::NativeView parent, | 145 MenuItemView* MenuController::Run(gfx::NativeWindow parent, |
146 MenuItemView* root, | 146 MenuItemView* root, |
147 const gfx::Rect& bounds, | 147 const gfx::Rect& bounds, |
148 MenuItemView::AnchorPosition position, | 148 MenuItemView::AnchorPosition position, |
149 int* result_mouse_event_flags) { | 149 int* result_mouse_event_flags) { |
150 exit_all_ = false; | 150 exit_all_ = false; |
151 possible_drag_ = false; | 151 possible_drag_ = false; |
152 | 152 |
153 bool nested_menu = showing_; | 153 bool nested_menu = showing_; |
154 if (showing_) { | 154 if (showing_) { |
155 // Only support nesting of blocking_run menus, nesting of | 155 // Only support nesting of blocking_run menus, nesting of |
(...skipping 1166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1322 HWND window = WindowFromPoint(screen_loc.ToPOINT()); | 1322 HWND window = WindowFromPoint(screen_loc.ToPOINT()); |
1323 if (window) { | 1323 if (window) { |
1324 #ifdef DEBUG_MENU | 1324 #ifdef DEBUG_MENU |
1325 DLOG(INFO) << "RepostEvent on press"; | 1325 DLOG(INFO) << "RepostEvent on press"; |
1326 #endif | 1326 #endif |
1327 | 1327 |
1328 // Release the capture. | 1328 // Release the capture. |
1329 SubmenuView* submenu = state_.item->GetRootMenuItem()->GetSubmenu(); | 1329 SubmenuView* submenu = state_.item->GetRootMenuItem()->GetSubmenu(); |
1330 submenu->ReleaseCapture(); | 1330 submenu->ReleaseCapture(); |
1331 | 1331 |
1332 if (submenu->native_view() && submenu->native_view() && | 1332 if (submenu->native_window() && submenu->native_window() && |
1333 GetWindowThreadProcessId(submenu->native_view(), NULL) != | 1333 GetWindowThreadProcessId(submenu->native_window(), NULL) != |
1334 GetWindowThreadProcessId(window, NULL)) { | 1334 GetWindowThreadProcessId(window, NULL)) { |
1335 // Even though we have mouse capture, windows generates a mouse event | 1335 // Even though we have mouse capture, windows generates a mouse event |
1336 // if the other window is in a separate thread. Don't generate an event in | 1336 // if the other window is in a separate thread. Don't generate an event in |
1337 // this case else the target window can get double events leading to bad | 1337 // this case else the target window can get double events leading to bad |
1338 // behavior. | 1338 // behavior. |
1339 return; | 1339 return; |
1340 } | 1340 } |
1341 | 1341 |
1342 // Convert the coordinates to the target window. | 1342 // Convert the coordinates to the target window. |
1343 RECT window_bounds; | 1343 RECT window_bounds; |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1404 if (!scroll_task_.get()) | 1404 if (!scroll_task_.get()) |
1405 scroll_task_.reset(new MenuScrollTask()); | 1405 scroll_task_.reset(new MenuScrollTask()); |
1406 scroll_task_->Update(part); | 1406 scroll_task_->Update(part); |
1407 } | 1407 } |
1408 | 1408 |
1409 void MenuController::StopScrolling() { | 1409 void MenuController::StopScrolling() { |
1410 scroll_task_.reset(NULL); | 1410 scroll_task_.reset(NULL); |
1411 } | 1411 } |
1412 | 1412 |
1413 } // namespace views | 1413 } // namespace views |
OLD | NEW |