| 34 | namespace webdriver { |
| 35 | |
| 36 | DocumentHost::DocumentHost(HWND hwnd, HWND executor_handle) { |
| 37 | LOG(TRACE) << "Entering DocumentHost::DocumentHost"; |
| 38 | |
| 39 | // NOTE: COM should be initialized on this thread, so we |
| 40 | // could use CoCreateGuid() and StringFromGUID2() instead. |
| 41 | UUID guid; |
| 42 | RPC_WSTR guid_string = NULL; |
| 43 | RPC_STATUS status = ::UuidCreate(&guid); |
| 44 | if (status != RPC_S_OK) { |
| 45 | // If we encounter an error, not bloody much we can do about it. |
| 46 | // Just log it and continue. |
| 47 | LOG(WARN) << "UuidCreate returned a status other then RPC_S_OK: " << status; |
| 48 | } |
| 49 | status = ::UuidToString(&guid, &guid_string); |
| 50 | if (status != RPC_S_OK) { |
| 51 | // If we encounter an error, not bloody much we can do about it. |
| 52 | // Just log it and continue. |
| 53 | LOG(WARN) << "UuidToString returned a status other then RPC_S_OK: " << status; |
| 54 | } |
| 55 | |
| 56 | // RPC_WSTR is currently typedef'd in RpcDce.h (pulled in by rpc.h) |
| 57 | // as unsigned short*. It needs to be typedef'd as wchar_t* |
| 58 | wchar_t* cast_guid_string = reinterpret_cast<wchar_t*>(guid_string); |
| 59 | this->browser_id_ = StringUtilities::ToString(cast_guid_string); |
| 60 | |
| 61 | ::RpcStringFree(&guid_string); |
| 62 | this->window_handle_ = hwnd; |
| 63 | this->executor_handle_ = executor_handle; |
| 64 | this->script_executor_handle_ = NULL; |
| 65 | this->is_closing_ = false; |
| 66 | this->wait_required_ = false; |
| 67 | this->is_awaiting_new_process_ = false; |
| 68 | this->focused_frame_window_ = NULL; |
| 69 | this->cookie_manager_ = new CookieManager(); |
| 70 | if (this->window_handle_ != NULL) { |
| 71 | this->cookie_manager_->Initialize(this->window_handle_); |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | DocumentHost::~DocumentHost(void) { |
| 76 | delete this->cookie_manager_; |
nothing calls this directly
no test coverage detected