[email protected] | a1e41bb | 2011-12-21 21:01:21 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome_frame/custom_sync_call_context.h" |
| 6 | |
| 7 | #include "base/bind.h" |
| 8 | |
| 9 | CreateExternalTabContext::CreateExternalTabContext( |
| 10 | ChromeFrameAutomationClient* client) |
| 11 | : client_(client) { |
| 12 | } |
| 13 | |
| 14 | void CreateExternalTabContext::Completed( |
| 15 | HWND chrome_window, HWND tab_window, int tab_handle, int session_id) { |
| 16 | AutomationLaunchResult launch_result = |
| 17 | client_->CreateExternalTabComplete(chrome_window, tab_window, |
| 18 | tab_handle, session_id); |
| 19 | client_->PostTask( |
| 20 | FROM_HERE, base::Bind(&ChromeFrameAutomationClient::InitializeComplete, |
| 21 | client_.get(), launch_result)); |
| 22 | } |
| 23 | |
| 24 | BeginNavigateContext::BeginNavigateContext(ChromeFrameAutomationClient* client) |
| 25 | : client_(client) { |
| 26 | } |
| 27 | |
| 28 | void BeginNavigateContext::Completed( |
| 29 | AutomationMsg_NavigationResponseValues response) { |
| 30 | client_->BeginNavigateCompleted(response); |
| 31 | } |
| 32 | |
| 33 | UnloadContext::UnloadContext( |
| 34 | base::WaitableEvent* unload_done, bool* should_unload) |
| 35 | : should_unload_(should_unload), |
| 36 | unload_done_(unload_done) { |
| 37 | } |
| 38 | |
| 39 | void UnloadContext::Completed(bool should_unload) { |
| 40 | *should_unload_ = should_unload; |
| 41 | unload_done_->Signal(); |
| 42 | should_unload_ = NULL; |
| 43 | unload_done_ = NULL; |
| 44 | // This object will be destroyed after this. Cannot access any members |
| 45 | // on returning from this function. |
| 46 | } |