Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(375)

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 10837192: Speculative revert to see if this change introduced a performance regression on Mac intl perf bots. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/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 523 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 Browser* browser = browser_tracker_->GetResource(handle); 534 Browser* browser = browser_tracker_->GetResource(handle);
535 *active_tab_index = browser->active_index(); 535 *active_tab_index = browser->active_index();
536 } 536 }
537 } 537 }
538 538
539 void TestingAutomationProvider::CloseTab(int tab_handle, 539 void TestingAutomationProvider::CloseTab(int tab_handle,
540 bool wait_until_closed, 540 bool wait_until_closed,
541 IPC::Message* reply_message) { 541 IPC::Message* reply_message) {
542 if (tab_tracker_->ContainsHandle(tab_handle)) { 542 if (tab_tracker_->ContainsHandle(tab_handle)) {
543 NavigationController* controller = tab_tracker_->GetResource(tab_handle); 543 NavigationController* controller = tab_tracker_->GetResource(tab_handle);
544 Browser* browser = browser::FindBrowserWithWebContents( 544 int index;
545 controller->GetWebContents()); 545 Browser* browser = browser::FindBrowserForController(controller, &index);
546 DCHECK(browser); 546 DCHECK(browser);
547 new TabClosedNotificationObserver(this, wait_until_closed, reply_message, 547 new TabClosedNotificationObserver(this, wait_until_closed, reply_message,
548 false); 548 false);
549 chrome::CloseWebContents(browser, controller->GetWebContents()); 549 chrome::CloseWebContents(browser, controller->GetWebContents());
550 return; 550 return;
551 } 551 }
552 552
553 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false); 553 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false);
554 Send(reply_message); 554 Send(reply_message);
555 } 555 }
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1053 } 1053 }
1054 *title_string_size = static_cast<int>(title->size()); 1054 *title_string_size = static_cast<int>(title->size());
1055 } 1055 }
1056 } 1056 }
1057 1057
1058 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) { 1058 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
1059 *tabstrip_index = -1; // -1 is the error code 1059 *tabstrip_index = -1; // -1 is the error code
1060 1060
1061 if (tab_tracker_->ContainsHandle(handle)) { 1061 if (tab_tracker_->ContainsHandle(handle)) {
1062 NavigationController* tab = tab_tracker_->GetResource(handle); 1062 NavigationController* tab = tab_tracker_->GetResource(handle);
1063 Browser* browser = browser::FindBrowserWithWebContents( 1063 Browser* browser = browser::FindBrowserForController(tab, NULL);
1064 tab->GetWebContents());
1065 *tabstrip_index = chrome::GetIndexOfTab(browser, tab->GetWebContents()); 1064 *tabstrip_index = chrome::GetIndexOfTab(browser, tab->GetWebContents());
1066 } 1065 }
1067 } 1066 }
1068 1067
1069 void TestingAutomationProvider::GetTabURL(int handle, 1068 void TestingAutomationProvider::GetTabURL(int handle,
1070 bool* success, 1069 bool* success,
1071 GURL* url) { 1070 GURL* url) {
1072 *success = false; 1071 *success = false;
1073 if (tab_tracker_->ContainsHandle(handle)) { 1072 if (tab_tracker_->ContainsHandle(handle)) {
1074 NavigationController* tab = tab_tracker_->GetResource(handle); 1073 NavigationController* tab = tab_tracker_->GetResource(handle);
(...skipping 6091 matching lines...) Expand 10 before | Expand all | Expand 10 after
7166 void TestingAutomationProvider::OnRemoveProvider() { 7165 void TestingAutomationProvider::OnRemoveProvider() {
7167 if (g_browser_process) 7166 if (g_browser_process)
7168 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 7167 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
7169 } 7168 }
7170 7169
7171 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 7170 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
7172 WebContents* tab) { 7171 WebContents* tab) {
7173 if (chrome::GetActiveWebContents(browser) != tab) 7172 if (chrome::GetActiveWebContents(browser) != tab)
7174 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); 7173 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true);
7175 } 7174 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698