Chromium Code Reviews| Index: ceee/ie/plugin/bho/browser_helper_object.cc |
| =================================================================== |
| --- ceee/ie/plugin/bho/browser_helper_object.cc (revision 70433) |
| +++ ceee/ie/plugin/bho/browser_helper_object.cc (working copy) |
| @@ -14,6 +14,7 @@ |
| #include "base/json/json_reader.h" |
| #include "base/json/json_writer.h" |
| #include "base/logging.h" |
| +#include "base/string_split.h" |
| #include "base/string_util.h" |
| #include "base/tuple.h" |
| #include "base/utf_string_conversions.h" |
| @@ -120,6 +121,25 @@ |
| "Refused to instantiate the BHO when the visual component is hidden."; |
| 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; |
| + if (SUCCEEDED(CLSIDFromString(guids[i].c_str(), &clsid)) && |
| + SUCCEEDED(factory.CreateInstance(clsid))) { |
| + nested_bho_.push_back(factory); |
| + } |
| + } |
| + } |
| + |
| return S_OK; |
| } |
| @@ -128,6 +148,7 @@ |
| // for unit testing. |
| broker_rpc().Disconnect(); |
| web_browser_.Release(); |
| + nested_bho_.clear(); |
| } |
| void BrowserHelperObject::ReportAddonTimes(const char* name, |
| @@ -165,7 +186,11 @@ |
| } |
| STDMETHODIMP BrowserHelperObject::SetSite(IUnknown* site) { |
| - typedef IObjectWithSiteImpl<BrowserHelperObject> SuperSite; |
| + for (size_t i = 0; i < nested_bho_.size(); ++i) { |
|
Jói
2011/01/13 01:22:11
I think this should go below the duplicate detecti
Vitaly Buka corp
2011/01/13 01:46:17
In common case we don't know how nested BHO handle
Jói
2011/01/13 19:18:03
OK, leave this as is then.
Sigurður Ásgeirsson
2011/01/13 19:34:15
Interesting, you're quite right. I think I aped th
Vitaly Buka corp
2011/01/13 21:06:45
I guess this is not possible with IE, but classic
|
| + 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. |
| // Let's ignore second and subsequent set or unset. |
| @@ -193,6 +218,7 @@ |
| FireOnUnmappedEvent(); |
| } |
| + typedef IObjectWithSiteImpl<BrowserHelperObject> SuperSite; |
| HRESULT hr = SuperSite::SetSite(site); |
| if (FAILED(hr)) |
| return hr; |