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

Side by Side Diff: chrome/browser/ui/views/tab_contents/tab_contents_view_views.cc

Issue 9384024: Prefer ScopedNestableTaskAllower over manual save/restore (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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) 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 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 354
355 // Don't show empty menus. 355 // Don't show empty menus.
356 if (context_menu_->menu_model().GetItemCount() == 0) 356 if (context_menu_->menu_model().GetItemCount() == 0)
357 return; 357 return;
358 358
359 gfx::Point screen_point(params.x, params.y); 359 gfx::Point screen_point(params.x, params.y);
360 views::View::ConvertPointToScreen(GetRootView(), &screen_point); 360 views::View::ConvertPointToScreen(GetRootView(), &screen_point);
361 361
362 // Enable recursive tasks on the message loop so we can get updates while 362 // Enable recursive tasks on the message loop so we can get updates while
363 // the context menu is being displayed. 363 // the context menu is being displayed.
364 bool old_state = MessageLoop::current()->NestableTasksAllowed(); 364 MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current());
365 MessageLoop::current()->SetNestableTasksAllowed(true);
366 context_menu_->RunMenuAt(screen_point.x(), screen_point.y()); 365 context_menu_->RunMenuAt(screen_point.x(), screen_point.y());
367 MessageLoop::current()->SetNestableTasksAllowed(old_state);
368 } 366 }
369 367
370 void TabContentsViewViews::ShowPopupMenu(const gfx::Rect& bounds, 368 void TabContentsViewViews::ShowPopupMenu(const gfx::Rect& bounds,
371 int item_height, 369 int item_height,
372 double item_font_size, 370 double item_font_size,
373 int selected_item, 371 int selected_item,
374 const std::vector<WebMenuItem>& items, 372 const std::vector<WebMenuItem>& items,
375 bool right_aligned) { 373 bool right_aligned) {
376 // External popup menus are only used on Mac. 374 // External popup menus are only used on Mac.
377 NOTREACHED(); 375 NOTREACHED();
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 web_contents_->HideContents(); 467 web_contents_->HideContents();
470 } 468 }
471 } 469 }
472 470
473 void TabContentsViewViews::OnNativeWidgetSizeChanged( 471 void TabContentsViewViews::OnNativeWidgetSizeChanged(
474 const gfx::Size& new_size) { 472 const gfx::Size& new_size) {
475 if (overlaid_view_) 473 if (overlaid_view_)
476 overlaid_view_->SetBounds(gfx::Rect(new_size)); 474 overlaid_view_->SetBounds(gfx::Rect(new_size));
477 views::Widget::OnNativeWidgetSizeChanged(new_size); 475 views::Widget::OnNativeWidgetSizeChanged(new_size);
478 } 476 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698