OLD | NEW |
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 "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" | 5 #include "chrome/browser/ui/views/tab_contents/tab_contents_view_views.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/time.h" | 9 #include "base/time.h" |
10 #include "chrome/browser/ui/constrained_window.h" | 10 #include "chrome/browser/ui/constrained_window.h" |
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
355 | 355 |
356 // Don't show empty menus. | 356 // Don't show empty menus. |
357 if (context_menu_->menu_model().GetItemCount() == 0) | 357 if (context_menu_->menu_model().GetItemCount() == 0) |
358 return; | 358 return; |
359 | 359 |
360 gfx::Point screen_point(params.x, params.y); | 360 gfx::Point screen_point(params.x, params.y); |
361 views::View::ConvertPointToScreen(GetRootView(), &screen_point); | 361 views::View::ConvertPointToScreen(GetRootView(), &screen_point); |
362 | 362 |
363 // Enable recursive tasks on the message loop so we can get updates while | 363 // Enable recursive tasks on the message loop so we can get updates while |
364 // the context menu is being displayed. | 364 // the context menu is being displayed. |
365 bool old_state = MessageLoop::current()->NestableTasksAllowed(); | 365 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); |
366 MessageLoop::current()->SetNestableTasksAllowed(true); | |
367 context_menu_->RunMenuAt(screen_point.x(), screen_point.y()); | 366 context_menu_->RunMenuAt(screen_point.x(), screen_point.y()); |
368 MessageLoop::current()->SetNestableTasksAllowed(old_state); | |
369 } | 367 } |
370 | 368 |
371 void TabContentsViewViews::ShowPopupMenu(const gfx::Rect& bounds, | 369 void TabContentsViewViews::ShowPopupMenu(const gfx::Rect& bounds, |
372 int item_height, | 370 int item_height, |
373 double item_font_size, | 371 double item_font_size, |
374 int selected_item, | 372 int selected_item, |
375 const std::vector<WebMenuItem>& items, | 373 const std::vector<WebMenuItem>& items, |
376 bool right_aligned) { | 374 bool right_aligned) { |
377 // External popup menus are only used on Mac. | 375 // External popup menus are only used on Mac. |
378 NOTREACHED(); | 376 NOTREACHED(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 web_contents_->HideContents(); | 468 web_contents_->HideContents(); |
471 } | 469 } |
472 } | 470 } |
473 | 471 |
474 void TabContentsViewViews::OnNativeWidgetSizeChanged( | 472 void TabContentsViewViews::OnNativeWidgetSizeChanged( |
475 const gfx::Size& new_size) { | 473 const gfx::Size& new_size) { |
476 if (overlaid_view_) | 474 if (overlaid_view_) |
477 overlaid_view_->SetBounds(gfx::Rect(new_size)); | 475 overlaid_view_->SetBounds(gfx::Rect(new_size)); |
478 views::Widget::OnNativeWidgetSizeChanged(new_size); | 476 views::Widget::OnNativeWidgetSizeChanged(new_size); |
479 } | 477 } |
OLD | NEW |