| OLD | NEW |
| 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 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1119 profiles->Append(item); | 1119 profiles->Append(item); |
| 1120 } | 1120 } |
| 1121 return_value->Set("profiles", profiles); | 1121 return_value->Set("profiles", profiles); |
| 1122 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); | 1122 AutomationJSONReply(this, reply_message).SendSuccess(return_value.get()); |
| 1123 } | 1123 } |
| 1124 | 1124 |
| 1125 void TestingAutomationProvider::OpenNewBrowserWindowOfType( | 1125 void TestingAutomationProvider::OpenNewBrowserWindowOfType( |
| 1126 int type, bool show, IPC::Message* reply_message) { | 1126 int type, bool show, IPC::Message* reply_message) { |
| 1127 new BrowserOpenedNotificationObserver(this, reply_message, false); | 1127 new BrowserOpenedNotificationObserver(this, reply_message, false); |
| 1128 // We may have no current browser windows open so don't rely on | 1128 // We may have no current browser windows open so don't rely on |
| 1129 // asking an existing browser to execute the IDC_NEWWINDOW command | 1129 // asking an existing browser to execute the IDC_NEWWINDOW command. |
| 1130 Browser* browser = new Browser( | 1130 Browser* browser = new Browser( |
| 1131 Browser::CreateParams(static_cast<Browser::Type>(type), profile_)); | 1131 Browser::CreateParams(static_cast<Browser::Type>(type), profile_)); |
| 1132 chrome::AddBlankTab(browser, true); | 1132 chrome::AddBlankTabAt(browser, -1, true); |
| 1133 if (show) | 1133 if (show) |
| 1134 browser->window()->Show(); | 1134 browser->window()->Show(); |
| 1135 } | 1135 } |
| 1136 | 1136 |
| 1137 void TestingAutomationProvider::OpenNewBrowserWindow( | 1137 void TestingAutomationProvider::OpenNewBrowserWindow( |
| 1138 base::DictionaryValue* args, | 1138 base::DictionaryValue* args, |
| 1139 IPC::Message* reply_message) { | 1139 IPC::Message* reply_message) { |
| 1140 bool show; | 1140 bool show; |
| 1141 if (!args->GetBoolean("show", &show)) { | 1141 if (!args->GetBoolean("show", &show)) { |
| 1142 AutomationJSONReply(this, reply_message) | 1142 AutomationJSONReply(this, reply_message) |
| 1143 .SendError("'show' missing or invalid."); | 1143 .SendError("'show' missing or invalid."); |
| 1144 return; | 1144 return; |
| 1145 } | 1145 } |
| 1146 new BrowserOpenedNotificationObserver(this, reply_message, true); | 1146 new BrowserOpenedNotificationObserver(this, reply_message, true); |
| 1147 Browser* browser = new Browser( | 1147 Browser* browser = new Browser( |
| 1148 Browser::CreateParams(Browser::TYPE_TABBED, profile_)); | 1148 Browser::CreateParams(Browser::TYPE_TABBED, profile_)); |
| 1149 chrome::AddBlankTab(browser, true); | 1149 chrome::AddBlankTabAt(browser, -1, true); |
| 1150 if (show) | 1150 if (show) |
| 1151 browser->window()->Show(); | 1151 browser->window()->Show(); |
| 1152 } | 1152 } |
| 1153 | 1153 |
| 1154 void TestingAutomationProvider::GetBrowserWindowCountJSON( | 1154 void TestingAutomationProvider::GetBrowserWindowCountJSON( |
| 1155 base::DictionaryValue* args, | 1155 base::DictionaryValue* args, |
| 1156 IPC::Message* reply_message) { | 1156 IPC::Message* reply_message) { |
| 1157 DictionaryValue dict; | 1157 DictionaryValue dict; |
| 1158 dict.SetInteger("count", static_cast<int>(BrowserList::size())); | 1158 dict.SetInteger("count", static_cast<int>(BrowserList::size())); |
| 1159 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | 1159 AutomationJSONReply(this, reply_message).SendSuccess(&dict); |
| (...skipping 5181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6341 void TestingAutomationProvider::OnRemoveProvider() { | 6341 void TestingAutomationProvider::OnRemoveProvider() { |
| 6342 if (g_browser_process) | 6342 if (g_browser_process) |
| 6343 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6343 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6344 } | 6344 } |
| 6345 | 6345 |
| 6346 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6346 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 6347 WebContents* tab) { | 6347 WebContents* tab) { |
| 6348 if (chrome::GetActiveWebContents(browser) != tab) | 6348 if (chrome::GetActiveWebContents(browser) != tab) |
| 6349 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6349 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
| 6350 } | 6350 } |
| OLD | NEW |