summaryrefslogtreecommitdiffstats
path: root/ceee
diff options
context:
space:
mode:
authorvitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-13 23:20:01 +0000
committervitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-01-13 23:20:01 +0000
commit93ef6ec0bdcf8a9b1bc0e886643e5e20546dc3e2 (patch)
treece61e00f0dd9e9a165d44d1d7811ba214a1aa1a9 /ceee
parent2a00cde32ae06885a5fc7926150c6ad02c0737b7 (diff)
downloadchromium_src-93ef6ec0bdcf8a9b1bc0e886643e5e20546dc3e2.zip
chromium_src-93ef6ec0bdcf8a9b1bc0e886643e5e20546dc3e2.tar.gz
chromium_src-93ef6ec0bdcf8a9b1bc0e886643e5e20546dc3e2.tar.bz2
Added loading of nested BHO.
BUG=none TEST=none Review URL: http://codereview.chromium.org/6106004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71377 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee')
-rw-r--r--ceee/ie/plugin/bho/browser_helper_object.cc35
-rw-r--r--ceee/ie/plugin/bho/browser_helper_object.h6
-rw-r--r--ceee/ie/plugin/toolband/brand_specific_resources.rc10
-rw-r--r--ceee/ie/plugin/toolband/resource.h2
-rw-r--r--ceee/ie/plugin/toolband/toolband.gyp13
5 files changed, 65 insertions, 1 deletions
diff --git a/ceee/ie/plugin/bho/browser_helper_object.cc b/ceee/ie/plugin/bho/browser_helper_object.cc
index 93dc812..aa1b426 100644
--- a/ceee/ie/plugin/bho/browser_helper_object.cc
+++ b/ceee/ie/plugin/bho/browser_helper_object.cc
@@ -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,32 @@ HRESULT BrowserHelperObject::FinalConstruct() {
"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;
+ 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;
}
@@ -128,6 +155,7 @@ void BrowserHelperObject::FinalRelease() {
// for unit testing.
broker_rpc().Disconnect();
web_browser_.Release();
+ nested_bho_.clear();
}
void BrowserHelperObject::ReportAddonTimes(const char* name,
@@ -165,7 +193,11 @@ void BrowserHelperObject::ReportSingleAddonTime(const char* name,
}
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.
// Let's ignore second and subsequent set or unset.
@@ -193,6 +225,7 @@ STDMETHODIMP BrowserHelperObject::SetSite(IUnknown* site) {
FireOnUnmappedEvent();
}
+ typedef IObjectWithSiteImpl<BrowserHelperObject> SuperSite;
HRESULT hr = SuperSite::SetSite(site);
if (FAILED(hr))
return hr;
diff --git a/ceee/ie/plugin/bho/browser_helper_object.h b/ceee/ie/plugin/bho/browser_helper_object.h
index 7ff1688..72db7f8 100644
--- a/ceee/ie/plugin/bho/browser_helper_object.h
+++ b/ceee/ie/plugin/bho/browser_helper_object.h
@@ -38,6 +38,8 @@
#include "broker_lib.h" // NOLINT
#include "toolband.h" // NOLINT
+struct IObjectWithSite;
+
// Implementation of an IE browser helper object.
class ATL_NO_VTABLE BrowserHelperObject
: public CComObjectRootEx<CComSingleThreadModel>,
@@ -464,6 +466,10 @@ class ATL_NO_VTABLE BrowserHelperObject
// Used to dispatch tab events back to Chrome.
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_
diff --git a/ceee/ie/plugin/toolband/brand_specific_resources.rc b/ceee/ie/plugin/toolband/brand_specific_resources.rc
new file mode 100644
index 0000000..42c1b80
--- /dev/null
+++ b/ceee/ie/plugin/toolband/brand_specific_resources.rc
@@ -0,0 +1,10 @@
+// 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
diff --git a/ceee/ie/plugin/toolband/resource.h b/ceee/ie/plugin/toolband/resource.h
index f9af331..919ca1a 100644
--- a/ceee/ie/plugin/toolband/resource.h
+++ b/ceee/ie/plugin/toolband/resource.h
@@ -34,5 +34,7 @@
#endif
#endif
+#define IDS_CEEE_NESTED_BHO_LIST 500
+
#endif // CEEE_IE_PLUGIN_TOOLBAND_RESOURCE_H_
diff --git a/ceee/ie/plugin/toolband/toolband.gyp b/ceee/ie/plugin/toolband/toolband.gyp
index 3b9a077..a454662 100644
--- a/ceee/ie/plugin/toolband/toolband.gyp
+++ b/ceee/ie/plugin/toolband/toolband.gyp
@@ -56,6 +56,18 @@
'<(DEPTH)/chrome/chrome.gyp:chrome_version_header',
'<(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': [
'resource.h',
'tool_band.rgs',
@@ -65,6 +77,7 @@
'../bho/browser_helper_object.rgs',
'../executor.rgs',
'../scripting/content_script_manager.rc',
+ '<(brand_specific_resources)',
],
'libraries': [
'iepmapi.lib',