| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "chrome/browser/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 if (params.set_parent) { | 298 if (params.set_parent) { |
| 299 if (IsWindow(params.parent_window)) { | 299 if (IsWindow(params.parent_window)) { |
| 300 if (!SetParent(params.window, params.parent_window)) | 300 if (!SetParent(params.window, params.parent_window)) |
| 301 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError(); | 301 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError(); |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 } | 304 } |
| 305 | 305 |
| 306 void AutomationProvider::OnForwardContextMenuCommandToChrome(int tab_handle, | 306 void AutomationProvider::OnForwardContextMenuCommandToChrome(int tab_handle, |
| 307 int command) { | 307 int command) { |
| 308 if (!tab_tracker_->ContainsHandle(tab_handle)) | 308 ExternalTabContainer* external_tab = GetExternalTabForHandle(tab_handle); |
| 309 return; | 309 external_tab->ExecuteContextMenuCommand(command); |
| 310 | |
| 311 NavigationController* tab = tab_tracker_->GetResource(tab_handle); | |
| 312 if (!tab) { | |
| 313 NOTREACHED(); | |
| 314 return; | |
| 315 } | |
| 316 | |
| 317 WebContents* web_contents = tab->GetWebContents(); | |
| 318 if (!web_contents || !web_contents->GetDelegate()) { | |
| 319 NOTREACHED(); | |
| 320 return; | |
| 321 } | |
| 322 | |
| 323 web_contents->GetDelegate()->ExecuteContextMenuCommand(command); | |
| 324 } | 310 } |
| 325 | 311 |
| 326 void AutomationProvider::ConnectExternalTab( | 312 void AutomationProvider::ConnectExternalTab( |
| 327 uint64 cookie, | 313 uint64 cookie, |
| 328 bool allow, | 314 bool allow, |
| 329 gfx::NativeWindow parent_window, | 315 gfx::NativeWindow parent_window, |
| 330 gfx::NativeWindow* tab_container_window, | 316 gfx::NativeWindow* tab_container_window, |
| 331 gfx::NativeWindow* tab_window, | 317 gfx::NativeWindow* tab_window, |
| 332 int* tab_handle, | 318 int* tab_handle, |
| 333 int* session_id) { | 319 int* session_id) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { | 407 void AutomationProvider::OnSetZoomLevel(int handle, int zoom_level) { |
| 422 if (tab_tracker_->ContainsHandle(handle)) { | 408 if (tab_tracker_->ContainsHandle(handle)) { |
| 423 NavigationController* tab = tab_tracker_->GetResource(handle); | 409 NavigationController* tab = tab_tracker_->GetResource(handle); |
| 424 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) { | 410 if (tab->GetWebContents() && tab->GetWebContents()->GetRenderViewHost()) { |
| 425 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost(); | 411 RenderViewHost* host = tab->GetWebContents()->GetRenderViewHost(); |
| 426 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level); | 412 content::PageZoom zoom = static_cast<content::PageZoom>(zoom_level); |
| 427 host->Zoom(zoom); | 413 host->Zoom(zoom); |
| 428 } | 414 } |
| 429 } | 415 } |
| 430 } | 416 } |
| OLD | NEW |