Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / renderer_context_menu / context_menu_content_type_panel.cc
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.
4
5 #include "chrome/browser/renderer_context_menu/context_menu_content_type_panel.h"
6
7 ContextMenuContentTypePanel::ContextMenuContentTypePanel(
8     content::WebContents* web_contents,
9     const content::ContextMenuParams& params)
10     : ContextMenuContentType(web_contents, params, false) {
11 }
12
13 ContextMenuContentTypePanel::~ContextMenuContentTypePanel() {
14 }
15
16 bool ContextMenuContentTypePanel::SupportsGroup(int group) {
17   switch (group) {
18     case ITEM_GROUP_LINK:
19       // Checking link should take precedence before checking selection since on
20       // Mac right-clicking a link will also make it selected.
21       return params().unfiltered_link_url.is_valid();
22     case ITEM_GROUP_EDITABLE:
23     case ITEM_GROUP_COPY:
24       return ContextMenuContentType::SupportsGroup(group);
25     case ITEM_GROUP_CURRENT_EXTENSION:
26       return true;
27     default:
28       return false;
29   }
30 }