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

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

Issue 11434074: browser: Move FindBrowserWithWebContents() into chrome namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
508 Browser* browser = browser_tracker_->GetResource(handle); 508 Browser* browser = browser_tracker_->GetResource(handle);
509 *active_tab_index = browser->active_index(); 509 *active_tab_index = browser->active_index();
510 } 510 }
511 } 511 }
512 512
513 void TestingAutomationProvider::CloseTab(int tab_handle, 513 void TestingAutomationProvider::CloseTab(int tab_handle,
514 bool wait_until_closed, 514 bool wait_until_closed,
515 IPC::Message* reply_message) { 515 IPC::Message* reply_message) {
516 if (tab_tracker_->ContainsHandle(tab_handle)) { 516 if (tab_tracker_->ContainsHandle(tab_handle)) {
517 NavigationController* controller = tab_tracker_->GetResource(tab_handle); 517 NavigationController* controller = tab_tracker_->GetResource(tab_handle);
518 Browser* browser = browser::FindBrowserWithWebContents( 518 Browser* browser = chrome::FindBrowserWithWebContents(
519 controller->GetWebContents()); 519 controller->GetWebContents());
520 DCHECK(browser); 520 DCHECK(browser);
521 new TabClosedNotificationObserver(this, wait_until_closed, reply_message, 521 new TabClosedNotificationObserver(this, wait_until_closed, reply_message,
522 false); 522 false);
523 chrome::CloseWebContents(browser, controller->GetWebContents()); 523 chrome::CloseWebContents(browser, controller->GetWebContents());
524 return; 524 return;
525 } 525 }
526 526
527 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false); 527 AutomationMsg_CloseTab::WriteReplyParams(reply_message, false);
528 Send(reply_message); 528 Send(reply_message);
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1027 } 1027 }
1028 *title_string_size = static_cast<int>(title->size()); 1028 *title_string_size = static_cast<int>(title->size());
1029 } 1029 }
1030 } 1030 }
1031 1031
1032 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) { 1032 void TestingAutomationProvider::GetTabIndex(int handle, int* tabstrip_index) {
1033 *tabstrip_index = -1; // -1 is the error code 1033 *tabstrip_index = -1; // -1 is the error code
1034 1034
1035 if (tab_tracker_->ContainsHandle(handle)) { 1035 if (tab_tracker_->ContainsHandle(handle)) {
1036 NavigationController* tab = tab_tracker_->GetResource(handle); 1036 NavigationController* tab = tab_tracker_->GetResource(handle);
1037 Browser* browser = browser::FindBrowserWithWebContents( 1037 Browser* browser = chrome::FindBrowserWithWebContents(
1038 tab->GetWebContents()); 1038 tab->GetWebContents());
1039 *tabstrip_index = browser->tab_strip_model()->GetIndexOfWebContents( 1039 *tabstrip_index = browser->tab_strip_model()->GetIndexOfWebContents(
1040 tab->GetWebContents()); 1040 tab->GetWebContents());
1041 } 1041 }
1042 } 1042 }
1043 1043
1044 void TestingAutomationProvider::GetTabURL(int handle, 1044 void TestingAutomationProvider::GetTabURL(int handle,
1045 bool* success, 1045 bool* success,
1046 GURL* url) { 1046 GURL* url) {
1047 *success = false; 1047 *success = false;
(...skipping 5310 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | chrome/browser/captive_portal/captive_portal_tab_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698