[email protected] | f90bf0d9 | 2011-01-13 02:12:44 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 625332e0 | 2010-12-14 07:48:49 | [diff] [blame] | 5 | #include "base/lazy_instance.h" |
[email protected] | c62dd9d | 2011-09-21 18:05:41 | [diff] [blame] | 6 | #include "base/location.h" |
| 7 | #include "chrome_frame/external_tab.h" |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 8 | #include "base/task.h" |
[email protected] | 44f9c95 | 2011-01-02 06:05:39 | [diff] [blame] | 9 | #include "base/synchronization/waitable_event.h" |
[email protected] | a8ba636 | 2010-11-10 20:02:25 | [diff] [blame] | 10 | #include "chrome/common/automation_messages.h" |
[email protected] | 354bcba | 2010-12-14 04:34:43 | [diff] [blame] | 11 | #include "chrome_frame/chrome_frame_delegate.h" |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 12 | #include "chrome_frame/utils.h" |
| 13 | |
| 14 | DISABLE_RUNNABLE_METHOD_REFCOUNT(ExternalTabProxy); |
| 15 | DISABLE_RUNNABLE_METHOD_REFCOUNT(UIDelegate); |
| 16 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 17 | namespace { |
[email protected] | 625332e0 | 2010-12-14 07:48:49 | [diff] [blame] | 18 | static base::LazyInstance<ChromeProxyFactory> g_proxy_factory( |
| 19 | base::LINKER_INITIALIZED); |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 20 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 21 | struct UserDataHolder : public SyncMessageContext { |
| 22 | explicit UserDataHolder(void* p) : data(p) {} |
| 23 | void* data; |
| 24 | }; |
| 25 | } |
| 26 | |
| 27 | |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 28 | ExternalTabProxy::ExternalTabProxy() : state_(NONE), tab_(0), tab_wnd_(NULL), |
[email protected] | 625332e0 | 2010-12-14 07:48:49 | [diff] [blame] | 29 | chrome_wnd_(NULL), proxy_factory_(g_proxy_factory.Pointer()), proxy_(NULL), |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 30 | ui_delegate_(NULL) { |
| 31 | } |
| 32 | |
| 33 | ExternalTabProxy::~ExternalTabProxy() { |
| 34 | Destroy(); |
| 35 | } |
| 36 | |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 37 | bool ExternalTabProxy::OnMessageReceived(const IPC::Message& message) { |
| 38 | bool handled = true; |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 39 | IPC_BEGIN_MESSAGE_MAP(ExternalTabProxy, message) |
| 40 | IPC_MESSAGE_HANDLER(AutomationMsg_NavigationStateChanged, |
| 41 | OnNavigationStateChanged) |
| 42 | IPC_MESSAGE_HANDLER(AutomationMsg_UpdateTargetUrl, OnUpdateTargetUrl) |
| 43 | IPC_MESSAGE_HANDLER(AutomationMsg_HandleAccelerator, OnHandleAccelerator) |
| 44 | IPC_MESSAGE_HANDLER(AutomationMsg_TabbedOut, OnTabbedOut) |
| 45 | IPC_MESSAGE_HANDLER(AutomationMsg_OpenURL, OnOpenURL) |
| 46 | IPC_MESSAGE_HANDLER(AutomationMsg_NavigationFailed, OnNavigationFailed) |
| 47 | IPC_MESSAGE_HANDLER(AutomationMsg_DidNavigate, OnDidNavigate) |
| 48 | IPC_MESSAGE_HANDLER(AutomationMsg_TabLoaded, OnTabLoaded) |
[email protected] | 326d3b7 | 2011-03-29 20:38:24 | [diff] [blame] | 49 | IPC_MESSAGE_HANDLER(AutomationMsg_MoveWindow, OnMoveWindow) |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 50 | IPC_MESSAGE_HANDLER(AutomationMsg_ForwardMessageToExternalHost, |
| 51 | OnMessageToHost) |
| 52 | IPC_MESSAGE_HANDLER(AutomationMsg_ForwardContextMenuToExternalHost, |
| 53 | OnHandleContextMenu) |
| 54 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestStart, OnNetwork_Start) |
| 55 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestRead, OnNetwork_Read) |
| 56 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestEnd, OnNetwork_End) |
| 57 | IPC_MESSAGE_HANDLER(AutomationMsg_DownloadRequestInHost, |
| 58 | OnNetwork_DownloadInHost) |
| 59 | IPC_MESSAGE_HANDLER(AutomationMsg_GetCookiesFromHost, OnGetCookies) |
| 60 | IPC_MESSAGE_HANDLER(AutomationMsg_SetCookieAsync, OnSetCookie) |
| 61 | IPC_MESSAGE_HANDLER(AutomationMsg_AttachExternalTab, OnAttachTab) |
| 62 | IPC_MESSAGE_HANDLER(AutomationMsg_RequestGoToHistoryEntryOffset, |
| 63 | OnGoToHistoryOffset) |
| 64 | IPC_MESSAGE_HANDLER(AutomationMsg_CloseExternalTab, OnTabClosed) |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 65 | IPC_MESSAGE_UNHANDLED(handled = false) |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 66 | IPC_END_MESSAGE_MAP() |
[email protected] | a95986a8 | 2010-12-24 06:19:28 | [diff] [blame] | 67 | return handled; |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 68 | } |
| 69 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 70 | void ExternalTabProxy::Init() { |
| 71 | if (m_hWnd == NULL) { |
| 72 | // Create a window on the UI thread for marshaling messages back and forth |
| 73 | // from the IPC thread. This window cannot be a message only window as the |
| 74 | // external chrome tab window initially is created as a child of this window |
| 75 | CWindowImpl<ExternalTabProxy>::Create(GetDesktopWindow(), NULL, NULL, |
| 76 | WS_CHILDWINDOW | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_TOOLWINDOW); |
| 77 | DCHECK(m_hWnd != NULL); |
| 78 | ui_.SetWindow(m_hWnd, WM_APP + 6); |
| 79 | } |
| 80 | } |
| 81 | |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 82 | void ExternalTabProxy::Destroy() { |
| 83 | DCHECK(NULL == done_.get()); |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 84 | // TODO(stoyan): Should we release proxy first and then destroy the window |
| 85 | // (parent of the chrome window) or the other way around? |
| 86 | if (state_ != NONE) { |
| 87 | done_.reset(new base::WaitableEvent(true, false)); |
| 88 | proxy_factory_->ReleaseProxy(this, tab_params_.proxy_params.profile); |
| 89 | done_->Wait(); |
| 90 | done_.reset(NULL); |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 91 | |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 92 | state_ = NONE; |
| 93 | proxy_ = NULL; |
| 94 | tab_ = 0; |
| 95 | CWindowImpl<ExternalTabProxy>::DestroyWindow(); |
| 96 | tab_wnd_ = NULL; |
| 97 | chrome_wnd_ = NULL; |
| 98 | // We shall tell the TaskMarshaller to delete queued tasks. |
| 99 | // ui_.DeleteAll(); |
| 100 | } |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 101 | } |
| 102 | |
| 103 | void ExternalTabProxy::CreateTab(const CreateTabParams& create_params, |
| 104 | UIDelegate* delegate) { |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 105 | DCHECK(ui_delegate_ == NULL); |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 106 | DCHECK_EQ(NONE, state_); |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 107 | // Create host window if needed. |
| 108 | Init(); |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 109 | ui_delegate_ = delegate; |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 110 | // TODO(stoyan): Shall we check the CanNavigate(create_params.url)? |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 111 | tab_params_ = create_params; |
| 112 | state_ = INIT_IN_PROGRESS; |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 113 | proxy_factory_->GetProxy(this, create_params.proxy_params); |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | void ExternalTabProxy::Connected(ChromeProxy* proxy) { |
| 117 | // in ipc thread |
| 118 | ui_.PostTask(FROM_HERE, NewRunnableMethod(this, |
| 119 | &ExternalTabProxy::UiConnected, proxy)); |
| 120 | } |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 121 | |
| 122 | void ExternalTabProxy::UiConnected(ChromeProxy* proxy) { |
| 123 | proxy_ = proxy; |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 124 | ExternalTabSettings settings; |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 125 | settings.parent = m_hWnd; |
| 126 | settings.style = WS_CHILD; |
[email protected] | 6acaea6 | 2011-03-17 01:18:32 | [diff] [blame] | 127 | settings.is_incognito = tab_params_.is_incognito; |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 128 | // TODO(stoyan): FIX this. |
| 129 | settings.load_requests_via_automation = true; |
| 130 | // TODO(stoyan): FIX this. |
| 131 | settings.handle_top_level_requests = true; |
| 132 | settings.initial_url = tab_params_.url; |
| 133 | settings.referrer = tab_params_.referrer; |
| 134 | // Infobars are disabled in widget mode. |
| 135 | settings.infobars_enabled = !tab_params_.is_widget_mode; |
| 136 | // TODO(stoyan): FIX this. |
| 137 | settings.route_all_top_level_navigations = false; |
| 138 | |
| 139 | state_ = CREATE_TAB_IN_PROGRESS; |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 140 | proxy->CreateTab(this, settings); |
| 141 | } |
| 142 | |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 143 | void ExternalTabProxy::Disconnected() { |
| 144 | // in ipc thread |
| 145 | DCHECK(done_.get() != NULL); |
| 146 | done_->Signal(); |
| 147 | } |
| 148 | |
| 149 | void ExternalTabProxy::PeerLost(ChromeProxy* proxy, DisconnectReason reason) { |
| 150 | ui_.PostTask(FROM_HERE, NewRunnableMethod(this, &ExternalTabProxy::UiPeerLost, |
| 151 | proxy, reason)); |
| 152 | } |
| 153 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 154 | void ExternalTabProxy::UiPeerLost(ChromeProxy* proxy, DisconnectReason reason) { |
| 155 | // TODO(stoyan): |
| 156 | } |
| 157 | |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 158 | void ExternalTabProxy::Navigate(const std::string& url, |
[email protected] | 354bcba | 2010-12-14 04:34:43 | [diff] [blame] | 159 | const std::string& referrer, |
| 160 | NavigationConstraints* navigation_constraints) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 161 | // in ui thread |
| 162 | // Catch invalid URLs early. Can we allow this navigation to happen? |
| 163 | GURL parsed_url(url); |
[email protected] | 354bcba | 2010-12-14 04:34:43 | [diff] [blame] | 164 | if (!CanNavigate(parsed_url, navigation_constraints)) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 165 | DLOG(ERROR) << __FUNCTION__ << " Not allowing navigation to: " << url; |
| 166 | return; |
| 167 | } |
| 168 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 169 | GURL parsed_referrer(referrer); |
| 170 | // If we are still establishing channel, simply replace the params |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 171 | if (state_ == INIT_IN_PROGRESS) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 172 | tab_params_.url = parsed_url; |
| 173 | tab_params_.referrer = parsed_referrer; |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 174 | } |
| 175 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 176 | // Ah! Too late. Wait to get tab handle and then navigate. |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 177 | if (state_ == CREATE_TAB_IN_PROGRESS) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 178 | pending_navigation_.Set(parsed_url, parsed_referrer); |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 179 | } |
| 180 | |
| 181 | if (state_ == READY) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 182 | proxy_->Tab_Navigate(tab_, parsed_url, parsed_referrer); |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 183 | } |
| 184 | } |
| 185 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 186 | void ExternalTabProxy::ConnectToExternalTab(uint64 external_tab_cookie) { |
| 187 | proxy_->ConnectTab(this, m_hWnd, external_tab_cookie); |
| 188 | } |
| 189 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 190 | void ExternalTabProxy::BlockExternalTab(uint64 cookie) { |
| 191 | proxy_->BlockTab(cookie); |
| 192 | } |
| 193 | |
| 194 | void ExternalTabProxy::SetZoomLevel(PageZoom::Function zoom_level) { |
| 195 | proxy_->Tab_Zoom(tab_, zoom_level); |
| 196 | } |
| 197 | |
| 198 | void ExternalTabProxy::NavigateToIndex(int index) { |
| 199 | CHECK(0); |
| 200 | } |
| 201 | |
| 202 | void ExternalTabProxy::ForwardMessageFromExternalHost( |
| 203 | const std::string& message, const std::string& origin, |
| 204 | const std::string& target) { |
| 205 | proxy_->Tab_PostMessage(tab_, message, origin, target); |
| 206 | } |
| 207 | |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 208 | void ExternalTabProxy::ChromeFrameHostMoved() { |
| 209 | proxy_->Tab_OnHostMoved(tab_); |
| 210 | } |
| 211 | |
| 212 | ////////////////////////////////////////////////////////////////////////// |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 213 | void ExternalTabProxy::UiCompleted_CreateTab(bool success, HWND chrome_window, |
[email protected] | 751bf4b | 2010-11-05 22:06:31 | [diff] [blame] | 214 | HWND tab_window, int tab_handle, |
| 215 | int session_id) { |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 216 | if (success) { |
| 217 | state_ = READY; |
| 218 | tab_ = tab_handle; |
| 219 | tab_wnd_ = tab_window; |
| 220 | chrome_wnd_ = chrome_window; |
| 221 | |
| 222 | // If a navigation request came while tab creation was in progress - |
| 223 | // go ahead and navigate. |
| 224 | if (pending_navigation_.url.is_valid()) |
| 225 | proxy_->Tab_Navigate(tab_, pending_navigation_.url, |
| 226 | pending_navigation_.referrer); |
| 227 | } |
| 228 | } |
| 229 | |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 230 | void ExternalTabProxy::Completed_CreateTab(bool success, HWND chrome_wnd, |
[email protected] | 751bf4b | 2010-11-05 22:06:31 | [diff] [blame] | 231 | HWND tab_window, int tab_handle, |
| 232 | int session_id) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 233 | // in ipc_thread. |
[email protected] | 314a0696 | 2010-10-20 21:32:32 | [diff] [blame] | 234 | ui_.PostTask(FROM_HERE, NewRunnableMethod(this, |
| 235 | &ExternalTabProxy::UiCompleted_CreateTab, |
[email protected] | 751bf4b | 2010-11-05 22:06:31 | [diff] [blame] | 236 | success, chrome_wnd, tab_window, tab_handle, session_id)); |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 237 | } |
| 238 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 239 | void ExternalTabProxy::Completed_ConnectToTab( |
| 240 | bool success, HWND chrome_window, HWND tab_window, int tab_handle, |
| 241 | int session_id) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 242 | CHECK(0); |
| 243 | } |
| 244 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 245 | void ExternalTabProxy::Completed_Navigate( |
| 246 | bool success, enum AutomationMsg_NavigationResponseValues res) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 247 | // ipc_thread; |
| 248 | CHECK(0); |
| 249 | } |
| 250 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 251 | void ExternalTabProxy::OnNavigationStateChanged( |
| 252 | int flags, const NavigationInfo& nav_info) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 253 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 254 | &UIDelegate::OnNavigationStateChanged, flags, nav_info)); |
| 255 | } |
| 256 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 257 | void ExternalTabProxy::OnUpdateTargetUrl(const std::wstring& url) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 258 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 259 | &UIDelegate::OnUpdateTargetUrl, url)); |
| 260 | } |
| 261 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 262 | void ExternalTabProxy::OnTabLoaded(const GURL& url) { |
[email protected] | 5a8db80 | 2010-10-06 17:34:43 | [diff] [blame] | 263 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 264 | &UIDelegate::OnLoad, url)); |
| 265 | } |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 266 | |
[email protected] | 326d3b7 | 2011-03-29 20:38:24 | [diff] [blame] | 267 | void ExternalTabProxy::OnMoveWindow(const gfx::Rect& pos) { |
| 268 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 269 | &UIDelegate::OnMoveWindow, pos)); |
| 270 | } |
| 271 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 272 | void ExternalTabProxy::OnMessageToHost(const std::string& message, |
| 273 | const std::string& origin, |
| 274 | const std::string& target) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 275 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 276 | &UIDelegate::OnMessageFromChromeFrame, message, origin, target)); |
| 277 | } |
| 278 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 279 | void ExternalTabProxy::OnHandleAccelerator(const MSG& accel_message) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 280 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 281 | &UIDelegate::OnHandleAccelerator, accel_message)); |
| 282 | } |
| 283 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 284 | void ExternalTabProxy::OnHandleContextMenu( |
[email protected] | b516e2d | 2011-07-12 16:54:12 | [diff] [blame] | 285 | const ContextMenuModel& context_menu_model, |
[email protected] | 47af65f0 | 2010-11-08 21:43:55 | [diff] [blame] | 286 | int align_flags, |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 287 | const MiniContextMenuParams& params) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 288 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
[email protected] | b516e2d | 2011-07-12 16:54:12 | [diff] [blame] | 289 | &UIDelegate::OnHandleContextMenu, context_menu_model, align_flags, |
| 290 | params)); |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 291 | } |
| 292 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 293 | void ExternalTabProxy::OnTabbedOut(bool reverse) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 294 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 295 | &UIDelegate::OnTabbedOut, reverse)); |
| 296 | } |
| 297 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 298 | void ExternalTabProxy::OnGoToHistoryOffset(int offset) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 299 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 300 | &UIDelegate::OnGoToHistoryOffset, offset)); |
| 301 | } |
| 302 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 303 | void ExternalTabProxy::OnOpenURL(const GURL& url_to_open, const GURL& referrer, |
| 304 | int open_disposition) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 305 | ui_.PostTask(FROM_HERE, NewRunnableMethod(ui_delegate_, |
| 306 | &UIDelegate::OnOpenURL, url_to_open, referrer, open_disposition)); |
| 307 | } |
| 308 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 309 | void ExternalTabProxy::OnNavigationFailed(int error_code, const GURL& gurl) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 310 | // TODO(stoyan): |
| 311 | } |
| 312 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 313 | void ExternalTabProxy::OnDidNavigate(const NavigationInfo& navigation_info) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 314 | // TODO(stoyan): |
| 315 | } |
| 316 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 317 | void ExternalTabProxy::OnNetwork_Start( |
| 318 | int request_id, const AutomationURLRequest& request_info) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 319 | // TODO(stoyan): url_fetcher_.Start(); |
| 320 | } |
| 321 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 322 | void ExternalTabProxy::OnNetwork_Read(int request_id, int bytes_to_read) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 323 | // TODO(stoyan): url_fetcher_.Read(); |
| 324 | } |
| 325 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 326 | void ExternalTabProxy::OnNetwork_End(int request_id, |
[email protected] | f90bf0d9 | 2011-01-13 02:12:44 | [diff] [blame] | 327 | const net::URLRequestStatus& s) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 328 | // TODO(stoyan): |
| 329 | } |
| 330 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 331 | void ExternalTabProxy::OnNetwork_DownloadInHost(int request_id) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 332 | // TODO(stoyan): |
| 333 | } |
| 334 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 335 | void ExternalTabProxy::OnGetCookies(const GURL& url, int cookie_id) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 336 | // TODO(stoyan): |
| 337 | } |
| 338 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 339 | void ExternalTabProxy::OnSetCookie(const GURL& url, const std::string& cookie) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 340 | // TODO(stoyan): |
| 341 | } |
| 342 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 343 | void ExternalTabProxy::OnTabClosed() { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 344 | // TODO(stoyan): |
| 345 | } |
| 346 | |
[email protected] | f5494d4 | 2010-12-23 22:15:34 | [diff] [blame] | 347 | void ExternalTabProxy::OnAttachTab( |
| 348 | const AttachExternalTabParams& attach_params) { |
[email protected] | 11b6e60 | 2010-10-13 16:02:26 | [diff] [blame] | 349 | // TODO(stoyan): |
| 350 | } |