Skip to content

Commit

Permalink
Revert r108744, r108753 - "Modify code in chrome to call wrapper func…
Browse files Browse the repository at this point in the history
…tions on PluginService"

TBR=jam@chromium.org

Review URL: http://codereview.chromium.org/8475020

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108760 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
dpranke@chromium.org committed Nov 5, 2011
1 parent 5a5fdc0 commit 47217cf
Show file tree
Hide file tree
Showing 26 changed files with 132 additions and 150 deletions.
10 changes: 8 additions & 2 deletions chrome/browser/browser_process_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
#include "chrome/common/chrome_notification_types.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/default_plugin.h"
#include "chrome/common/extensions/extension_l10n_util.h"
#include "chrome/common/extensions/extension_resource.h"
#include "chrome/common/json_pref_store.h"
Expand Down Expand Up @@ -89,6 +90,7 @@
#include "net/url_request/url_request_context_getter.h"
#include "ui/base/clipboard/clipboard.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/plugins/npapi/plugin_list.h"

#if defined(OS_WIN)
#include "views/focus/view_storage.h"
Expand Down Expand Up @@ -790,20 +792,24 @@ void BrowserProcessImpl::CreateIOThread() {
plugin_service->set_filter(ChromePluginServiceFilter::GetInstance());
plugin_service->StartWatchingPlugins();

// Add the Chrome specific plugins.
chrome::RegisterInternalDefaultPlugin();

// Register the internal Flash if available.
FilePath path;
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kDisableInternalFlash) &&
PathService::Get(chrome::FILE_FLASH_PLUGIN, &path)) {
plugin_service->AddExtraPluginPath(path);
webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(path);
}

#if defined(OS_POSIX)
// Also find plugins in a user-specific plugins dir,
// e.g. ~/.config/chromium/Plugins.
FilePath user_data_dir;
if (PathService::Get(chrome::DIR_USER_DATA, &user_data_dir)) {
plugin_service->AddExtraPluginPath(user_data_dir.Append("Plugins"));
webkit::npapi::PluginList::Singleton()->AddExtraPluginDir(
user_data_dir.Append("Plugins"));
}
#endif

Expand Down
11 changes: 6 additions & 5 deletions chrome/browser/chromeos/gview_request_interceptor_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
#include "net/url_request/url_request_test_job.h"
#include "net/url_request/url_request_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "webkit/plugins/npapi/plugin_list.h"

using content::BrowserThread;

Expand Down Expand Up @@ -115,7 +116,7 @@ class GViewRequestInterceptorTest : public testing::Test {

handler_ = new content::DummyResourceHandler();

PluginService::GetInstance()->RefreshPlugins();
PluginService::GetInstance()->RefreshPluginList();
PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop));
MessageLoop::current()->RunAllPending();
}
Expand All @@ -139,17 +140,17 @@ class GViewRequestInterceptorTest : public testing::Test {
void RegisterPDFPlugin() {
webkit::WebPluginInfo info;
info.path = pdf_path_;
PluginService::GetInstance()->RegisterInternalPlugin(info);
webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info);

PluginService::GetInstance()->RefreshPlugins();
PluginService::GetInstance()->RefreshPluginList();
PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop));
MessageLoop::current()->RunAllPending();
}

void UnregisterPDFPlugin() {
PluginService::GetInstance()->UnregisterInternalPlugin(pdf_path_);
webkit::npapi::PluginList::Singleton()->UnregisterInternalPlugin(pdf_path_);

PluginService::GetInstance()->RefreshPlugins();
PluginService::GetInstance()->RefreshPluginList();
PluginService::GetInstance()->GetPlugins(base::Bind(&QuitMessageLoop));
MessageLoop::current()->RunAllPending();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "chrome/common/chrome_paths.h"
#include "content/browser/plugin_service.h"
#include "content/public/browser/browser_thread.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/webplugininfo.h"

using content::BrowserThread;
Expand Down Expand Up @@ -106,7 +107,7 @@ bool NPAPIFlashComponentInstaller::Install(base::DictionaryValue* manifest,
return false;
// Installation is done. Now tell the rest of chrome.
current_version_ = version;
PluginService::GetInstance()->RefreshPlugins();
webkit::npapi::PluginList::Singleton()->RefreshPlugins();
return true;
}

Expand Down Expand Up @@ -203,9 +204,10 @@ void StartFlashUpdateRegistration(ComponentUpdateService* cus,
// the information for free.
void RegisterNPAPIFlashComponent(ComponentUpdateService* cus) {
#if !defined(OS_CHROMEOS)
webkit::npapi::PluginList* plugins = webkit::npapi::PluginList::Singleton();
FilePath path = GetNPAPIFlashBaseDirectory().Append(kFlashPluginFileName);
PluginService::GetInstance()->AddExtraPluginPath(path);
PluginService::GetInstance()->RefreshPlugins();
plugins->AddExtraPluginPath(path);
plugins->RefreshPlugins();

// Post the task to the FILE thread because IO may be done once the plugins
// are loaded.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
#include "chrome/browser/component_updater/component_updater_service.h"
#include "chrome/browser/plugin_prefs.h"
#include "chrome/common/chrome_paths.h"
#include "content/browser/plugin_service.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/pepper_plugin_info.h"
#include "ppapi/c/private/ppb_pdf.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/plugin_constants.h"
#include "webkit/plugins/ppapi/plugin_module.h"

Expand Down Expand Up @@ -167,9 +167,9 @@ void RegisterPepperFlashWithChrome(const FilePath& path,
if (!MakePepperFlashPluginInfo(path, version, true, &plugin_info))
return;
PluginPrefs::EnablePluginGlobally(kEnablePepperFlash, plugin_info.path);
PluginService::GetInstance()->RegisterInternalPlugin(
webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
plugin_info.ToWebPluginInfo());
PluginService::GetInstance()->RefreshPlugins();
webkit::npapi::PluginList::Singleton()->RefreshPlugins();
}

} // namespace
Expand Down Expand Up @@ -321,8 +321,8 @@ void StartPepperFlashUpdateRegistration(ComponentUpdateService* cus) {
} // namespace

void RegisterPepperFlashComponent(ComponentUpdateService* cus) {
// #if defined(GOOGLE_CHROME_BUILD)
//#if defined(GOOGLE_CHROME_BUILD)
BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE,
NewRunnableFunction(&StartPepperFlashUpdateRegistration, cus));
// #endif
//#endif
}
16 changes: 9 additions & 7 deletions chrome/browser/extensions/extension_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
#include "net/base/registry_controlled_domain.h"
#include "webkit/database/database_tracker.h"
#include "webkit/database/database_util.h"
#include "webkit/plugins/npapi/plugin_list.h"

#if defined(OS_CHROMEOS)
#include "chrome/browser/chromeos/cros/cros_library.h"
Expand Down Expand Up @@ -968,8 +969,8 @@ void ExtensionService::NotifyExtensionLoaded(const Extension* extension) {
bool plugins_changed = false;
for (size_t i = 0; i < extension->plugins().size(); ++i) {
const Extension::PluginInfo& plugin = extension->plugins()[i];
PluginService::GetInstance()->RefreshPlugins();
PluginService::GetInstance()->AddExtraPluginPath(plugin.path);
webkit::npapi::PluginList::Singleton()->RefreshPlugins();
webkit::npapi::PluginList::Singleton()->AddExtraPluginPath(plugin.path);
plugins_changed = true;
ChromePluginServiceFilter* filter =
ChromePluginServiceFilter::GetInstance();
Expand Down Expand Up @@ -1067,8 +1068,9 @@ void ExtensionService::NotifyExtensionUnloaded(
if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
base::Bind(&ForceShutdownPlugin, plugin.path)))
NOTREACHED();
PluginService::GetInstance()->RefreshPlugins();
PluginService::GetInstance()->RemoveExtraPluginPath(plugin.path);
webkit::npapi::PluginList::Singleton()->RefreshPlugins();
webkit::npapi::PluginList::Singleton()->RemoveExtraPluginPath(
plugin.path);
plugins_changed = true;
ChromePluginServiceFilter::GetInstance()->UnrestrictPlugin(plugin.path);
}
Expand Down Expand Up @@ -2447,7 +2449,7 @@ void ExtensionService::UpdatePluginListWithNaClModules() {
if (mime_iter->mime_type == kNaClPluginMimeType) {
// This plugin handles "application/x-nacl".

PluginService::GetInstance()->
webkit::npapi::PluginList::Singleton()->
UnregisterInternalPlugin(pepper_info->path);

webkit::WebPluginInfo info = pepper_info->ToWebPluginInfo();
Expand All @@ -2466,8 +2468,8 @@ void ExtensionService::UpdatePluginListWithNaClModules() {
info.mime_types.push_back(mime_type_info);
}

PluginService::GetInstance()->RefreshPlugins();
PluginService::GetInstance()->RegisterInternalPlugin(info);
webkit::npapi::PluginList::Singleton()->RefreshPlugins();
webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(info);
// This plugin has been modified, no need to check the rest of its
// types, but continue checking other plugins.
break;
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/metrics/metrics_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
#include "content/common/child_process_info.h"
#include "content/public/browser/notification_service.h"
#include "content/public/common/url_fetcher.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/webplugininfo.h"

// TODO(port): port browser_distribution.h.
Expand Down
1 change: 1 addition & 0 deletions chrome/browser/plugin_observer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/plugins/npapi/plugin_group.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/webplugininfo.h"

namespace {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/plugin_prefs.cc
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,7 @@ void PluginPrefs::SetPolicyEnforcedPluginPatterns(
webkit::npapi::PluginList* PluginPrefs::GetPluginList() {
if (plugin_list_)
return plugin_list_;
return PluginService::GetInstance()->GetPluginList();
return webkit::npapi::PluginList::Singleton();
}

void PluginPrefs::GetPreferencesDataOnFileThread() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@
#import "chrome/browser/ui/cocoa/hyperlink_button_cell.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
#import "chrome/browser/ui/cocoa/l10n_util.h"
#include "content/browser/plugin_service.h"
#include "grit/generated_resources.h"
#include "skia/ext/skia_utils_mac.h"
#import "third_party/GTM/AppKit/GTMUILocalizerAndLayoutTweaker.h"
#include "ui/base/l10n/l10n_util.h"
#include "webkit/plugins/npapi/plugin_list.h"

namespace {

Expand Down Expand Up @@ -245,7 +245,7 @@ - (void)initializeBlockedPluginsList {
for (std::set<std::string>::iterator it = plugins.begin();
it != plugins.end(); ++it) {
NSString* name = SysUTF16ToNSString(
PluginService::GetInstance()->GetPluginGroupName(*it));
webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it));
if ([name length] == 0)
name = base::SysUTF8ToNSString(*it);
[pluginArray addObject:name];
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/gtk/content_setting_bubble_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
#include "chrome/browser/ui/gtk/gtk_theme_service.h"
#include "chrome/browser/ui/gtk/gtk_util.h"
#include "chrome/common/content_settings.h"
#include "content/browser/plugin_service.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
Expand All @@ -27,6 +26,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/text/text_elider.h"
#include "ui/gfx/gtk_util.h"
#include "webkit/plugins/npapi/plugin_list.h"

namespace {

Expand Down Expand Up @@ -109,7 +109,7 @@ void ContentSettingBubbleGtk::BuildBubble() {
for (std::set<std::string>::const_iterator it = plugins.begin();
it != plugins.end(); ++it) {
std::string name = UTF16ToUTF8(
PluginService::GetInstance()->GetPluginGroupName(*it));
webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it));
if (name.empty())
name = *it;

Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/views/content_setting_bubble_contents.cc
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include "chrome/browser/ui/content_settings/content_setting_bubble_model.h"
#include "chrome/browser/ui/views/browser_dialogs.h"
#include "chrome/browser/ui/views/bubble/bubble.h"
#include "content/browser/plugin_service.h"
#include "content/browser/tab_contents/tab_contents.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
Expand All @@ -33,6 +32,7 @@
#include "views/controls/separator.h"
#include "views/layout/grid_layout.h"
#include "views/layout/layout_constants.h"
#include "webkit/plugins/npapi/plugin_list.h"

#if defined(TOOLKIT_USES_GTK)
#include "ui/gfx/gtk_util.h"
Expand Down Expand Up @@ -217,7 +217,7 @@ void ContentSettingBubbleContents::InitControlLayout() {
for (std::set<std::string>::const_iterator it = plugins.begin();
it != plugins.end(); ++it) {
string16 name =
PluginService::GetInstance()->GetPluginGroupName(*it);
webkit::npapi::PluginList::Singleton()->GetPluginGroupName(*it);
if (name.empty())
name = UTF8ToUTF16(*it);
layout->StartRow(0, single_column_set_id);
Expand Down
2 changes: 2 additions & 0 deletions chrome/chrome_common.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@
'common/content_settings_types.h',
'common/custom_handlers/protocol_handler.cc',
'common/custom_handlers/protocol_handler.h',
'common/default_plugin.cc',
'common/default_plugin.h',
'common/extensions/extension.cc',
'common/extensions/extension.h',
'common/extensions/extension_action.cc',
Expand Down
34 changes: 0 additions & 34 deletions chrome/common/chrome_content_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,17 @@
#include "base/stringprintf.h"
#include "base/string_split.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "base/win/windows_version.h"
#include "chrome/common/child_process_logging.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/chrome_version_info.h"
#include "chrome/common/render_messages.h"
#include "chrome/default_plugin/plugin_main.h"
#include "content/public/common/pepper_plugin_info.h"
#include "remoting/client/plugin/pepper_entrypoints.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "webkit/glue/user_agent.h"
#include "webkit/plugins/npapi/plugin_list.h"
#include "webkit/plugins/plugin_constants.h"

#if defined(OS_WIN)
Expand Down Expand Up @@ -269,37 +266,6 @@ void ChromeContentClient::AddPepperPlugins(
AddOutOfProcessFlash(plugins);
}

void ChromeContentClient::AddNPAPIPlugins(
webkit::npapi::PluginList* plugin_list) {
#if defined(OS_WIN) && !defined(USE_AURA)
// TODO(bauerb): On Windows the default plug-in can download and install
// missing plug-ins, which we don't support in the browser yet, so keep
// using the default plug-in on Windows until we do.
// Aura isn't going to support NPAPI plugins.
const webkit::npapi::PluginEntryPoints entry_points = {
default_plugin::NP_GetEntryPoints,
default_plugin::NP_Initialize,
default_plugin::NP_Shutdown
};

webkit::WebPluginInfo info;
info.path = FilePath(webkit::npapi::kDefaultPluginLibraryName);
info.name = ASCIIToUTF16("Default Plug-in");
info.version = ASCIIToUTF16("1");
info.desc = ASCIIToUTF16("Provides functionality for installing third-party "
"plug-ins");

webkit::WebPluginMimeType mimeType;
mimeType.mime_type = "*";
info.mime_types.push_back(mimeType);

webkit::npapi::PluginList::Singleton()->RegisterInternalPlugin(
info,
entry_points,
false);
#endif
}

bool ChromeContentClient::CanSendWhileSwappedOut(const IPC::Message* msg) {
// Any Chrome-specific messages that must be allowed to be sent from swapped
// out renderers.
Expand Down
2 changes: 0 additions & 2 deletions chrome/common/chrome_content_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ class ChromeContentClient : public content::ContentClient {
virtual void SetGpuInfo(const content::GPUInfo& gpu_info) OVERRIDE;
virtual void AddPepperPlugins(
std::vector<content::PepperPluginInfo>* plugins) OVERRIDE;
virtual void AddNPAPIPlugins(
webkit::npapi::PluginList* plugin_list) OVERRIDE;
virtual bool CanSendWhileSwappedOut(const IPC::Message* msg) OVERRIDE;
virtual bool CanHandleWhileSwappedOut(const IPC::Message& msg) OVERRIDE;
virtual std::string GetUserAgent(bool* overriding) const OVERRIDE;
Expand Down
Loading

0 comments on commit 47217cf

Please sign in to comment.