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 #include "chrome/browser/guest_view/web_view/context_menu_content_type_web_view.
h" | 5 #include "chrome/browser/guest_view/web_view/context_menu_content_type_web_view.
h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/chrome_version_info.h" | 9 #include "chrome/common/chrome_version_info.h" |
10 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 10 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 11 #include "extensions/browser/process_manager.h" |
11 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
12 #include "extensions/common/manifest.h" | 13 #include "extensions/common/manifest.h" |
13 | 14 |
| 15 using extensions::Extension; |
| 16 using extensions::ProcessManager; |
| 17 |
14 ContextMenuContentTypeWebView::ContextMenuContentTypeWebView( | 18 ContextMenuContentTypeWebView::ContextMenuContentTypeWebView( |
15 content::WebContents* web_contents, | 19 content::WebContents* web_contents, |
16 const content::ContextMenuParams& params) | 20 const content::ContextMenuParams& params) |
17 : ContextMenuContentType(web_contents, params, true) { | 21 : ContextMenuContentType(web_contents, params, true) { |
18 } | 22 } |
19 | 23 |
20 ContextMenuContentTypeWebView::~ContextMenuContentTypeWebView() { | 24 ContextMenuContentTypeWebView::~ContextMenuContentTypeWebView() { |
21 } | 25 } |
22 | 26 |
| 27 const Extension* ContextMenuContentTypeWebView::GetExtension() const { |
| 28 ProcessManager* process_manager = |
| 29 ProcessManager::Get(source_web_contents()->GetBrowserContext()); |
| 30 return process_manager->GetExtensionForWebContents( |
| 31 source_web_contents()); |
| 32 } |
| 33 |
23 bool ContextMenuContentTypeWebView::SupportsGroup(int group) { | 34 bool ContextMenuContentTypeWebView::SupportsGroup(int group) { |
24 switch (group) { | 35 switch (group) { |
25 case ITEM_GROUP_PAGE: | 36 case ITEM_GROUP_PAGE: |
26 case ITEM_GROUP_FRAME: | 37 case ITEM_GROUP_FRAME: |
27 case ITEM_GROUP_LINK: | 38 case ITEM_GROUP_LINK: |
28 case ITEM_GROUP_SEARCHWEBFORIMAGE: | 39 case ITEM_GROUP_SEARCHWEBFORIMAGE: |
29 case ITEM_GROUP_SEARCH_PROVIDER: | 40 case ITEM_GROUP_SEARCH_PROVIDER: |
30 case ITEM_GROUP_PRINT: | 41 case ITEM_GROUP_PRINT: |
31 case ITEM_GROUP_ALL_EXTENSION: | 42 case ITEM_GROUP_ALL_EXTENSION: |
32 case ITEM_GROUP_PRINT_PREVIEW: | 43 case ITEM_GROUP_PRINT_PREVIEW: |
(...skipping 26 matching lines...) Expand all Loading... |
59 base::CommandLine::ForCurrentProcess()->HasSwitch( | 70 base::CommandLine::ForCurrentProcess()->HasSwitch( |
60 switches::kDebugPackedApps); | 71 switches::kDebugPackedApps); |
61 #else | 72 #else |
62 return ContextMenuContentType::SupportsGroup(group); | 73 return ContextMenuContentType::SupportsGroup(group); |
63 #endif | 74 #endif |
64 } | 75 } |
65 default: | 76 default: |
66 return ContextMenuContentType::SupportsGroup(group); | 77 return ContextMenuContentType::SupportsGroup(group); |
67 } | 78 } |
68 } | 79 } |
OLD | NEW |