| 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 5731 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5742 WebContents* old_contents = chrome::GetActiveWebContents(browser); | 5742 WebContents* old_contents = chrome::GetActiveWebContents(browser); |
| 5743 if (!old_contents) { | 5743 if (!old_contents) { |
| 5744 AutomationJSONReply(this, reply_message).SendError( | 5744 AutomationJSONReply(this, reply_message).SendError( |
| 5745 "Cannot identify selected tab contents."); | 5745 "Cannot identify selected tab contents."); |
| 5746 return; | 5746 return; |
| 5747 } | 5747 } |
| 5748 | 5748 |
| 5749 // This observer will delete itself. | 5749 // This observer will delete itself. |
| 5750 new AppLaunchObserver(&old_contents->GetController(), this, reply_message, | 5750 new AppLaunchObserver(&old_contents->GetController(), this, reply_message, |
| 5751 launch_container); | 5751 launch_container); |
| 5752 application_launch::OpenApplication(profile(), extension, launch_container, | 5752 application_launch::OpenApplication(application_launch::LaunchParams( |
| 5753 GURL(), CURRENT_TAB, NULL); | 5753 profile(), extension, launch_container, CURRENT_TAB)); |
| 5754 } | 5754 } |
| 5755 | 5755 |
| 5756 // Sample JSON input: { "command": "SetAppLaunchType", | 5756 // Sample JSON input: { "command": "SetAppLaunchType", |
| 5757 // "id": "ahfgeienlihckogmohjhadlkjgocpleb", | 5757 // "id": "ahfgeienlihckogmohjhadlkjgocpleb", |
| 5758 // "launch_type": "pinned" } | 5758 // "launch_type": "pinned" } |
| 5759 // Sample JSON output: {} | 5759 // Sample JSON output: {} |
| 5760 void TestingAutomationProvider::SetAppLaunchType( | 5760 void TestingAutomationProvider::SetAppLaunchType( |
| 5761 Browser* browser, | 5761 Browser* browser, |
| 5762 DictionaryValue* args, | 5762 DictionaryValue* args, |
| 5763 IPC::Message* reply_message) { | 5763 IPC::Message* reply_message) { |
| (...skipping 1004 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6768 void TestingAutomationProvider::OnRemoveProvider() { | 6768 void TestingAutomationProvider::OnRemoveProvider() { |
| 6769 if (g_browser_process) | 6769 if (g_browser_process) |
| 6770 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6770 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
| 6771 } | 6771 } |
| 6772 | 6772 |
| 6773 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6773 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
| 6774 WebContents* tab) { | 6774 WebContents* tab) { |
| 6775 if (chrome::GetActiveWebContents(browser) != tab) | 6775 if (chrome::GetActiveWebContents(browser) != tab) |
| 6776 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6776 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
| 6777 } | 6777 } |
| OLD | NEW |