| 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 3267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3278 AutomationJSONReply reply(this, reply_message); | 3278 AutomationJSONReply reply(this, reply_message); |
| 3279 if (!args->GetInteger("count", &count)) { | 3279 if (!args->GetInteger("count", &count)) { |
| 3280 reply.SendError("count missing"); | 3280 reply.SendError("count missing"); |
| 3281 return; | 3281 return; |
| 3282 } | 3282 } |
| 3283 LocationBar* loc_bar = browser->window()->GetLocationBar(); | 3283 LocationBar* loc_bar = browser->window()->GetLocationBar(); |
| 3284 if (!loc_bar) { | 3284 if (!loc_bar) { |
| 3285 reply.SendError("The specified browser does not have a location bar."); | 3285 reply.SendError("The specified browser does not have a location bar."); |
| 3286 return; | 3286 return; |
| 3287 } | 3287 } |
| 3288 OmniboxEditModel* model = loc_bar->GetLocationEntry()->model(); | 3288 loc_bar->GetLocationEntry()->model()->OnUpOrDownKeyPressed(count); |
| 3289 model->OnUpOrDownKeyPressed(count); | |
| 3290 reply.SendSuccess(NULL); | 3289 reply.SendSuccess(NULL); |
| 3291 } | 3290 } |
| 3292 | 3291 |
| 3293 // Sample json input: { "command": "OmniboxAcceptInput" } | 3292 // Sample json input: { "command": "OmniboxAcceptInput" } |
| 3294 void TestingAutomationProvider::OmniboxAcceptInput( | 3293 void TestingAutomationProvider::OmniboxAcceptInput( |
| 3295 Browser* browser, | 3294 Browser* browser, |
| 3296 DictionaryValue* args, | 3295 DictionaryValue* args, |
| 3297 IPC::Message* reply_message) { | 3296 IPC::Message* reply_message) { |
| 3298 NavigationController& controller = | 3297 NavigationController& controller = |
| 3299 chrome::GetActiveWebContents(browser)->GetController(); | 3298 chrome::GetActiveWebContents(browser)->GetController(); |
| (...skipping 3877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7177 void TestingAutomationProvider::OnRemoveProvider() { | 7176 void TestingAutomationProvider::OnRemoveProvider() { |
| 7178 if (g_browser_process) | 7177 if (g_browser_process) |
| 7179 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7178 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 7180 } | 7179 } |
| 7181 | 7180 |
| 7182 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 7181 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 7183 WebContents* tab) { | 7182 WebContents* tab) { |
| 7184 if (chrome::GetActiveWebContents(browser) != tab) | 7183 if (chrome::GetActiveWebContents(browser) != tab) |
| 7185 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 7184 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
| 7186 } | 7185 } |
| OLD | NEW |