OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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/testing_automation_provider.h" | 5 #include "chrome/browser/automation/testing_automation_provider.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 new BrowserClosedNotificationObserver(browser, this, reply_message, false); | 448 new BrowserClosedNotificationObserver(browser, this, reply_message, false); |
449 browser->window()->Close(); | 449 browser->window()->Close(); |
450 } | 450 } |
451 | 451 |
452 void TestingAutomationProvider::ActivateTab(int handle, | 452 void TestingAutomationProvider::ActivateTab(int handle, |
453 int at_index, | 453 int at_index, |
454 int* status) { | 454 int* status) { |
455 *status = -1; | 455 *status = -1; |
456 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { | 456 if (browser_tracker_->ContainsHandle(handle) && at_index > -1) { |
457 Browser* browser = browser_tracker_->GetResource(handle); | 457 Browser* browser = browser_tracker_->GetResource(handle); |
458 if (at_index >= 0 && at_index < browser->tab_count()) { | 458 if (at_index >= 0 && at_index < browser->tab_strip_model()->count()) { |
459 chrome::ActivateTabAt(browser, at_index, true); | 459 browser->tab_strip_model()->ActivateTabAt(at_index, true); |
460 *status = 0; | 460 *status = 0; |
461 } | 461 } |
462 } | 462 } |
463 } | 463 } |
464 | 464 |
465 void TestingAutomationProvider::AppendTab(int handle, | 465 void TestingAutomationProvider::AppendTab(int handle, |
466 const GURL& url, | 466 const GURL& url, |
467 IPC::Message* reply_message) { | 467 IPC::Message* reply_message) { |
468 int append_tab_response = -1; // -1 is the error code | 468 int append_tab_response = -1; // -1 is the error code |
469 TabAppendedNotificationObserver* observer = NULL; | 469 TabAppendedNotificationObserver* observer = NULL; |
(...skipping 5888 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6358 if (g_browser_process) | 6358 if (g_browser_process) |
6359 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6359 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6360 } | 6360 } |
6361 | 6361 |
6362 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6362 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6363 WebContents* tab) { | 6363 WebContents* tab) { |
6364 TabStripModel* tab_strip = browser->tab_strip_model(); | 6364 TabStripModel* tab_strip = browser->tab_strip_model(); |
6365 if (tab_strip->GetActiveWebContents() != tab) | 6365 if (tab_strip->GetActiveWebContents() != tab) |
6366 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); | 6366 tab_strip->ActivateTabAt(tab_strip->GetIndexOfWebContents(tab), true); |
6367 } | 6367 } |
OLD | NEW |