OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 3520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3531 model->OnUpOrDownKeyPressed(count); | 3531 model->OnUpOrDownKeyPressed(count); |
3532 reply.SendSuccess(NULL); | 3532 reply.SendSuccess(NULL); |
3533 } | 3533 } |
3534 | 3534 |
3535 // Sample json input: { "command": "OmniboxAcceptInput" } | 3535 // Sample json input: { "command": "OmniboxAcceptInput" } |
3536 void TestingAutomationProvider::OmniboxAcceptInput( | 3536 void TestingAutomationProvider::OmniboxAcceptInput( |
3537 Browser* browser, | 3537 Browser* browser, |
3538 DictionaryValue* args, | 3538 DictionaryValue* args, |
3539 IPC::Message* reply_message) { | 3539 IPC::Message* reply_message) { |
3540 NavigationController& controller = | 3540 NavigationController& controller = |
3541 browser->GetSelectedTabContents()->GetController(); | 3541 browser->GetSelectedWebContents()->GetController(); |
3542 new OmniboxAcceptNotificationObserver(&controller, this, reply_message); | 3542 new OmniboxAcceptNotificationObserver(&controller, this, reply_message); |
3543 browser->window()->GetLocationBar()->AcceptInput(); | 3543 browser->window()->GetLocationBar()->AcceptInput(); |
3544 } | 3544 } |
3545 | 3545 |
3546 // Sample json input: { "command": "GetInstantInfo" } | 3546 // Sample json input: { "command": "GetInstantInfo" } |
3547 void TestingAutomationProvider::GetInstantInfo(Browser* browser, | 3547 void TestingAutomationProvider::GetInstantInfo(Browser* browser, |
3548 DictionaryValue* args, | 3548 DictionaryValue* args, |
3549 IPC::Message* reply_message) { | 3549 IPC::Message* reply_message) { |
3550 DictionaryValue* info = new DictionaryValue; | 3550 DictionaryValue* info = new DictionaryValue; |
3551 if (browser->instant()) { | 3551 if (browser->instant()) { |
(...skipping 2287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5839 id.c_str())); | 5839 id.c_str())); |
5840 return; | 5840 return; |
5841 } | 5841 } |
5842 | 5842 |
5843 // Look at preferences to find the right launch container. If no preference | 5843 // Look at preferences to find the right launch container. If no preference |
5844 // is set, launch as a regular tab. | 5844 // is set, launch as a regular tab. |
5845 extension_misc::LaunchContainer launch_container = | 5845 extension_misc::LaunchContainer launch_container = |
5846 service->extension_prefs()->GetLaunchContainer( | 5846 service->extension_prefs()->GetLaunchContainer( |
5847 extension, ExtensionPrefs::LAUNCH_REGULAR); | 5847 extension, ExtensionPrefs::LAUNCH_REGULAR); |
5848 | 5848 |
5849 TabContents* old_contents = browser->GetSelectedTabContents(); | 5849 WebContents* old_contents = browser->GetSelectedWebContents(); |
5850 if (!old_contents) { | 5850 if (!old_contents) { |
5851 AutomationJSONReply(this, reply_message).SendError( | 5851 AutomationJSONReply(this, reply_message).SendError( |
5852 "Cannot identify selected tab contents."); | 5852 "Cannot identify selected tab contents."); |
5853 return; | 5853 return; |
5854 } | 5854 } |
5855 | 5855 |
5856 // This observer will delete itself. | 5856 // This observer will delete itself. |
5857 new AppLaunchObserver(&old_contents->GetController(), this, reply_message, | 5857 new AppLaunchObserver(&old_contents->GetController(), this, reply_message, |
5858 launch_container); | 5858 launch_container); |
5859 Browser::OpenApplication(profile(), extension, launch_container, GURL(), | 5859 Browser::OpenApplication(profile(), extension, launch_container, GURL(), |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6683 | 6683 |
6684 Send(reply_message_); | 6684 Send(reply_message_); |
6685 redirect_query_ = 0; | 6685 redirect_query_ = 0; |
6686 reply_message_ = NULL; | 6686 reply_message_ = NULL; |
6687 } | 6687 } |
6688 | 6688 |
6689 void TestingAutomationProvider::OnRemoveProvider() { | 6689 void TestingAutomationProvider::OnRemoveProvider() { |
6690 if (g_browser_process) | 6690 if (g_browser_process) |
6691 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6691 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6692 } | 6692 } |
OLD | NEW |