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

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: fix win build 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL; 405 return shelf_.get() ? shelf_->shelf_layout_manager() : NULL;
406 } 406 }
407 407
408 SystemTray* RootWindowController::GetSystemTray() { 408 SystemTray* RootWindowController::GetSystemTray() {
409 // We assume in throughout the code that this will not return NULL. If code 409 // We assume in throughout the code that this will not return NULL. If code
410 // triggers this for valid reasons, it should test status_area_widget first. 410 // triggers this for valid reasons, it should test status_area_widget first.
411 CHECK(shelf_.get() && shelf_->status_area_widget()); 411 CHECK(shelf_.get() && shelf_->status_area_widget());
412 return shelf_->status_area_widget()->system_tray(); 412 return shelf_->status_area_widget()->system_tray();
413 } 413 }
414 414
415 void RootWindowController::ShowContextMenu( 415 void RootWindowController::ShowContextMenu(const gfx::Point& location_in_screen,
416 const gfx::Point& location_in_screen) { 416 ui::MenuSourceType source_type) {
417 DCHECK(Shell::GetInstance()->delegate()); 417 DCHECK(Shell::GetInstance()->delegate());
418 scoped_ptr<ui::MenuModel> menu_model( 418 scoped_ptr<ui::MenuModel> menu_model(
419 Shell::GetInstance()->delegate()->CreateContextMenu(root_window())); 419 Shell::GetInstance()->delegate()->CreateContextMenu(root_window()));
420 if (!menu_model) 420 if (!menu_model)
421 return; 421 return;
422 422
423 internal::DesktopBackgroundWidgetController* background = 423 internal::DesktopBackgroundWidgetController* background =
424 root_window_->GetProperty(kDesktopController); 424 root_window_->GetProperty(kDesktopController);
425 // Background controller may not be set yet if user clicked on status are 425 // Background controller may not be set yet if user clicked on status are
426 // before initial animation completion. See crbug.com/222218 426 // before initial animation completion. See crbug.com/222218
427 if (!background) 427 if (!background)
428 return; 428 return;
429 429
430 views::MenuRunner menu_runner(menu_model.get()); 430 views::MenuRunner menu_runner(menu_model.get());
431 if (menu_runner.RunMenuAt(background->widget(), 431 if (menu_runner.RunMenuAt(background->widget(),
432 NULL, gfx::Rect(location_in_screen, gfx::Size()), 432 NULL, gfx::Rect(location_in_screen, gfx::Size()),
433 views::MenuItemView::TOPLEFT, views::MenuRunner::CONTEXT_MENU) == 433 views::MenuItemView::TOPLEFT, source_type,
434 views::MenuRunner::CONTEXT_MENU) ==
434 views::MenuRunner::MENU_DELETED) { 435 views::MenuRunner::MENU_DELETED) {
435 return; 436 return;
436 } 437 }
437 438
438 Shell::GetInstance()->UpdateShelfVisibility(); 439 Shell::GetInstance()->UpdateShelfVisibility();
439 } 440 }
440 441
441 void RootWindowController::UpdateShelfVisibility() { 442 void RootWindowController::UpdateShelfVisibility() {
442 shelf_->shelf_layout_manager()->UpdateVisibilityState(); 443 shelf_->shelf_layout_manager()->UpdateVisibilityState();
443 } 444 }
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
626 "OverlayContainer", 627 "OverlayContainer",
627 lock_screen_related_containers); 628 lock_screen_related_containers);
628 SetUsesScreenCoordinates(overlay_container); 629 SetUsesScreenCoordinates(overlay_container);
629 630
630 CreateContainer(kShellWindowId_PowerButtonAnimationContainer, 631 CreateContainer(kShellWindowId_PowerButtonAnimationContainer,
631 "PowerButtonAnimationContainer", root_window) ; 632 "PowerButtonAnimationContainer", root_window) ;
632 } 633 }
633 634
634 } // namespace internal 635 } // namespace internal
635 } // namespace ash 636 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698