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

Side by Side Diff: ash/root_window_controller.cc

Issue 16979002: Add ContextMenuSourceType to views::ContextMenuController::ShowContextMenuForView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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 "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 } 407 }
408 408
409 SystemTray* RootWindowController::GetSystemTray() { 409 SystemTray* RootWindowController::GetSystemTray() {
410 // We assume in throughout the code that this will not return NULL. If code 410 // We assume in throughout the code that this will not return NULL. If code
411 // triggers this for valid reasons, it should test status_area_widget first. 411 // triggers this for valid reasons, it should test status_area_widget first.
412 CHECK(shelf_.get() && shelf_->status_area_widget()); 412 CHECK(shelf_.get() && shelf_->status_area_widget());
413 return shelf_->status_area_widget()->system_tray(); 413 return shelf_->status_area_widget()->system_tray();
414 } 414 }
415 415
416 void RootWindowController::ShowContextMenu( 416 void RootWindowController::ShowContextMenu(
417 const gfx::Point& location_in_screen) { 417 const gfx::Point& location_in_screen,
418 ui::ContextMenuSourceType source_type) {
418 DCHECK(Shell::GetInstance()->delegate()); 419 DCHECK(Shell::GetInstance()->delegate());
419 scoped_ptr<ui::MenuModel> menu_model( 420 scoped_ptr<ui::MenuModel> menu_model(
420 Shell::GetInstance()->delegate()->CreateContextMenu(root_window())); 421 Shell::GetInstance()->delegate()->CreateContextMenu(root_window()));
421 if (!menu_model) 422 if (!menu_model)
422 return; 423 return;
423 424
424 internal::DesktopBackgroundWidgetController* background = 425 internal::DesktopBackgroundWidgetController* background =
425 root_window_->GetProperty(kDesktopController); 426 root_window_->GetProperty(kDesktopController);
426 // Background controller may not be set yet if user clicked on status are 427 // Background controller may not be set yet if user clicked on status are
427 // before initial animation completion. See crbug.com/222218 428 // before initial animation completion. See crbug.com/222218
428 if (!background) 429 if (!background)
429 return; 430 return;
430 431
431 views::MenuRunner menu_runner(menu_model.get()); 432 views::MenuRunner menu_runner(menu_model.get());
432 if (menu_runner.RunMenuAt(background->widget(), 433 if (menu_runner.RunContextMenuAt(background->widget(),
433 NULL, gfx::Rect(location_in_screen, gfx::Size()), 434 NULL, gfx::Rect(location_in_screen, gfx::Size()),
434 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == 435 source_type, views::MenuRunner::CONTEXT_MENU) ==
435 views::MenuRunner::MENU_DELETED) { 436 views::MenuRunner::MENU_DELETED) {
436 return; 437 return;
437 } 438 }
438 439
439 Shell::GetInstance()->UpdateShelfVisibility(); 440 Shell::GetInstance()->UpdateShelfVisibility();
440 } 441 }
441 442
442 void RootWindowController::UpdateShelfVisibility() { 443 void RootWindowController::UpdateShelfVisibility() {
443 shelf_->shelf_layout_manager()->UpdateVisibilityState(); 444 shelf_->shelf_layout_manager()->UpdateVisibilityState();
444 } 445 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 "OverlayContainer", 628 "OverlayContainer",
628 lock_screen_related_containers); 629 lock_screen_related_containers);
629 SetUsesScreenCoordinates(overlay_container); 630 SetUsesScreenCoordinates(overlay_container);
630 631
631 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 632 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
632 "PowerButtonAnimationContainer", root_window) ; 633 "PowerButtonAnimationContainer", root_window) ;
633 } 634 }
634 635
635 } // namespace internal 636 } // namespace internal
636 } // namespace ash 637 } // namespace ash
OLDNEW
« no previous file with comments | « ash/root_window_controller.h ('k') | ash/shell.h » ('j') | ui/base/ui_base_types.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698