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 |
10 #include "ceee/ie/broker/api_dispatcher.h" | 11 #include "ceee/ie/broker/api_dispatcher.h" |
11 #include "ceee/ie/broker/chrome_postman.h" | 12 #include "ceee/ie/broker/chrome_postman.h" |
12 #include "ceee/ie/broker/executors_manager.h" | 13 #include "ceee/ie/broker/executors_manager.h" |
13 #include "ceee/ie/common/ceee_module_util.h" | 14 #include "ceee/ie/common/ceee_module_util.h" |
14 | 15 |
15 | 16 |
16 HRESULT CeeeBroker::FinalConstruct() { | 17 HRESULT CeeeBroker::FinalConstruct() { |
17 // So that we get a pointer to the ExecutorsManager and let tests override it. | 18 // So that we get a pointer to the ExecutorsManager and let tests override it. |
18 executors_manager_ = Singleton<ExecutorsManager, | 19 executors_manager_ = Singleton<ExecutorsManager, |
19 ExecutorsManager::SingletonTraits>::get(); | 20 ExecutorsManager::SingletonTraits>::get(); |
20 api_dispatcher_ = ProductionApiDispatcher::get(); | 21 api_dispatcher_ = ProductionApiDispatcher::get(); |
21 return S_OK; | 22 return S_OK; |
22 } | 23 } |
23 | 24 |
24 void CeeeBroker::OnAddConnection(bool first_lock) { | 25 void CeeeBroker::OnAddConnection(bool first_lock) { |
25 if (first_lock) | |
26 ceee_module_util::LockModule(); | |
27 } | 26 } |
28 | 27 |
29 void CeeeBroker::OnReleaseConnection(bool last_unlock, | 28 void CeeeBroker::OnReleaseConnection(bool last_unlock, |
30 bool last_unlock_releases) { | 29 bool last_unlock_releases) { |
31 if (last_unlock) | |
32 ceee_module_util::UnlockModule(); | |
33 IExternalConnectionImpl<CeeeBroker>::OnReleaseConnection( | 30 IExternalConnectionImpl<CeeeBroker>::OnReleaseConnection( |
34 last_unlock, last_unlock_releases); | 31 last_unlock, last_unlock_releases); |
35 } | 32 } |
36 | 33 |
37 STDMETHODIMP CeeeBroker::Execute(BSTR function, BSTR* response) { | 34 STDMETHODIMP CeeeBroker::Execute(BSTR function, BSTR* response) { |
38 // This is DEPRECATED and we should use ChromePostman (see FireEvent). | 35 // This is DEPRECATED and we should use ChromePostman (see FireEvent). |
39 api_dispatcher_->HandleApiRequest(function, response); | 36 api_dispatcher_->HandleApiRequest(function, response); |
40 return S_OK; | 37 return S_OK; |
41 } | 38 } |
42 | 39 |
(...skipping 20 matching lines...) Expand all Loading... |
63 } | 60 } |
64 | 61 |
65 STDMETHODIMP CeeeBroker::SetTabIdForHandle(long tab_id, | 62 STDMETHODIMP CeeeBroker::SetTabIdForHandle(long tab_id, |
66 CeeeWindowHandle handle) { | 63 CeeeWindowHandle handle) { |
67 // TODO(mad@chromium.org): Add security check here. | 64 // TODO(mad@chromium.org): Add security check here. |
68 DCHECK(tab_id != kInvalidChromeSessionId && | 65 DCHECK(tab_id != kInvalidChromeSessionId && |
69 handle != reinterpret_cast<CeeeWindowHandle>(INVALID_HANDLE_VALUE)); | 66 handle != reinterpret_cast<CeeeWindowHandle>(INVALID_HANDLE_VALUE)); |
70 executors_manager_->SetTabIdForHandle(tab_id, reinterpret_cast<HWND>(handle)); | 67 executors_manager_->SetTabIdForHandle(tab_id, reinterpret_cast<HWND>(handle)); |
71 return S_OK; | 68 return S_OK; |
72 } | 69 } |
OLD | NEW |