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 { | 16 namespace extensions { |
lazyboy
2015/04/30 16:33:31
Remove.
Deepak
2015/05/02 06:25:20
Done.
| |
17 class Extension; | 17 class Extension; |
18 } | 18 } |
19 | 19 |
20 // ContextMenuContentType is a helper to decide which category/group of items | 20 // ContextMenuContentType is a helper to decide which category/group of items |
21 // are relevant for a given WebContents and a context. | 21 // are relevant for a given WebContents and a context. |
22 // | 22 // |
23 // Subclasses can override the behavior of showing/hiding a category. | 23 // Subclasses can override the behavior of showing/hiding a category. |
24 class ContextMenuContentType { | 24 class ContextMenuContentType { |
25 public: | 25 public: |
26 virtual ~ContextMenuContentType(); | 26 virtual ~ContextMenuContentType(); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
61 // Returns if |group| is enabled. | 61 // Returns if |group| is enabled. |
62 virtual bool SupportsGroup(int group); | 62 virtual bool SupportsGroup(int group); |
63 | 63 |
64 ContextMenuContentType(content::WebContents* web_contents, | 64 ContextMenuContentType(content::WebContents* web_contents, |
65 const content::ContextMenuParams& params, | 65 const content::ContextMenuParams& params, |
66 bool supports_custom_items); | 66 bool supports_custom_items); |
67 | 67 |
68 protected: | 68 protected: |
69 const content::ContextMenuParams& params() const { return params_; } | 69 const content::ContextMenuParams& params() const { return params_; } |
70 | 70 |
71 const extensions::Extension* GetExtension() const; | 71 content::WebContents* source_web_contents() const { |
lazyboy
2015/04/30 16:33:31
Ah this is sad, can you add a TODO(lazyboy) to mak
Deepak
2015/05/02 06:25:20
Done.
| |
72 | |
73 const content::WebContents* source_web_contents() const { | |
74 return source_web_contents_; | 72 return source_web_contents_; |
75 } | 73 } |
76 | 74 |
77 private: | 75 private: |
78 bool SupportsGroupInternal(int group); | 76 bool SupportsGroupInternal(int group); |
79 | 77 |
80 bool IsInternalResourcesURL(const GURL& url); | 78 bool IsInternalResourcesURL(const GURL& url); |
81 | 79 |
82 const content::ContextMenuParams params_; | 80 const content::ContextMenuParams params_; |
83 content::WebContents* source_web_contents_; | 81 content::WebContents* source_web_contents_; |
84 const bool supports_custom_items_; | 82 const bool supports_custom_items_; |
85 | 83 |
86 // A boolean callback to check if the url points to the internal | 84 // A boolean callback to check if the url points to the internal |
87 // resources. | 85 // resources. |
88 InternalResourcesURLChecker internal_resources_url_checker_; | 86 InternalResourcesURLChecker internal_resources_url_checker_; |
89 | 87 |
90 DISALLOW_COPY_AND_ASSIGN(ContextMenuContentType); | 88 DISALLOW_COPY_AND_ASSIGN(ContextMenuContentType); |
91 }; | 89 }; |
92 | 90 |
93 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ | 91 #endif // COMPONENTS_RENDERER_CONTEXT_MENU_CONTEXT_MENU_CONTENT_TYPE_H_ |
OLD | NEW |