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/renderer_context_menu/context_menu_content_type_factory
.h" | 5 #include "chrome/browser/renderer_context_menu/context_menu_content_type_factory
.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "components/renderer_context_menu/context_menu_content_type.h" | 9 #include "components/renderer_context_menu/context_menu_content_type.h" |
10 #include "content/public/browser/web_contents.h" | 10 #include "content/public/browser/web_contents.h" |
11 #include "content/public/common/url_constants.h" | 11 #include "content/public/common/url_constants.h" |
| 12 #include "extensions/features/features.h" |
12 | 13 |
13 #if defined(ENABLE_EXTENSIONS) | 14 #if BUILDFLAG(ENABLE_EXTENSIONS) |
14 #include "chrome/browser/app_mode/app_mode_utils.h" | 15 #include "chrome/browser/app_mode/app_mode_utils.h" |
15 #include "chrome/browser/guest_view/web_view/context_menu_content_type_web_view.
h" | 16 #include "chrome/browser/guest_view/web_view/context_menu_content_type_web_view.
h" |
16 #include "chrome/browser/renderer_context_menu/context_menu_content_type_app_mod
e.h" | 17 #include "chrome/browser/renderer_context_menu/context_menu_content_type_app_mod
e.h" |
17 #include "chrome/browser/renderer_context_menu/context_menu_content_type_extensi
on_popup.h" | 18 #include "chrome/browser/renderer_context_menu/context_menu_content_type_extensi
on_popup.h" |
18 #include "chrome/browser/renderer_context_menu/context_menu_content_type_panel.h
" | 19 #include "chrome/browser/renderer_context_menu/context_menu_content_type_panel.h
" |
19 #include "chrome/browser/renderer_context_menu/context_menu_content_type_platfor
m_app.h" | 20 #include "chrome/browser/renderer_context_menu/context_menu_content_type_platfor
m_app.h" |
20 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 21 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
21 #include "extensions/browser/view_type_utils.h" | 22 #include "extensions/browser/view_type_utils.h" |
22 #include "extensions/common/extension.h" | 23 #include "extensions/common/extension.h" |
23 #endif | 24 #endif |
(...skipping 26 matching lines...) Expand all Loading... |
50 ContextMenuContentType* content_type) { | 51 ContextMenuContentType* content_type) { |
51 content_type->set_internal_resources_url_checker( | 52 content_type->set_internal_resources_url_checker( |
52 base::Bind(&CheckInternalResourcesURL)); | 53 base::Bind(&CheckInternalResourcesURL)); |
53 return content_type; | 54 return content_type; |
54 } | 55 } |
55 | 56 |
56 // static | 57 // static |
57 ContextMenuContentType* ContextMenuContentTypeFactory::CreateInternal( | 58 ContextMenuContentType* ContextMenuContentTypeFactory::CreateInternal( |
58 content::WebContents* web_contents, | 59 content::WebContents* web_contents, |
59 const content::ContextMenuParams& params) { | 60 const content::ContextMenuParams& params) { |
60 #if defined(ENABLE_EXTENSIONS) | 61 #if BUILDFLAG(ENABLE_EXTENSIONS) |
61 if (extensions::WebViewGuest::FromWebContents(web_contents)) | 62 if (extensions::WebViewGuest::FromWebContents(web_contents)) |
62 return new ContextMenuContentTypeWebView(web_contents, params); | 63 return new ContextMenuContentTypeWebView(web_contents, params); |
63 | 64 |
64 if (chrome::IsRunningInForcedAppMode()) | 65 if (chrome::IsRunningInForcedAppMode()) |
65 return new ContextMenuContentTypeAppMode(web_contents, params); | 66 return new ContextMenuContentTypeAppMode(web_contents, params); |
66 | 67 |
67 const extensions::ViewType view_type = extensions::GetViewType(web_contents); | 68 const extensions::ViewType view_type = extensions::GetViewType(web_contents); |
68 | 69 |
69 if (view_type == extensions::VIEW_TYPE_APP_WINDOW || | 70 if (view_type == extensions::VIEW_TYPE_APP_WINDOW || |
70 view_type == extensions::VIEW_TYPE_LAUNCHER_PAGE) | 71 view_type == extensions::VIEW_TYPE_LAUNCHER_PAGE) |
71 return new ContextMenuContentTypePlatformApp(web_contents, params); | 72 return new ContextMenuContentTypePlatformApp(web_contents, params); |
72 | 73 |
73 if (view_type == extensions::VIEW_TYPE_EXTENSION_POPUP) | 74 if (view_type == extensions::VIEW_TYPE_EXTENSION_POPUP) |
74 return new ContextMenuContentTypeExtensionPopup(web_contents, params); | 75 return new ContextMenuContentTypeExtensionPopup(web_contents, params); |
75 | 76 |
76 if (view_type == extensions::VIEW_TYPE_PANEL) | 77 if (view_type == extensions::VIEW_TYPE_PANEL) |
77 return new ContextMenuContentTypePanel(web_contents, params); | 78 return new ContextMenuContentTypePanel(web_contents, params); |
78 #endif | 79 #endif |
79 | 80 |
80 return new ContextMenuContentType(web_contents, params, true); | 81 return new ContextMenuContentType(web_contents, params, true); |
81 } | 82 } |
OLD | NEW |