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 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 #include "chrome/browser/ui/browser_finder.h" | 96 #include "chrome/browser/ui/browser_finder.h" |
97 #include "chrome/browser/ui/browser_instant_controller.h" | 97 #include "chrome/browser/ui/browser_instant_controller.h" |
98 #include "chrome/browser/ui/browser_list.h" | 98 #include "chrome/browser/ui/browser_list.h" |
99 #include "chrome/browser/ui/browser_tabstrip.h" | 99 #include "chrome/browser/ui/browser_tabstrip.h" |
100 #include "chrome/browser/ui/browser_window.h" | 100 #include "chrome/browser/ui/browser_window.h" |
101 #include "chrome/browser/ui/extensions/application_launch.h" | 101 #include "chrome/browser/ui/extensions/application_launch.h" |
102 #include "chrome/browser/ui/find_bar/find_bar.h" | 102 #include "chrome/browser/ui/find_bar/find_bar.h" |
103 #include "chrome/browser/ui/find_bar/find_bar_controller.h" | 103 #include "chrome/browser/ui/find_bar/find_bar_controller.h" |
104 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" | 104 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
105 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" | 105 #include "chrome/browser/ui/fullscreen/fullscreen_exit_bubble_type.h" |
| 106 #include "chrome/browser/ui/host_desktop.h" |
106 #include "chrome/browser/ui/login/login_prompt.h" | 107 #include "chrome/browser/ui/login/login_prompt.h" |
107 #include "chrome/browser/ui/media_stream_infobar_delegate.h" | 108 #include "chrome/browser/ui/media_stream_infobar_delegate.h" |
108 #include "chrome/browser/ui/omnibox/location_bar.h" | 109 #include "chrome/browser/ui/omnibox/location_bar.h" |
109 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" | 110 #include "chrome/browser/ui/omnibox/omnibox_edit_model.h" |
110 #include "chrome/browser/ui/omnibox/omnibox_view.h" | 111 #include "chrome/browser/ui/omnibox/omnibox_view.h" |
111 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" | 112 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" |
112 #include "chrome/browser/ui/startup/startup_types.h" | 113 #include "chrome/browser/ui/startup/startup_types.h" |
113 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 114 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
114 #include "chrome/browser/view_type_utils.h" | 115 #include "chrome/browser/view_type_utils.h" |
115 #include "chrome/common/automation_constants.h" | 116 #include "chrome/common/automation_constants.h" |
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 web_contents->GetRenderViewHost()); | 1084 web_contents->GetRenderViewHost()); |
1084 } | 1085 } |
1085 | 1086 |
1086 // Sample json input: { "command": "OpenNewBrowserWindowWithNewProfile" } | 1087 // Sample json input: { "command": "OpenNewBrowserWindowWithNewProfile" } |
1087 // Sample output: {} | 1088 // Sample output: {} |
1088 void TestingAutomationProvider::OpenNewBrowserWindowWithNewProfile( | 1089 void TestingAutomationProvider::OpenNewBrowserWindowWithNewProfile( |
1089 base::DictionaryValue* args, IPC::Message* reply_message) { | 1090 base::DictionaryValue* args, IPC::Message* reply_message) { |
1090 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1091 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1091 new BrowserOpenedWithNewProfileNotificationObserver(this, reply_message); | 1092 new BrowserOpenedWithNewProfileNotificationObserver(this, reply_message); |
1092 profile_manager->CreateMultiProfileAsync( | 1093 profile_manager->CreateMultiProfileAsync( |
1093 string16(), string16(), ProfileManager::CreateCallback()); | 1094 string16(), string16(), ProfileManager::CreateCallback(), |
| 1095 chrome::HOST_DESKTOP_TYPE_NATIVE); |
1094 } | 1096 } |
1095 | 1097 |
1096 // Sample json input: { "command": "GetMultiProfileInfo" } | 1098 // Sample json input: { "command": "GetMultiProfileInfo" } |
1097 // See GetMultiProfileInfo() in pyauto.py for sample output. | 1099 // See GetMultiProfileInfo() in pyauto.py for sample output. |
1098 void TestingAutomationProvider::GetMultiProfileInfo( | 1100 void TestingAutomationProvider::GetMultiProfileInfo( |
1099 base::DictionaryValue* args, IPC::Message* reply_message) { | 1101 base::DictionaryValue* args, IPC::Message* reply_message) { |
1100 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); | 1102 scoped_ptr<DictionaryValue> return_value(new DictionaryValue); |
1101 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 1103 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
1102 const ProfileInfoCache& profile_info_cache = | 1104 const ProfileInfoCache& profile_info_cache = |
1103 profile_manager->GetProfileInfoCache(); | 1105 profile_manager->GetProfileInfoCache(); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1188 AutomationJSONReply(this, reply_message).SendError( | 1190 AutomationJSONReply(this, reply_message).SendError( |
1189 "Invalid or missing arg: 'num_loads'"); | 1191 "Invalid or missing arg: 'num_loads'"); |
1190 return; | 1192 return; |
1191 } | 1193 } |
1192 new BrowserOpenedWithExistingProfileNotificationObserver( | 1194 new BrowserOpenedWithExistingProfileNotificationObserver( |
1193 this, reply_message, num_loads); | 1195 this, reply_message, num_loads); |
1194 ProfileManager::FindOrCreateNewWindowForProfile( | 1196 ProfileManager::FindOrCreateNewWindowForProfile( |
1195 profile, | 1197 profile, |
1196 chrome::startup::IS_NOT_PROCESS_STARTUP, | 1198 chrome::startup::IS_NOT_PROCESS_STARTUP, |
1197 chrome::startup::IS_NOT_FIRST_RUN, | 1199 chrome::startup::IS_NOT_FIRST_RUN, |
1198 0); | 1200 chrome::HOST_DESKTOP_TYPE_NATIVE, |
| 1201 false); |
1199 } | 1202 } |
1200 | 1203 |
1201 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle, | 1204 void TestingAutomationProvider::GetWindowForBrowser(int browser_handle, |
1202 bool* success, | 1205 bool* success, |
1203 int* handle) { | 1206 int* handle) { |
1204 *success = false; | 1207 *success = false; |
1205 *handle = 0; | 1208 *handle = 0; |
1206 | 1209 |
1207 if (browser_tracker_->ContainsHandle(browser_handle)) { | 1210 if (browser_tracker_->ContainsHandle(browser_handle)) { |
1208 Browser* browser = browser_tracker_->GetResource(browser_handle); | 1211 Browser* browser = browser_tracker_->GetResource(browser_handle); |
(...skipping 5118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6327 void TestingAutomationProvider::OnRemoveProvider() { | 6330 void TestingAutomationProvider::OnRemoveProvider() { |
6328 if (g_browser_process) | 6331 if (g_browser_process) |
6329 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6332 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6330 } | 6333 } |
6331 | 6334 |
6332 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6335 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6333 WebContents* tab) { | 6336 WebContents* tab) { |
6334 if (chrome::GetActiveWebContents(browser) != tab) | 6337 if (chrome::GetActiveWebContents(browser) != tab) |
6335 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6338 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
6336 } | 6339 } |
OLD | NEW |