Chromium Code Reviews| 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/app/chrome_command_ids.h" | 10 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/extensions/context_menu_matcher.h" | 11 #include "chrome/browser/extensions/context_menu_matcher.h" |
| 11 #include "chrome/browser/extensions/menu_manager.h" | 12 #include "chrome/browser/extensions/menu_manager.h" |
| 12 #include "chrome/browser/prefs/incognito_mode_prefs.h" | 13 #include "chrome/browser/prefs/incognito_mode_prefs.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 14 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" | 15 #include "chrome/browser/ui/app_list/app_context_menu_delegate.h" |
| 15 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 16 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
| 16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/extensions/manifest_url_handler.h" | 18 #include "chrome/common/extensions/manifest_url_handler.h" |
| 18 #include "content/public/common/context_menu_params.h" | 19 #include "content/public/common/context_menu_params.h" |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 delegate_->ExecuteLaunchCommand(event_flags); | 249 delegate_->ExecuteLaunchCommand(event_flags); |
| 249 } else if (command_id == TOGGLE_PIN && controller_->GetPinnable() == | 250 } else if (command_id == TOGGLE_PIN && controller_->GetPinnable() == |
| 250 AppListControllerDelegate::PIN_EDITABLE) { | 251 AppListControllerDelegate::PIN_EDITABLE) { |
| 251 if (controller_->IsAppPinned(app_id_)) | 252 if (controller_->IsAppPinned(app_id_)) |
| 252 controller_->UnpinApp(app_id_); | 253 controller_->UnpinApp(app_id_); |
| 253 else | 254 else |
| 254 controller_->PinApp(app_id_); | 255 controller_->PinApp(app_id_); |
| 255 } else if (command_id == CREATE_SHORTCUTS) { | 256 } else if (command_id == CREATE_SHORTCUTS) { |
| 256 controller_->DoCreateShortcutsFlow(profile_, app_id_); | 257 controller_->DoCreateShortcutsFlow(profile_, app_id_); |
| 257 } else if (command_id == SHOW_APP_INFO) { | 258 } else if (command_id == SHOW_APP_INFO) { |
| 259 UMA_HISTOGRAM_ENUMERATION("Apps.AppListAppInfoDialog", 1, 2); | |
|
benwells
2014/07/31 06:13:18
I think you should use UMA_HISTOGRAM_COUNTS for th
sashab
2014/08/04 00:30:45
I was using this because it's a common pattern to
| |
| 258 controller_->DoShowAppInfoFlow(profile_, app_id_); | 260 controller_->DoShowAppInfoFlow(profile_, app_id_); |
| 259 } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && | 261 } else if (command_id >= USE_LAUNCH_TYPE_COMMAND_START && |
| 260 command_id < USE_LAUNCH_TYPE_COMMAND_END) { | 262 command_id < USE_LAUNCH_TYPE_COMMAND_END) { |
| 261 extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( | 263 extensions::LaunchType launch_type = static_cast<extensions::LaunchType>( |
| 262 command_id - USE_LAUNCH_TYPE_COMMAND_START); | 264 command_id - USE_LAUNCH_TYPE_COMMAND_START); |
| 263 // Streamlined hosted apps can only toggle between LAUNCH_TYPE_WINDOW and | 265 // Streamlined hosted apps can only toggle between LAUNCH_TYPE_WINDOW and |
| 264 // LAUNCH_TYPE_REGULAR. | 266 // LAUNCH_TYPE_REGULAR. |
| 265 if (CommandLine::ForCurrentProcess()->HasSwitch( | 267 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 266 switches::kEnableStreamlinedHostedApps)) { | 268 switches::kEnableStreamlinedHostedApps)) { |
| 267 launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) == | 269 launch_type = (controller_->GetExtensionLaunchType(profile_, app_id_) == |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 279 extension_menu_items_->ExecuteCommand(command_id, NULL, | 281 extension_menu_items_->ExecuteCommand(command_id, NULL, |
| 280 content::ContextMenuParams()); | 282 content::ContextMenuParams()); |
| 281 } else if (command_id == MENU_NEW_WINDOW) { | 283 } else if (command_id == MENU_NEW_WINDOW) { |
| 282 controller_->CreateNewWindow(profile_, false); | 284 controller_->CreateNewWindow(profile_, false); |
| 283 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { | 285 } else if (command_id == MENU_NEW_INCOGNITO_WINDOW) { |
| 284 controller_->CreateNewWindow(profile_, true); | 286 controller_->CreateNewWindow(profile_, true); |
| 285 } | 287 } |
| 286 } | 288 } |
| 287 | 289 |
| 288 } // namespace app_list | 290 } // namespace app_list |
| OLD | NEW |