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

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

Issue 10831308: Revert 151036 - Speculative revert to see if this change introduced a performance regression on Mac… (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 507 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 Browser* browser = browser_tracker_->GetResource(handle); 518 Browser* browser = browser_tracker_->GetResource(handle);
519 *active_tab_index = browser->active_index(); 519 *active_tab_index = browser->active_index();
520 } 520 }
521 } 521 }
522 522
523 void TestingAutomationProvider::CloseTab(int tab_handle, 523 void TestingAutomationProvider::CloseTab(int tab_handle,
524 bool wait_until_closed, 524 bool wait_until_closed,
525 IPC::Message* reply_message) { 525 IPC::Message* reply_message) {
526 if (tab_tracker_->ContainsHandle(tab_handle)) { 526 if (tab_tracker_->ContainsHandle(tab_handle)) {
527 NavigationController* controller = tab_tracker_->GetResource(tab_handle); 527 NavigationController* controller = tab_tracker_->GetResource(tab_handle);
528 int index; 528 Browser* browser = browser::FindBrowserWithWebContents(
529 Browser* browser = browser::FindBrowserForController(controller, &index); 529 controller->GetWebContents());
530 DCHECK(browser); 530 DCHECK(browser);
531 new TabClosedNotificationObserver(this, wait_until_closed, reply_message, 531 new TabClosedNotificationObserver(this, wait_until_closed, reply_message,
532 false); 532 false);
533 chrome::CloseWebContents(browser, controller->GetWebContents()); 533 chrome::CloseWebContents(browser, controller->GetWebContents());
534 return; 534 return;
535 } 535 }
536 536
537 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false); 537 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false);
538 Send(reply_message); 538 Send(reply_message);
539 } 539 }
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 } 1037 }
1038 *title_string_size = static_cast<int>(title->size()); 1038 *title_string_size = static_cast<int>(title->size());
1039 } 1039 }
1040 } 1040 }
1041 1041
1042 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) { 1042 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
1043 *tabstrip_index = -1; // -1 is the error code 1043 *tabstrip_index = -1; // -1 is the error code
1044 1044
1045 if (tab_tracker_->ContainsHandle(handle)) { 1045 if (tab_tracker_->ContainsHandle(handle)) {
1046 NavigationController* tab = tab_tracker_->GetResource(handle); 1046 NavigationController* tab = tab_tracker_->GetResource(handle);
1047 Browser* browser = browser::FindBrowserForController(tab, NULL); 1047 Browser* browser = browser::FindBrowserWithWebContents(
1048 tab->GetWebContents());
1048 *tabstrip_index = chrome::GetIndexOfTab(browser, tab->GetWebContents()); 1049 *tabstrip_index = chrome::GetIndexOfTab(browser, tab->GetWebContents());
1049 } 1050 }
1050 } 1051 }
1051 1052
1052 void TestingAutomationProvider::GetTabURL(int handle, 1053 void TestingAutomationProvider::GetTabURL(int handle,
1053 bool* success, 1054 bool* success,
1054 GURL* url) { 1055 GURL* url) {
1055 *success = false; 1056 *success = false;
1056 if (tab_tracker_->ContainsHandle(handle)) { 1057 if (tab_tracker_->ContainsHandle(handle)) {
1057 NavigationController* tab = tab_tracker_->GetResource(handle); 1058 NavigationController* tab = tab_tracker_->GetResource(handle);
(...skipping 6183 matching lines...) Expand 10 before | Expand all | Expand 10 after
7241 void TestingAutomationProvider::OnRemoveProvider() { 7242 void TestingAutomationProvider::OnRemoveProvider() {
7242 if (g_browser_process) 7243 if (g_browser_process)
7243 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); 7244 g_browser_process->GetAutomationProviderList()->RemoveProvider(this);
7244 } 7245 }
7245 7246
7246 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, 7247 void TestingAutomationProvider::EnsureTabSelected(Browser* browser,
7247 WebContents* tab) { 7248 WebContents* tab) {
7248 if (chrome::GetActiveWebContents(browser) != tab) 7249 if (chrome::GetActiveWebContents(browser) != tab)
7249 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); 7250 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true);
7250 } 7251 }
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