| OLD | NEW | 
|---|
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 <set> | 7 #include <set> | 
| 8 | 8 | 
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" | 
| 10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" | 
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 421         WaitForAppModalDialogToBeShown) | 421         WaitForAppModalDialogToBeShown) | 
| 422     IPC_MESSAGE_HANDLER_DELAY_REPLY( | 422     IPC_MESSAGE_HANDLER_DELAY_REPLY( | 
| 423         AutomationMsg_GoBackBlockUntilNavigationsComplete, | 423         AutomationMsg_GoBackBlockUntilNavigationsComplete, | 
| 424         GoBackBlockUntilNavigationsComplete) | 424         GoBackBlockUntilNavigationsComplete) | 
| 425     IPC_MESSAGE_HANDLER_DELAY_REPLY( | 425     IPC_MESSAGE_HANDLER_DELAY_REPLY( | 
| 426         AutomationMsg_GoForwardBlockUntilNavigationsComplete, | 426         AutomationMsg_GoForwardBlockUntilNavigationsComplete, | 
| 427         GoForwardBlockUntilNavigationsComplete) | 427         GoForwardBlockUntilNavigationsComplete) | 
| 428 #if defined(OS_WIN) | 428 #if defined(OS_WIN) | 
| 429     IPC_MESSAGE_HANDLER(AutomationMsg_ConnectExternalTab, ConnectExternalTab) | 429     IPC_MESSAGE_HANDLER(AutomationMsg_ConnectExternalTab, ConnectExternalTab) | 
| 430 #endif | 430 #endif | 
|  | 431     IPC_MESSAGE_HANDLER(AutomationMsg_QuitAfterTimeout, QuitAfterTimeout) | 
| 431   IPC_END_MESSAGE_MAP() | 432   IPC_END_MESSAGE_MAP() | 
| 432 } | 433 } | 
| 433 | 434 | 
| 434 void AutomationProvider::ActivateTab(int handle, int at_index, int* status) { | 435 void AutomationProvider::ActivateTab(int handle, int at_index, int* status) { | 
| 435   *status = -1; | 436   *status = -1; | 
| 436   if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { | 437   if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { | 
| 437     Browser* browser = browser_tracker_->GetResource(handle); | 438     Browser* browser = browser_tracker_->GetResource(handle); | 
| 438     if (at_index >= 0 && at_index < browser->tab_count()) { | 439     if (at_index >= 0 && at_index < browser->tab_count()) { | 
| 439       browser->SelectTabContentsAt(at_index, true); | 440       browser->SelectTabContentsAt(at_index, true); | 
| 440       *status = 0; | 441       *status = 0; | 
| (...skipping 1572 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2013       browser->GoForward(CURRENT_TAB); | 2014       browser->GoForward(CURRENT_TAB); | 
| 2014       return; | 2015       return; | 
| 2015     } | 2016     } | 
| 2016   } | 2017   } | 
| 2017 | 2018 | 
| 2018   AutomationMsg_GoForwardBlockUntilNavigationsComplete::WriteReplyParams( | 2019   AutomationMsg_GoForwardBlockUntilNavigationsComplete::WriteReplyParams( | 
| 2019       reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); | 2020       reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); | 
| 2020   Send(reply_message); | 2021   Send(reply_message); | 
| 2021 } | 2022 } | 
| 2022 | 2023 | 
|  | 2024 void AutomationProvider::QuitAfterTimeout(int timeout_ms) { | 
|  | 2025   MessageLoop::current()->PostDelayedTask(FROM_HERE, | 
|  | 2026                                           new MessageLoop::QuitTask(), | 
|  | 2027                                           timeout_ms); | 
|  | 2028 } | 
|  | 2029 | 
| 2023 RenderViewHost* AutomationProvider::GetViewForTab(int tab_handle) { | 2030 RenderViewHost* AutomationProvider::GetViewForTab(int tab_handle) { | 
| 2024   if (tab_tracker_->ContainsHandle(tab_handle)) { | 2031   if (tab_tracker_->ContainsHandle(tab_handle)) { | 
| 2025     NavigationController* tab = tab_tracker_->GetResource(tab_handle); | 2032     NavigationController* tab = tab_tracker_->GetResource(tab_handle); | 
| 2026     if (!tab) { | 2033     if (!tab) { | 
| 2027       NOTREACHED(); | 2034       NOTREACHED(); | 
| 2028       return NULL; | 2035       return NULL; | 
| 2029     } | 2036     } | 
| 2030 | 2037 | 
| 2031     TabContents* tab_contents = tab->tab_contents(); | 2038     TabContents* tab_contents = tab->tab_contents(); | 
| 2032     if (!tab_contents) { | 2039     if (!tab_contents) { | 
| (...skipping 22 matching lines...) Expand all  Loading... | 
| 2055   for (;iter != BrowserList::end(); ++iter) { | 2062   for (;iter != BrowserList::end(); ++iter) { | 
| 2056     gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); | 2063     gfx::NativeWindow this_window = (*iter)->window()->GetNativeHandle(); | 
| 2057     if (window == this_window) { | 2064     if (window == this_window) { | 
| 2058       // Add() returns the existing handle for the resource if any. | 2065       // Add() returns the existing handle for the resource if any. | 
| 2059       *browser_handle = browser_tracker_->Add(*iter); | 2066       *browser_handle = browser_tracker_->Add(*iter); | 
| 2060       *success = true; | 2067       *success = true; | 
| 2061       return; | 2068       return; | 
| 2062     } | 2069     } | 
| 2063   } | 2070   } | 
| 2064 } | 2071 } | 
| OLD | NEW | 
|---|