| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/common/session/session_state_delegate.h" | 9 #include "ash/common/session/session_state_delegate.h" |
| 10 #include "ash/common/shelf/shelf_model.h" | 10 #include "ash/common/shelf/shelf_model.h" |
| 11 #include "ash/common/shelf/shelf_widget.h" | 11 #include "ash/common/shelf/shelf_widget.h" |
| 12 #include "ash/common/shelf/wm_shelf.h" | 12 #include "ash/common/shelf/wm_shelf.h" |
| 13 #include "ash/common/wallpaper/wallpaper_delegate.h" |
| 13 #include "ash/common/wm_shell.h" | 14 #include "ash/common/wm_shell.h" |
| 14 #include "ash/desktop_background/user_wallpaper_delegate.h" | |
| 15 #include "ash/shell.h" | |
| 16 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 17 #include "chrome/browser/fullscreen.h" | 16 #include "chrome/browser/fullscreen.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 18 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 20 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" | 19 #include "chrome/browser/ui/ash/launcher/arc_launcher_context_menu.h" |
| 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" | 20 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" |
| 22 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" | 21 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_util.h" |
| 23 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" | 22 #include "chrome/browser/ui/ash/launcher/desktop_shell_launcher_context_menu.h" |
| 24 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" | 23 #include "chrome/browser/ui/ash/launcher/extension_launcher_context_menu.h" |
| 25 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 90 } |
| 92 DCHECK(command_id < MENU_ITEM_COUNT); | 91 DCHECK(command_id < MENU_ITEM_COUNT); |
| 93 return false; | 92 return false; |
| 94 } | 93 } |
| 95 | 94 |
| 96 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { | 95 bool LauncherContextMenu::IsCommandIdEnabled(int command_id) const { |
| 97 switch (command_id) { | 96 switch (command_id) { |
| 98 case MENU_PIN: | 97 case MENU_PIN: |
| 99 return controller_->IsPinnable(item_.id); | 98 return controller_->IsPinnable(item_.id); |
| 100 case MENU_CHANGE_WALLPAPER: | 99 case MENU_CHANGE_WALLPAPER: |
| 101 return ash::Shell::GetInstance() | 100 return ash::WmShell::Get() |
| 102 ->user_wallpaper_delegate() | 101 ->wallpaper_delegate() |
| 103 ->CanOpenSetWallpaperPage(); | 102 ->CanOpenSetWallpaperPage(); |
| 104 case MENU_AUTO_HIDE: | 103 case MENU_AUTO_HIDE: |
| 105 return CanUserModifyShelfAutoHideBehavior(controller_->GetProfile()); | 104 return CanUserModifyShelfAutoHideBehavior(controller_->GetProfile()); |
| 106 default: | 105 default: |
| 107 DCHECK(command_id < MENU_ITEM_COUNT); | 106 DCHECK(command_id < MENU_ITEM_COUNT); |
| 108 return true; | 107 return true; |
| 109 } | 108 } |
| 110 } | 109 } |
| 111 | 110 |
| 112 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { | 111 void LauncherContextMenu::ExecuteCommand(int command_id, int event_flags) { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 133 case MENU_AUTO_HIDE: | 132 case MENU_AUTO_HIDE: |
| 134 wm_shelf_->SetAutoHideBehavior( | 133 wm_shelf_->SetAutoHideBehavior( |
| 135 wm_shelf_->auto_hide_behavior() == | 134 wm_shelf_->auto_hide_behavior() == |
| 136 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS | 135 ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS |
| 137 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER | 136 ? ash::SHELF_AUTO_HIDE_BEHAVIOR_NEVER |
| 138 : ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 137 : ash::SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 139 break; | 138 break; |
| 140 case MENU_ALIGNMENT_MENU: | 139 case MENU_ALIGNMENT_MENU: |
| 141 break; | 140 break; |
| 142 case MENU_CHANGE_WALLPAPER: | 141 case MENU_CHANGE_WALLPAPER: |
| 143 ash::Shell::GetInstance()->user_wallpaper_delegate()-> | 142 ash::WmShell::Get()->wallpaper_delegate()->OpenSetWallpaperPage(); |
| 144 OpenSetWallpaperPage(); | |
| 145 break; | 143 break; |
| 146 default: | 144 default: |
| 147 NOTREACHED(); | 145 NOTREACHED(); |
| 148 } | 146 } |
| 149 } | 147 } |
| 150 | 148 |
| 151 void LauncherContextMenu::AddPinMenu() { | 149 void LauncherContextMenu::AddPinMenu() { |
| 152 // Expect an item with a none zero id to add pin/unpin menu item. | 150 // Expect an item with a none zero id to add pin/unpin menu item. |
| 153 DCHECK(item_.id); | 151 DCHECK(item_.id); |
| 154 int menu_pin_string_id; | 152 int menu_pin_string_id; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 case MENU_PIN: | 197 case MENU_PIN: |
| 200 case MENU_AUTO_HIDE: | 198 case MENU_AUTO_HIDE: |
| 201 case MENU_ALIGNMENT_MENU: | 199 case MENU_ALIGNMENT_MENU: |
| 202 case MENU_CHANGE_WALLPAPER: | 200 case MENU_CHANGE_WALLPAPER: |
| 203 LauncherContextMenu::ExecuteCommand(command_id, event_flags); | 201 LauncherContextMenu::ExecuteCommand(command_id, event_flags); |
| 204 return true; | 202 return true; |
| 205 default: | 203 default: |
| 206 return false; | 204 return false; |
| 207 } | 205 } |
| 208 } | 206 } |
| OLD | NEW |