summaryrefslogtreecommitdiffstats
path: root/ceee/ie/broker/broker.cc
diff options
context:
space:
mode:
authorinitial.commit@chromium.org <initial.commit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-02 02:14:31 +0000
committerinitial.commit@chromium.org <initial.commit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-02 02:14:31 +0000
commit5a7bdf208c28c210b39cff63d1cf91302b02821b (patch)
tree5ff484561562f78b29d2670168a9e3b40b48dcab /ceee/ie/broker/broker.cc
parent26a54a5e0f4603c8fda2fe51789d331125993c9a (diff)
downloadchromium_src-5a7bdf208c28c210b39cff63d1cf91302b02821b.zip
chromium_src-5a7bdf208c28c210b39cff63d1cf91302b02821b.tar.gz
chromium_src-5a7bdf208c28c210b39cff63d1cf91302b02821b.tar.bz2
Checking in the initial version of CEEE (Chrome Extensions Execution
Environment), an optional feature of Chrome Frame that acts as an adapter layer for a subset of the Chrome Extension APIs. This enables extensions that stick to the supported subset of APIs to work in the context of Chrome Frame with minimal or sometimes no changes. See http://www.chromium.org/developers/design-documents/ceee for an overview of the design of CEEE. TEST=unit tests (run ceee/smoke_tests.bat as an administrator on Windows) BUG=none git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64712 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ceee/ie/broker/broker.cc')
-rw-r--r--ceee/ie/broker/broker.cc72
1 files changed, 72 insertions, 0 deletions
diff --git a/ceee/ie/broker/broker.cc b/ceee/ie/broker/broker.cc
new file mode 100644
index 0000000..24ed0da
--- /dev/null
+++ b/ceee/ie/broker/broker.cc
@@ -0,0 +1,72 @@
+// 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.
+//
+// ICeeeBroker implementation
+
+#include "ceee/ie/broker/broker.h"
+
+#include "base/logging.h"
+#include "ceee/ie/broker/api_dispatcher.h"
+#include "ceee/ie/broker/chrome_postman.h"
+#include "ceee/ie/broker/executors_manager.h"
+#include "ceee/ie/common/ceee_module_util.h"
+
+
+HRESULT CeeeBroker::FinalConstruct() {
+ // So that we get a pointer to the ExecutorsManager and let tests override it.
+ executors_manager_ = Singleton<ExecutorsManager,
+ ExecutorsManager::SingletonTraits>::get();
+ api_dispatcher_ = ProductionApiDispatcher::get();
+ return S_OK;
+}
+
+void CeeeBroker::OnAddConnection(bool first_lock) {
+ if (first_lock)
+ ceee_module_util::LockModule();
+}
+
+void CeeeBroker::OnReleaseConnection(bool last_unlock,
+ bool last_unlock_releases) {
+ if (last_unlock)
+ ceee_module_util::UnlockModule();
+ IExternalConnectionImpl<CeeeBroker>::OnReleaseConnection(
+ last_unlock, last_unlock_releases);
+}
+
+STDMETHODIMP CeeeBroker::Execute(BSTR function, BSTR* response) {
+ // This is DEPRECATED and we should use ChromePostman (see FireEvent).
+ api_dispatcher_->HandleApiRequest(function, response);
+ return S_OK;
+}
+
+STDMETHODIMP CeeeBroker::FireEvent(BSTR event_name, BSTR event_args) {
+ ChromePostman::GetInstance()->FireEvent(event_name, event_args);
+ return S_OK;
+}
+
+STDMETHODIMP CeeeBroker::RegisterWindowExecutor(long thread_id,
+ IUnknown* executor) {
+ // TODO(mad@chromium.org): Add security check here.
+ return executors_manager_->RegisterWindowExecutor(thread_id, executor);
+}
+
+STDMETHODIMP CeeeBroker::UnregisterExecutor(long thread_id) {
+ // TODO(mad@chromium.org): Add security check here.
+ return executors_manager_->RemoveExecutor(thread_id);
+}
+
+STDMETHODIMP CeeeBroker::RegisterTabExecutor(long thread_id,
+ IUnknown* executor) {
+ // TODO(mad@chromium.org): Implement the proper manual/secure registration.
+ return executors_manager_->RegisterTabExecutor(thread_id, executor);
+}
+
+STDMETHODIMP CeeeBroker::SetTabIdForHandle(long tab_id,
+ CeeeWindowHandle handle) {
+ // TODO(mad@chromium.org): Add security check here.
+ DCHECK(tab_id != kInvalidChromeSessionId &&
+ handle != reinterpret_cast<CeeeWindowHandle>(INVALID_HANDLE_VALUE));
+ executors_manager_->SetTabIdForHandle(tab_id, reinterpret_cast<HWND>(handle));
+ return S_OK;
+}