1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "chrome/browser/renderer_context_menu/context_menu_content_type_platform_app.h"
7 #include "base/command_line.h"
8 #include "chrome/common/chrome_switches.h"
9 #include "extensions/common/extension.h"
10 #include "extensions/common/manifest.h"
12 ContextMenuContentTypePlatformApp::ContextMenuContentTypePlatformApp(
13 content::WebContents* web_contents,
14 const content::ContextMenuParams& params)
15 : ContextMenuContentType(web_contents, params, false) {
18 ContextMenuContentTypePlatformApp::~ContextMenuContentTypePlatformApp() {
21 bool ContextMenuContentTypePlatformApp::SupportsGroup(int group) {
22 const extensions::Extension* platform_app = GetExtension();
24 // The RVH might be for a process sandboxed from the extension.
28 DCHECK(platform_app->is_platform_app());
31 // Add undo/redo, cut/copy/paste etc for text fields.
32 case ITEM_GROUP_EDITABLE:
34 return ContextMenuContentType::SupportsGroup(group);
35 case ITEM_GROUP_CURRENT_EXTENSION:
37 case ITEM_GROUP_DEVTOOLS_UNPACKED_EXT:
38 // Add dev tools for unpacked extensions.
39 return extensions::Manifest::IsUnpackedLocation(
40 platform_app->location()) ||
41 CommandLine::ForCurrentProcess()->HasSwitch(
42 switches::kDebugPackedApps);