summaryrefslogtreecommitdiffstats
path: root/chrome_frame/custom_sync_call_context.cc
blob: 9544b4b2d8c38dec72334e8cfe4dc1625267334e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2011 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.

#include "chrome_frame/custom_sync_call_context.h"

#include "base/bind.h"

CreateExternalTabContext::CreateExternalTabContext(
    ChromeFrameAutomationClient* client)
    : client_(client) {
}

void CreateExternalTabContext::Completed(
    HWND chrome_window, HWND tab_window, int tab_handle, int session_id) {
  AutomationLaunchResult launch_result =
      client_->CreateExternalTabComplete(chrome_window, tab_window,
                                         tab_handle, session_id);
  client_->PostTask(
      FROM_HERE, base::Bind(&ChromeFrameAutomationClient::InitializeComplete,
                            client_.get(), launch_result));
}

BeginNavigateContext::BeginNavigateContext(ChromeFrameAutomationClient* client)
    : client_(client) {
}

void BeginNavigateContext::Completed(
    AutomationMsg_NavigationResponseValues response) {
  client_->BeginNavigateCompleted(response);
}

UnloadContext::UnloadContext(
    base::WaitableEvent* unload_done, bool* should_unload)
    : should_unload_(should_unload),
      unload_done_(unload_done) {
}

void UnloadContext::Completed(bool should_unload) {
  *should_unload_ = should_unload;
  unload_done_->Signal();
  should_unload_ = NULL;
  unload_done_ = NULL;
  // This object will be destroyed after this. Cannot access any members
  // on returning from this function.
}