| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // ICeeeBroker implementation | 5 // ICeeeBroker implementation |
| 6 | 6 |
| 7 #include "ceee/ie/broker/broker.h" | 7 #include "ceee/ie/broker/broker.h" |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ceee/ie/broker/api_dispatcher.h" | 10 #include "ceee/ie/broker/api_dispatcher.h" |
| 11 #include "ceee/ie/broker/chrome_postman.h" | 11 #include "ceee/ie/broker/chrome_postman.h" |
| 12 #include "ceee/ie/broker/executors_manager.h" | 12 #include "ceee/ie/broker/executors_manager.h" |
| 13 #include "ceee/ie/common/ceee_module_util.h" | 13 #include "ceee/ie/common/ceee_module_util.h" |
| 14 | 14 |
| 15 | 15 |
| 16 HRESULT CeeeBroker::FinalConstruct() { | 16 HRESULT CeeeBroker::FinalConstruct() { |
| 17 // So that we get a pointer to the ExecutorsManager and let tests override it. | 17 // So that we get a pointer to the ExecutorsManager and let tests override it. |
| 18 executors_manager_ = Singleton<ExecutorsManager, | 18 executors_manager_ = Singleton<ExecutorsManager, |
| 19 ExecutorsManager::SingletonTraits>::get(); | 19 ExecutorsManager::SingletonTraits>::get(); |
| 20 api_dispatcher_ = ProductionApiDispatcher::get(); | 20 api_dispatcher_ = ProductionApiDispatcher::get(); |
| 21 return S_OK; | 21 return S_OK; |
| 22 } | 22 } |
| 23 | 23 |
| 24 void CeeeBroker::OnAddConnection(bool first_lock) { | |
| 25 if (first_lock) | |
| 26 ceee_module_util::LockModule(); | |
| 27 } | |
| 28 | |
| 29 void CeeeBroker::OnReleaseConnection(bool last_unlock, | |
| 30 bool last_unlock_releases) { | |
| 31 if (last_unlock) | |
| 32 ceee_module_util::UnlockModule(); | |
| 33 IExternalConnectionImpl<CeeeBroker>::OnReleaseConnection( | |
| 34 last_unlock, last_unlock_releases); | |
| 35 } | |
| 36 | |
| 37 STDMETHODIMP CeeeBroker::Execute(BSTR function, BSTR* response) { | 24 STDMETHODIMP CeeeBroker::Execute(BSTR function, BSTR* response) { |
| 38 // This is DEPRECATED and we should use ChromePostman (see FireEvent). | 25 // This is DEPRECATED and we should use ChromePostman (see FireEvent). |
| 39 api_dispatcher_->HandleApiRequest(function, response); | 26 api_dispatcher_->HandleApiRequest(function, response); |
| 40 return S_OK; | 27 return S_OK; |
| 41 } | 28 } |
| 42 | 29 |
| 43 STDMETHODIMP CeeeBroker::FireEvent(BSTR event_name, BSTR event_args) { | 30 STDMETHODIMP CeeeBroker::FireEvent(BSTR event_name, BSTR event_args) { |
| 44 ChromePostman::GetInstance()->FireEvent(event_name, event_args); | 31 ChromePostman::GetInstance()->FireEvent(event_name, event_args); |
| 45 return S_OK; | 32 return S_OK; |
| 46 } | 33 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 63 } | 50 } |
| 64 | 51 |
| 65 STDMETHODIMP CeeeBroker::SetTabIdForHandle(long tab_id, | 52 STDMETHODIMP CeeeBroker::SetTabIdForHandle(long tab_id, |
| 66 CeeeWindowHandle handle) { | 53 CeeeWindowHandle handle) { |
| 67 // TODO(mad@chromium.org): Add security check here. | 54 // TODO(mad@chromium.org): Add security check here. |
| 68 DCHECK(tab_id != kInvalidChromeSessionId && | 55 DCHECK(tab_id != kInvalidChromeSessionId && |
| 69 handle != reinterpret_cast<CeeeWindowHandle>(INVALID_HANDLE_VALUE)); | 56 handle != reinterpret_cast<CeeeWindowHandle>(INVALID_HANDLE_VALUE)); |
| 70 executors_manager_->SetTabIdForHandle(tab_id, reinterpret_cast<HWND>(handle)); | 57 executors_manager_->SetTabIdForHandle(tab_id, reinterpret_cast<HWND>(handle)); |
| 71 return S_OK; | 58 return S_OK; |
| 72 } | 59 } |
| OLD | NEW |