| 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/channel_info.h" |
| 8 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
| 9 #include "chrome/common/chrome_version_info.h" | 10 #include "components/version_info/version_info.h" |
| 10 #include "extensions/browser/guest_view/web_view/web_view_guest.h" | 11 #include "extensions/browser/guest_view/web_view/web_view_guest.h" |
| 11 #include "extensions/browser/process_manager.h" | 12 #include "extensions/browser/process_manager.h" |
| 12 #include "extensions/common/extension.h" | 13 #include "extensions/common/extension.h" |
| 13 #include "extensions/common/manifest.h" | 14 #include "extensions/common/manifest.h" |
| 14 | 15 |
| 15 using extensions::Extension; | 16 using extensions::Extension; |
| 16 using extensions::ProcessManager; | 17 using extensions::ProcessManager; |
| 17 | 18 |
| 18 ContextMenuContentTypeWebView::ContextMenuContentTypeWebView( | 19 ContextMenuContentTypeWebView::ContextMenuContentTypeWebView( |
| 19 content::WebContents* web_contents, | 20 content::WebContents* web_contents, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 40 case ITEM_GROUP_SEARCH_PROVIDER: | 41 case ITEM_GROUP_SEARCH_PROVIDER: |
| 41 case ITEM_GROUP_PRINT: | 42 case ITEM_GROUP_PRINT: |
| 42 case ITEM_GROUP_ALL_EXTENSION: | 43 case ITEM_GROUP_ALL_EXTENSION: |
| 43 case ITEM_GROUP_PRINT_PREVIEW: | 44 case ITEM_GROUP_PRINT_PREVIEW: |
| 44 return false; | 45 return false; |
| 45 case ITEM_GROUP_CURRENT_EXTENSION: | 46 case ITEM_GROUP_CURRENT_EXTENSION: |
| 46 // Show contextMenus API items. | 47 // Show contextMenus API items. |
| 47 return true; | 48 return true; |
| 48 case ITEM_GROUP_DEVELOPER: | 49 case ITEM_GROUP_DEVELOPER: |
| 49 { | 50 { |
| 50 if (chrome::VersionInfo::GetChannel() >= | 51 if (chrome::GetChannel() >= version_info::Channel::DEV) { |
| 51 version_info::Channel::DEV) { | |
| 52 // Hide dev tools items in guests inside WebUI if we are not running | 52 // Hide dev tools items in guests inside WebUI if we are not running |
| 53 // canary or tott. | 53 // canary or tott. |
| 54 auto web_view_guest = | 54 auto web_view_guest = |
| 55 extensions::WebViewGuest::FromWebContents(source_web_contents()); | 55 extensions::WebViewGuest::FromWebContents(source_web_contents()); |
| 56 if (web_view_guest && | 56 if (web_view_guest && |
| 57 web_view_guest->owner_web_contents()->GetWebUI()) { | 57 web_view_guest->owner_web_contents()->GetWebUI()) { |
| 58 return false; | 58 return false; |
| 59 } | 59 } |
| 60 } | 60 } |
| 61 | 61 |
| 62 // TODO(lazyboy): Enable this for mac too when http://crbug.com/380405 | 62 // TODO(lazyboy): Enable this for mac too when http://crbug.com/380405 |
| 63 // is fixed. | 63 // is fixed. |
| 64 #if !defined(OS_MACOSX) | 64 #if !defined(OS_MACOSX) |
| 65 // Add dev tools for unpacked extensions. | 65 // Add dev tools for unpacked extensions. |
| 66 const extensions::Extension* embedder_platform_app = GetExtension(); | 66 const extensions::Extension* embedder_platform_app = GetExtension(); |
| 67 return !embedder_platform_app || | 67 return !embedder_platform_app || |
| 68 extensions::Manifest::IsUnpackedLocation( | 68 extensions::Manifest::IsUnpackedLocation( |
| 69 embedder_platform_app->location()) || | 69 embedder_platform_app->location()) || |
| 70 base::CommandLine::ForCurrentProcess()->HasSwitch( | 70 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 71 switches::kDebugPackedApps); | 71 switches::kDebugPackedApps); |
| 72 #else | 72 #else |
| 73 return ContextMenuContentType::SupportsGroup(group); | 73 return ContextMenuContentType::SupportsGroup(group); |
| 74 #endif | 74 #endif |
| 75 } | 75 } |
| 76 default: | 76 default: |
| 77 return ContextMenuContentType::SupportsGroup(group); | 77 return ContextMenuContentType::SupportsGroup(group); |
| 78 } | 78 } |
| 79 } | 79 } |
| OLD | NEW |