OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ | 5 #ifndef COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ |
6 #define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ | 6 #define COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "content/public/common/context_menu_params.h" | 9 #include "content/public/common/context_menu_params.h" |
10 #include "ui/base/models/simple_menu_model.h" | 10 #include "ui/base/models/simple_menu_model.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 class WebContents; | 13 class WebContents; |
14 } | 14 } |
15 | 15 |
16 namespace extensions { | |
17 class Extension; | |
18 } | |
19 | |
20 // ContextMenuContentType is a helper to decide which category/group of items | 16 // ContextMenuContentType is a helper to decide which category/group of items |
21 // are relevant for a given WebContents and a context. | 17 // are relevant for a given WebContents and a context. |
22 // | 18 // |
23 // Subclasses can override the behavior of showing/hiding a category. | 19 // Subclasses can override the behavior of showing/hiding a category. |
24 class ContextMenuContentType { | 20 class ContextMenuContentType { |
25 public: | 21 public: |
26 virtual ~ContextMenuContentType(); | 22 virtual ~ContextMenuContentType(); |
27 | 23 |
28 // Represents a group of menu items. | 24 // Represents a group of menu items. |
29 // Order matters as they are appended in the enum order. | 25 // Order matters as they are appended in the enum order. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 // Returns if |group| is enabled. | 57 // Returns if |group| is enabled. |
62 virtual bool SupportsGroup(int group); | 58 virtual bool SupportsGroup(int group); |
63 | 59 |
64 ContextMenuContentType(content::WebContents* web_contents, | 60 ContextMenuContentType(content::WebContents* web_contents, |
65 const content::ContextMenuParams& params, | 61 const content::ContextMenuParams& params, |
66 bool supports_custom_items); | 62 bool supports_custom_items); |
67 | 63 |
68 protected: | 64 protected: |
69 const content::ContextMenuParams& params() const { return params_; } | 65 const content::ContextMenuParams& params() const { return params_; } |
70 | 66 |
71 const extensions::Extension* GetExtension() const; | 67 // TODO(lazyboy): Return const content::Webcontents pointer. |
lazyboy
2015/05/02 07:17:15
nit: change "Webcontents pointer" to "WebContents*
Deepak
2015/05/02 07:56:24
Done.
| |
72 | 68 content::WebContents* source_web_contents() const { |
73 const content::WebContents* source_web_contents() const { | |
74 return source_web_contents_; | 69 return source_web_contents_; |
75 } | 70 } |
76 | 71 |
77 private: | 72 private: |
78 bool SupportsGroupInternal(int group); | 73 bool SupportsGroupInternal(int group); |
79 | 74 |
80 bool IsInternalResourcesURL(const GURL& url); | 75 bool IsInternalResourcesURL(const GURL& url); |
81 | 76 |
82 const content::ContextMenuParams params_; | 77 const content::ContextMenuParams params_; |
83 content::WebContents* source_web_contents_; | 78 content::WebContents* source_web_contents_; |
84 const bool supports_custom_items_; | 79 const bool supports_custom_items_; |
85 | 80 |
86 // A boolean callback to check if the url points to the internal | 81 // A boolean callback to check if the url points to the internal |
87 // resources. | 82 // resources. |
88 InternalResourcesURLChecker internal_resources_url_checker_; | 83 InternalResourcesURLChecker internal_resources_url_checker_; |
89 | 84 |
90 DISALLOW_COPY_AND_ASSIGN(ContextMenuContentType); | 85 DISALLOW_COPY_AND_ASSIGN(ContextMenuContentType); |
91 }; | 86 }; |
92 | 87 |
93 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ | 88 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ |
OLD | NEW |