| OLD | NEW |
| 1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/thread.h" | 10 #include "base/thread.h" |
| (...skipping 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2504 } | 2504 } |
| 2505 | 2505 |
| 2506 RenderViewHost* view_host = web_contents->render_view_host(); | 2506 RenderViewHost* view_host = web_contents->render_view_host(); |
| 2507 if (!view_host) { | 2507 if (!view_host) { |
| 2508 return; | 2508 return; |
| 2509 } | 2509 } |
| 2510 | 2510 |
| 2511 view_host->ForwardMessageFromExternalHost(message, origin, target); | 2511 view_host->ForwardMessageFromExternalHost(message, origin, target); |
| 2512 } | 2512 } |
| 2513 } | 2513 } |
| 2514 #endif // defined(OS_WIN) |
| 2514 | 2515 |
| 2515 WebContents* AutomationProvider::GetWebContentsForHandle( | 2516 WebContents* AutomationProvider::GetWebContentsForHandle( |
| 2516 int handle, NavigationController** tab) { | 2517 int handle, NavigationController** tab) { |
| 2517 WebContents* web_contents = NULL; | 2518 WebContents* web_contents = NULL; |
| 2518 if (tab_tracker_->ContainsHandle(handle)) { | 2519 if (tab_tracker_->ContainsHandle(handle)) { |
| 2519 NavigationController* nav_controller = tab_tracker_->GetResource(handle); | 2520 NavigationController* nav_controller = tab_tracker_->GetResource(handle); |
| 2520 TabContents* tab_contents = nav_controller->active_contents(); | 2521 TabContents* tab_contents = nav_controller->active_contents(); |
| 2521 if (tab_contents) { | 2522 if (tab_contents) { |
| 2522 web_contents = tab_contents->AsWebContents(); | 2523 web_contents = tab_contents->AsWebContents(); |
| 2523 if (tab) | 2524 if (tab) |
| 2524 *tab = nav_controller; | 2525 *tab = nav_controller; |
| 2525 } | 2526 } |
| 2526 } | 2527 } |
| 2527 return web_contents; | 2528 return web_contents; |
| 2528 } | 2529 } |
| 2529 | 2530 |
| 2531 #if defined(OS_WIN) |
| 2530 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { | 2532 ExternalTabContainer* AutomationProvider::GetExternalTabForHandle(int handle) { |
| 2531 if (tab_tracker_->ContainsHandle(handle)) { | 2533 if (tab_tracker_->ContainsHandle(handle)) { |
| 2532 NavigationController* tab = tab_tracker_->GetResource(handle); | 2534 NavigationController* tab = tab_tracker_->GetResource(handle); |
| 2533 return ExternalTabContainer::GetContainerForTab( | 2535 return ExternalTabContainer::GetContainerForTab( |
| 2534 tab->tab_contents()->GetNativeView()); | 2536 tab->tab_contents()->GetNativeView()); |
| 2535 } | 2537 } |
| 2536 | 2538 |
| 2537 return NULL; | 2539 return NULL; |
| 2538 } | 2540 } |
| 2539 #endif // defined(OS_WIN) | 2541 #endif // defined(OS_WIN) |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2776 if (!SetParent(params.window, params.parent_window)) | 2778 if (!SetParent(params.window, params.parent_window)) |
| 2777 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError(); | 2779 DLOG(WARNING) << "SetParent failed. Error 0x%x" << GetLastError(); |
| 2778 } | 2780 } |
| 2779 } | 2781 } |
| 2780 | 2782 |
| 2781 SetWindowPos(params.window, params.window_insert_after, params.left, | 2783 SetWindowPos(params.window, params.window_insert_after, params.left, |
| 2782 params.top, params.width, params.height, params.flags); | 2784 params.top, params.width, params.height, params.flags); |
| 2783 } | 2785 } |
| 2784 | 2786 |
| 2785 #endif // defined(OS_WIN) | 2787 #endif // defined(OS_WIN) |
| OLD | NEW |