| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/ui/webui/options/extension_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/extension_settings_handler.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/base64.h" | 8 #include "base/base64.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| 11 #include "base/command_line.h" |
| 11 #include "base/file_util.h" | 12 #include "base/file_util.h" |
| 12 #include "base/string_number_conversions.h" | 13 #include "base/string_number_conversions.h" |
| 13 #include "base/utf_string_conversions.h" | 14 #include "base/utf_string_conversions.h" |
| 14 #include "base/values.h" | 15 #include "base/values.h" |
| 15 #include "base/version.h" | 16 #include "base/version.h" |
| 16 #include "chrome/browser/debugger/devtools_window.h" | 17 #include "chrome/browser/debugger/devtools_window.h" |
| 17 #include "chrome/browser/extensions/crx_installer.h" | 18 #include "chrome/browser/extensions/crx_installer.h" |
| 18 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" | 19 #include "chrome/browser/extensions/extension_disabled_infobar_delegate.h" |
| 19 #include "chrome/browser/extensions/extension_service.h" | 20 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/extensions/extension_updater.h" | 21 #include "chrome/browser/extensions/extension_updater.h" |
| 21 #include "chrome/browser/extensions/extension_warning_set.h" | 22 #include "chrome/browser/extensions/extension_warning_set.h" |
| 22 #include "chrome/browser/google/google_util.h" | 23 #include "chrome/browser/google/google_util.h" |
| 23 #include "chrome/browser/profiles/profile.h" | 24 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/tab_contents/background_contents.h" | 25 #include "chrome/browser/tab_contents/background_contents.h" |
| 25 #include "chrome/browser/ui/webui/extension_icon_source.h" | 26 #include "chrome/browser/ui/webui/extension_icon_source.h" |
| 27 #include "chrome/common/chrome_switches.h" |
| 28 #include "chrome/common/chrome_view_types.h" |
| 26 #include "chrome/common/extensions/extension.h" | 29 #include "chrome/common/extensions/extension.h" |
| 27 #include "chrome/common/pref_names.h" | 30 #include "chrome/common/pref_names.h" |
| 28 #include "chrome/common/url_constants.h" | 31 #include "chrome/common/url_constants.h" |
| 29 #include "chrome/common/chrome_view_types.h" | |
| 30 #include "content/browser/browsing_instance.h" | 32 #include "content/browser/browsing_instance.h" |
| 31 #include "content/browser/renderer_host/render_view_host.h" | 33 #include "content/browser/renderer_host/render_view_host.h" |
| 32 #include "content/browser/tab_contents/tab_contents.h" | 34 #include "content/browser/tab_contents/tab_contents.h" |
| 33 #include "content/browser/tab_contents/tab_contents_view.h" | 35 #include "content/browser/tab_contents/tab_contents_view.h" |
| 34 #include "content/public/browser/notification_service.h" | 36 #include "content/public/browser/notification_service.h" |
| 35 #include "content/public/browser/notification_types.h" | 37 #include "content/public/browser/notification_types.h" |
| 36 #include "grit/browser_resources.h" | 38 #include "grit/browser_resources.h" |
| 37 #include "grit/chromium_strings.h" | 39 #include "grit/chromium_strings.h" |
| 38 #include "grit/generated_resources.h" | 40 #include "grit/generated_resources.h" |
| 39 #include "grit/theme_resources.h" | 41 #include "grit/theme_resources.h" |
| 40 #include "ui/base/l10n/l10n_util.h" | 42 #include "ui/base/l10n/l10n_util.h" |
| 41 #include "ui/base/resource/resource_bundle.h" | 43 #include "ui/base/resource/resource_bundle.h" |
| 42 | 44 |
| 43 namespace { | 45 namespace { |
| 44 | 46 |
| 45 bool ShouldShowExtension(const Extension* extension) { | 47 bool ShouldShowExtension(const Extension* extension) { |
| 46 // Don't show themes since this page's UI isn't really useful for themes. | 48 // Don't show themes since this page's UI isn't really useful for themes. |
| 47 if (extension->is_theme()) | 49 if (extension->is_theme()) |
| 48 return false; | 50 return false; |
| 49 | 51 |
| 50 // Don't show component extensions because they are only extensions as an | 52 // Don't show component extensions because they are only extensions as an |
| 51 // implementation detail of Chrome. | 53 // implementation detail of Chrome. |
| 52 if (extension->location() == Extension::COMPONENT) | 54 if (extension->location() == Extension::COMPONENT && |
| 55 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 56 switches::kShowComponentExtensionsInOptions)) |
| 53 return false; | 57 return false; |
| 54 | 58 |
| 55 // Always show unpacked extensions and apps. | 59 // Always show unpacked extensions and apps. |
| 56 if (extension->location() == Extension::LOAD) | 60 if (extension->location() == Extension::LOAD) |
| 57 return true; | 61 return true; |
| 58 | 62 |
| 59 // Unless they are unpacked, never show hosted apps. | 63 // Unless they are unpacked, never show hosted apps. |
| 60 if (extension->is_hosted_app()) | 64 if (extension->is_hosted_app()) |
| 61 return false; | 65 return false; |
| 62 | 66 |
| (...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 790 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) | 794 chrome::VIEW_TYPE_EXTENSION_DIALOG == host_type) |
| 791 continue; | 795 continue; |
| 792 | 796 |
| 793 GURL url = host->delegate()->GetURL(); | 797 GURL url = host->delegate()->GetURL(); |
| 794 RenderProcessHost* process = host->process(); | 798 RenderProcessHost* process = host->process(); |
| 795 result->push_back( | 799 result->push_back( |
| 796 ExtensionPage(url, process->id(), host->routing_id(), | 800 ExtensionPage(url, process->id(), host->routing_id(), |
| 797 process->browser_context()->IsOffTheRecord())); | 801 process->browser_context()->IsOffTheRecord())); |
| 798 } | 802 } |
| 799 } | 803 } |
| OLD | NEW |