OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_list/app_context_menu.h" | 5 #include "chrome/browser/ui/app_list/app_context_menu.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/metrics/histogram.h" | |
9 #include "chrome/browser/extensions/context_menu_matcher.h" | 10 #include "chrome/browser/extensions/context_menu_matcher.h" |
10 #include "chrome/browser/extensions/menu_manager.h" | 11 #include "chrome/browser/extensions/menu_manager.h" |
11 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
12 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" | 14 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" |
14 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
16 #include "chrome/common/extensions/manifest_url_handler.h" | 17 #include "chrome/common/extensions/manifest_url_handler.h" |
17 #include "content/public/common/context_menu_params.h" | 18 #include "content/public/common/context_menu_params.h" |
18 #include "grit/chromium_strings.h" | 19 #include "grit/chromium_strings.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 delegate_->ExecuteLaunchCommand(event_flags); | 248 delegate_->ExecuteLaunchCommand(event_flags); |
248 } else if (command_id == TOGGLE_PIN && controller_->GetPinnable() == | 249 } else if (command_id == TOGGLE_PIN && controller_->GetPinnable() == |
249 AppListControllerDelegate::PIN_EDITABLE) { | 250 AppListControllerDelegate::PIN_EDITABLE) { |
250 if (controller_->IsAppPinned(app_id_)) | 251 if (controller_->IsAppPinned(app_id_)) |
251 controller_->UnpinApp(app_id_); | 252 controller_->UnpinApp(app_id_); |
252 else | 253 else |
253 controller_->PinApp(app_id_); | 254 controller_->PinApp(app_id_); |
254 } else if (command_id == CREATE_SHORTCUTS) { | 255 } else if (command_id == CREATE_SHORTCUTS) { |
255 controller_->DoCreateShortcutsFlow(profile_, app_id_); | 256 controller_->DoCreateShortcutsFlow(profile_, app_id_); |
256 } else if (command_id == SHOW_APP_INFO) { | 257 } else if (command_id == SHOW_APP_INFO) { |
258 UMA_HISTOGRAM_ENUMERATION("Apps.AppInfoDialogLaunched", 1, 2); | |
benwells
2014/08/04 01:41:40
Could you define the enum now too?
sashab
2014/08/04 01:47:49
Done :)
| |
257 controller_->DoShowAppInfoFlow(profile_, app_id_); | 259 controller_->DoShowAppInfoFlow(profile_, app_id_); |
258 } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && | 260 } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && |
259 command_id < USE_LAUNCH_TYPE_COMMAND_END) { | 261 command_id < USE_LAUNCH_TYPE_COMMAND_END) { |
260 extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( | 262 extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( |
261 command_id - USE_LAUNCH_TYPE_COMMAND_START); | 263 command_id - USE_LAUNCH_TYPE_COMMAND_START); |
262 // Streamlined hosted apps can only toggle between LAUNCH_TYPE_WINDOW and | 264 // Streamlined hosted apps can only toggle between LAUNCH_TYPE_WINDOW and |
263 // LAUNCH_TYPE_REGULAR. | 265 // LAUNCH_TYPE_REGULAR. |
264 if (CommandLine::ForCurrentProcess()->HasSwitch( | 266 if (CommandLine::ForCurrentProcess()->HasSwitch( |
265 switches::kEnableStreamlinedHostedApps)) { | 267 switches::kEnableStreamlinedHostedApps)) { |
266 launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) == | 268 launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) == |
(...skipping 11 matching lines...) Expand all Loading... | |
278 extension_menu_items_->ExecuteCommand(command_id, NULL, | 280 extension_menu_items_->ExecuteCommand(command_id, NULL, |
279 content::ContextMenuParams()); | 281 content::ContextMenuParams()); |
280 } else if (command_id == MENU_NEW_WINDOW) { | 282 } else if (command_id == MENU_NEW_WINDOW) { |
281 controller_->CreateNewWindow(profile_, false); | 283 controller_->CreateNewWindow(profile_, false); |
282 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { | 284 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { |
283 controller_->CreateNewWindow(profile_, true); | 285 controller_->CreateNewWindow(profile_, true); |
284 } | 286 } |
285 } | 287 } |
286 | 288 |
287 } // namespace app_list | 289 } // namespace app_list |
OLD | NEW |