| Index: chrome/browser/context_menu/context_menu_content_type.h
|
| diff --git a/chrome/browser/context_menu/context_menu_content_type.h b/chrome/browser/context_menu/context_menu_content_type.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..729ed631da80eee521aa31818a17169f697cdda3
|
| --- /dev/null
|
| +++ b/chrome/browser/context_menu/context_menu_content_type.h
|
| @@ -0,0 +1,84 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef CHROME_BROWSER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_
|
| +#define CHROME_BROWSER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_
|
| +
|
| +#include "chrome/browser/custom_handlers/protocol_handler_registry.h"
|
| +#include "content/public/common/context_menu_params.h"
|
| +#include "ui/base/models/simple_menu_model.h"
|
| +
|
| +class Profile;
|
| +
|
| +namespace content {
|
| +class RenderFrameHost;
|
| +class WebContents;
|
| +}
|
| +
|
| +namespace extensions {
|
| +class Extension;
|
| +}
|
| +
|
| +// ContextMenuContentType is a helper to decide which category/group of items
|
| +// are relevant for a given RenderFrameHost and a context.
|
| +//
|
| +// Subclasses can override the behavior of showing/hiding a category.
|
| +class ContextMenuContentType {
|
| + public:
|
| + virtual ~ContextMenuContentType();
|
| +
|
| + // Represents a group of menu items.
|
| + // Order matters as they are appended in the enum order.
|
| + enum ItemGroup {
|
| + ITEM_GROUP_CUSTOM,
|
| + ITEM_GROUP_PAGE,
|
| + ITEM_GROUP_FRAME,
|
| + ITEM_GROUP_LINK,
|
| + ITEM_GROUP_MEDIA_IMAGE,
|
| + ITEM_GROUP_SEARCHWEBFORIMAGE,
|
| + ITEM_GROUP_MEDIA_VIDEO,
|
| + ITEM_GROUP_MEDIA_AUDIO,
|
| + ITEM_GROUP_MEDIA_PLUGIN,
|
| + ITEM_GROUP_MEDIA_FILE,
|
| + ITEM_GROUP_EDITABLE,
|
| + ITEM_GROUP_COPY,
|
| + ITEM_GROUP_SEARCH_PROVIDER,
|
| + ITEM_GROUP_PRINT,
|
| + ITEM_GROUP_ALL_EXTENSION,
|
| + ITEM_GROUP_CURRENT_EXTENSION,
|
| + ITEM_GROUP_DEVELOPER,
|
| + ITEM_GROUP_DEVTOOLS_UNPACKED_EXT,
|
| + ITEM_GROUP_PRINT_PREVIEW
|
| + };
|
| +
|
| + static ContextMenuContentType* Create(
|
| + content::WebContents* web_contents,
|
| + content::RenderFrameHost* render_frame_host,
|
| + const content::ContextMenuParams& params);
|
| +
|
| + // Returns if |group| is enabled.
|
| + virtual bool SupportsGroup(int group);
|
| +
|
| + protected:
|
| + ContextMenuContentType(content::RenderFrameHost* render_frame_host,
|
| + const content::ContextMenuParams& params);
|
| +
|
| + const extensions::Extension* GetExtension() const;
|
| +
|
| + content::ContextMenuParams params_;
|
| + content::WebContents* source_web_contents_;
|
| + Profile* profile_;
|
| + bool has_custom_items_;
|
| +
|
| + private:
|
| + friend class ContextMenuContentTypeFactory;
|
| +
|
| + bool HasCustomItems(const std::vector<content::MenuItem>& items) const;
|
| + void Initialize();
|
| + bool SupportsGroupInternal(int group);
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ContextMenuContentType);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_
|
|
|