| 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 1212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1223 int num_loads; | 1223 int num_loads; |
| 1224 if (!args->GetInteger("num_loads", &num_loads)) { | 1224 if (!args->GetInteger("num_loads", &num_loads)) { |
| 1225 AutomationJSONReply(this, reply_message).SendError( | 1225 AutomationJSONReply(this, reply_message).SendError( |
| 1226 "Invalid or missing arg: 'num_loads'"); | 1226 "Invalid or missing arg: 'num_loads'"); |
| 1227 return; | 1227 return; |
| 1228 } | 1228 } |
| 1229 Browser* browser = browser::FindTabbedBrowser(profile, false); | 1229 Browser* browser = browser::FindTabbedBrowser(profile, false); |
| 1230 if (browser) { | 1230 if (browser) { |
| 1231 // Already have browser. Need to just activate. | 1231 // Already have browser. Need to just activate. |
| 1232 ProfileManager::FindOrCreateNewWindowForProfile( | 1232 ProfileManager::FindOrCreateNewWindowForProfile( |
| 1233 profile, | 1233 profile, |
| 1234 browser::startup::IS_NOT_PROCESS_STARTUP, | 1234 chrome::startup::IS_NOT_PROCESS_STARTUP, |
| 1235 browser::startup::IS_NOT_FIRST_RUN, | 1235 chrome::startup::IS_NOT_FIRST_RUN, |
| 1236 0); | 1236 0); |
| 1237 AutomationJSONReply(this, reply_message).SendSuccess(NULL); | 1237 AutomationJSONReply(this, reply_message).SendSuccess(NULL); |
| 1238 } else { | 1238 } else { |
| 1239 new BrowserOpenedWithExistingProfileNotificationObserver( | 1239 new BrowserOpenedWithExistingProfileNotificationObserver( |
| 1240 this, reply_message, num_loads); | 1240 this, reply_message, num_loads); |
| 1241 ProfileManager::FindOrCreateNewWindowForProfile( | 1241 ProfileManager::FindOrCreateNewWindowForProfile( |
| 1242 profile, | 1242 profile, |
| 1243 browser::startup::IS_NOT_PROCESS_STARTUP, | 1243 chrome::startup::IS_NOT_PROCESS_STARTUP, |
| 1244 browser::startup::IS_NOT_FIRST_RUN, | 1244 chrome::startup::IS_NOT_FIRST_RUN, |
| 1245 0); | 1245 0); |
| 1246 } | 1246 } |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle, | 1249 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle, |
| 1250 bool* success, | 1250 bool* success, |
| 1251 int* handle) { | 1251 int* handle) { |
| 1252 *success = false; | 1252 *success = false; |
| 1253 *handle = 0; | 1253 *handle = 0; |
| 1254 | 1254 |
| 1255 if (browser_tracker_->ContainsHandle(browser_handle)) { | 1255 if (browser_tracker_->ContainsHandle(browser_handle)) { |
| (...skipping 5477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6733 void TestingAutomationProvider::OnRemoveProvider() { | 6733 void TestingAutomationProvider::OnRemoveProvider() { |
| 6734 if (g_browser_process) | 6734 if (g_browser_process) |
| 6735 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6735 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6736 } | 6736 } |
| 6737 | 6737 |
| 6738 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6738 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 6739 WebContents* tab) { | 6739 WebContents* tab) { |
| 6740 if (chrome::GetActiveWebContents(browser) != tab) | 6740 if (chrome::GetActiveWebContents(browser) != tab) |
| 6741 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6741 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
| 6742 } | 6742 } |
| OLD | NEW |