Revert 71415 - Revert 71377 - Added loading of nested BHO.

BUG=none
TEST=none

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

TBR=vitalybuka@chromium.org
Review URL: http://codereview.chromium.org/6313002

TBR=vitalybuka@chromium.org

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72281 0039d316-1c4b-4281-b951-d872f2087c98
parent 75437f00
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "base/json/json_reader.h" #include "base/json/json_reader.h"
#include "base/json/json_writer.h" #include "base/json/json_writer.h"
#include "base/logging.h" #include "base/logging.h"
#include "base/string_split.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/tuple.h" #include "base/tuple.h"
#include "base/utf_string_conversions.h" #include "base/utf_string_conversions.h"
...@@ -120,6 +121,32 @@ HRESULT BrowserHelperObject::FinalConstruct() { ...@@ -120,6 +121,32 @@ HRESULT BrowserHelperObject::FinalConstruct() {
"Refused to instantiate the BHO when the visual component is hidden."; "Refused to instantiate the BHO when the visual component is hidden.";
return E_FAIL; return E_FAIL;
} }
const wchar_t* bho_list = NULL;
::LoadString(_pModule->m_hInstResource, IDS_CEEE_NESTED_BHO_LIST,
reinterpret_cast<wchar_t*>(&bho_list), 0);
if (bho_list == NULL) {
LOG(ERROR) << "Failed to load string: " << GetLastError();
} else {
std::vector<std::wstring> guids;
base::SplitString(bho_list, ',', &guids);
for (size_t i = 0; i < guids.size(); ++i) {
CLSID clsid;
base::win::ScopedComPtr<IObjectWithSite> factory;
HRESULT hr = ::CLSIDFromString(guids[i].c_str(), &clsid);
if (SUCCEEDED(hr)) {
hr = factory.CreateInstance(clsid);
if (SUCCEEDED(hr)) {
nested_bho_.push_back(factory);
} else {
LOG(ERROR) << "Failed to load " << guids[i] << " " << com::LogWe(hr);
}
} else {
LOG(ERROR) << "Invalid CLSID " << guids[i] << " " << com::LogWe(hr);
}
}
}
return S_OK; return S_OK;
} }
...@@ -128,6 +155,7 @@ void BrowserHelperObject::FinalRelease() { ...@@ -128,6 +155,7 @@ void BrowserHelperObject::FinalRelease() {
// for unit testing. // for unit testing.
broker_rpc().Disconnect(); broker_rpc().Disconnect();
web_browser_.Release(); web_browser_.Release();
nested_bho_.clear();
} }
void BrowserHelperObject::ReportAddonTimes(const char* name, void BrowserHelperObject::ReportAddonTimes(const char* name,
...@@ -165,7 +193,11 @@ void BrowserHelperObject::ReportSingleAddonTime(const char* name, ...@@ -165,7 +193,11 @@ void BrowserHelperObject::ReportSingleAddonTime(const char* name,
} }
STDMETHODIMP BrowserHelperObject::SetSite(IUnknown* site) { STDMETHODIMP BrowserHelperObject::SetSite(IUnknown* site) {
typedef IObjectWithSiteImpl<BrowserHelperObject> SuperSite; for (size_t i = 0; i < nested_bho_.size(); ++i) {
HRESULT hr = nested_bho_[i]->SetSite(site);
LOG_IF(ERROR, FAILED(hr)) << "Failed to set site of nested BHO" <<
com::LogWe(hr);
}
// From experience, we know the site may be set multiple times. // From experience, we know the site may be set multiple times.
// Let's ignore second and subsequent set or unset. // Let's ignore second and subsequent set or unset.
...@@ -193,6 +225,7 @@ STDMETHODIMP BrowserHelperObject::SetSite(IUnknown* site) { ...@@ -193,6 +225,7 @@ STDMETHODIMP BrowserHelperObject::SetSite(IUnknown* site) {
FireOnUnmappedEvent(); FireOnUnmappedEvent();
} }
typedef IObjectWithSiteImpl<BrowserHelperObject> SuperSite;
HRESULT hr = SuperSite::SetSite(site); HRESULT hr = SuperSite::SetSite(site);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
#include "broker_lib.h" // NOLINT #include "broker_lib.h" // NOLINT
#include "toolband.h" // NOLINT #include "toolband.h" // NOLINT
struct IObjectWithSite;
// Implementation of an IE browser helper object. // Implementation of an IE browser helper object.
class ATL_NO_VTABLE BrowserHelperObject class ATL_NO_VTABLE BrowserHelperObject
: public CComObjectRootEx<CComSingleThreadModel>, : public CComObjectRootEx<CComSingleThreadModel>,
...@@ -464,6 +466,10 @@ class ATL_NO_VTABLE BrowserHelperObject ...@@ -464,6 +466,10 @@ class ATL_NO_VTABLE BrowserHelperObject
// Used to dispatch tab events back to Chrome. // Used to dispatch tab events back to Chrome.
TabEventsFunnel tab_events_funnel_; TabEventsFunnel tab_events_funnel_;
// List of BHOs which could be unregistered from IE and loaded by
// CEEE instead.
std::vector<base::win::ScopedComPtr<IObjectWithSite> > nested_bho_;
}; };
#endif // CEEE_IE_PLUGIN_BHO_BROWSER_HELPER_OBJECT_H_ #endif // CEEE_IE_PLUGIN_BHO_BROWSER_HELPER_OBJECT_H_
// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ceee/ie/plugin/toolband/resource.h"
STRINGTABLE
BEGIN
IDS_CEEE_NESTED_BHO_LIST ""
END
\ No newline at end of file
...@@ -34,5 +34,7 @@ ...@@ -34,5 +34,7 @@
#endif #endif
#endif #endif
#define IDS_CEEE_NESTED_BHO_LIST 500
#endif // CEEE_IE_PLUGIN_TOOLBAND_RESOURCE_H_ #endif // CEEE_IE_PLUGIN_TOOLBAND_RESOURCE_H_
...@@ -56,6 +56,18 @@ ...@@ -56,6 +56,18 @@
'<(DEPTH)/chrome/chrome.gyp:chrome_version_header', '<(DEPTH)/chrome/chrome.gyp:chrome_version_header',
'<(DEPTH)/chrome_frame/chrome_frame.gyp:chrome_tab_idl', '<(DEPTH)/chrome_frame/chrome_frame.gyp:chrome_tab_idl',
], ],
'conditions': [
[ 'branding == "Chrome"', {
'variables': {
'brand_specific_resources':
'../../../internal/toolband/brand_specific_resources.rc',
},
}, { # else branding != "Chrome"
'variables': {
'brand_specific_resources': 'brand_specific_resources.rc',
},
}],
],
'sources': [ 'sources': [
'resource.h', 'resource.h',
'tool_band.rgs', 'tool_band.rgs',
...@@ -65,6 +77,7 @@ ...@@ -65,6 +77,7 @@
'../bho/browser_helper_object.rgs', '../bho/browser_helper_object.rgs',
'../executor.rgs', '../executor.rgs',
'../scripting/content_script_manager.rc', '../scripting/content_script_manager.rc',
'<(brand_specific_resources)',
], ],
'libraries': [ 'libraries': [
'iepmapi.lib', 'iepmapi.lib',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment