| 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/ash/launcher/launcher_context_menu.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_context_menu.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "ash/desktop_background/user_wallpaper_delegate.h" | 9 #include "ash/desktop_background/user_wallpaper_delegate.h" |
| 10 #include "ash/root_window_controller.h" | 10 #include "ash/root_window_controller.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace | 37 } // namespace |
| 38 | 38 |
| 39 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, | 39 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, |
| 40 const ash::LauncherItem* item, | 40 const ash::LauncherItem* item, |
| 41 aura::RootWindow* root) | 41 aura::RootWindow* root) |
| 42 : ui::SimpleMenuModel(NULL), | 42 : ui::SimpleMenuModel(NULL), |
| 43 controller_(controller), | 43 controller_(controller), |
| 44 item_(*item), | 44 item_(*item), |
| 45 launcher_alignment_menu_(root), | 45 shelf_alignment_menu_(root), |
| 46 root_window_(root) { | 46 root_window_(root) { |
| 47 DCHECK(item); | 47 DCHECK(item); |
| 48 DCHECK(root_window_); | 48 DCHECK(root_window_); |
| 49 Init(); | 49 Init(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, | 52 LauncherContextMenu::LauncherContextMenu(ChromeLauncherController* controller, |
| 53 aura::RootWindow* root) | 53 aura::RootWindow* root) |
| 54 : ui::SimpleMenuModel(NULL), | 54 : ui::SimpleMenuModel(NULL), |
| 55 controller_(controller), | 55 controller_(controller), |
| 56 item_(ash::LauncherItem()), | 56 item_(ash::LauncherItem()), |
| 57 launcher_alignment_menu_(root), | 57 shelf_alignment_menu_(root), |
| 58 extension_items_(new extensions::ContextMenuMatcher( | 58 extension_items_(new extensions::ContextMenuMatcher( |
| 59 controller->profile(), this, this, | 59 controller->profile(), this, this, |
| 60 base::Bind(MenuItemHasLauncherContext))), | 60 base::Bind(MenuItemHasLauncherContext))), |
| 61 root_window_(root) { | 61 root_window_(root) { |
| 62 DCHECK(root_window_); | 62 DCHECK(root_window_); |
| 63 Init(); | 63 Init(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void LauncherContextMenu::Init() { | 66 void LauncherContextMenu::Init() { |
| 67 extension_items_.reset(new extensions::ContextMenuMatcher( | 67 extension_items_.reset(new extensions::ContextMenuMatcher( |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 // the type of fullscreen. Do not show the auto-hide menu item while in | 141 // the type of fullscreen. Do not show the auto-hide menu item while in |
| 142 // fullscreen because it is confusing when the preference appears not to | 142 // fullscreen because it is confusing when the preference appears not to |
| 143 // apply. | 143 // apply. |
| 144 if (!IsFullScreenMode()) { | 144 if (!IsFullScreenMode()) { |
| 145 AddCheckItemWithStringId(MENU_AUTO_HIDE, | 145 AddCheckItemWithStringId(MENU_AUTO_HIDE, |
| 146 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); | 146 IDS_ASH_SHELF_CONTEXT_MENU_AUTO_HIDE); |
| 147 } | 147 } |
| 148 if (ash::ShelfWidget::ShelfAlignmentAllowed()) { | 148 if (ash::ShelfWidget::ShelfAlignmentAllowed()) { |
| 149 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, | 149 AddSubMenuWithStringId(MENU_ALIGNMENT_MENU, |
| 150 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, | 150 IDS_ASH_SHELF_CONTEXT_MENU_POSITION, |
| 151 &launcher_alignment_menu_); | 151 &shelf_alignment_menu_); |
| 152 } | 152 } |
| 153 #if defined(OS_CHROMEOS) | 153 #if defined(OS_CHROMEOS) |
| 154 AddItem(MENU_CHANGE_WALLPAPER, | 154 AddItem(MENU_CHANGE_WALLPAPER, |
| 155 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER)); | 155 l10n_util::GetStringUTF16(IDS_AURA_SET_DESKTOP_WALLPAPER)); |
| 156 #endif | 156 #endif |
| 157 } | 157 } |
| 158 | 158 |
| 159 LauncherContextMenu::~LauncherContextMenu() { | 159 LauncherContextMenu::~LauncherContextMenu() { |
| 160 } | 160 } |
| 161 | 161 |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 case MENU_CHANGE_WALLPAPER: | 278 case MENU_CHANGE_WALLPAPER: |
| 279 ash::Shell::GetInstance()->user_wallpaper_delegate()-> | 279 ash::Shell::GetInstance()->user_wallpaper_delegate()-> |
| 280 OpenSetWallpaperPage(); | 280 OpenSetWallpaperPage(); |
| 281 break; | 281 break; |
| 282 #endif | 282 #endif |
| 283 default: | 283 default: |
| 284 extension_items_->ExecuteCommand(command_id, NULL, | 284 extension_items_->ExecuteCommand(command_id, NULL, |
| 285 content::ContextMenuParams()); | 285 content::ContextMenuParams()); |
| 286 } | 286 } |
| 287 } | 287 } |
| OLD | NEW |