Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(29)

Side by Side Diff: chrome/browser/automation/testing_automation_provider.cc

Issue 7104029: Automation: fix chrome/browser dependency on chrome/test headers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 11 matching lines...) Expand all
22 #include "base/time.h" 22 #include "base/time.h"
23 #include "base/utf_string_conversions.h" 23 #include "base/utf_string_conversions.h"
24 #include "chrome/app/chrome_command_ids.h" 24 #include "chrome/app/chrome_command_ids.h"
25 #include "chrome/browser/autocomplete/autocomplete.h" 25 #include "chrome/browser/autocomplete/autocomplete.h"
26 #include "chrome/browser/autocomplete/autocomplete_edit.h" 26 #include "chrome/browser/autocomplete/autocomplete_edit.h"
27 #include "chrome/browser/autocomplete/autocomplete_match.h" 27 #include "chrome/browser/autocomplete/autocomplete_match.h"
28 #include "chrome/browser/autofill/autofill_manager.h" 28 #include "chrome/browser/autofill/autofill_manager.h"
29 #include "chrome/browser/autofill/credit_card.h" 29 #include "chrome/browser/autofill/credit_card.h"
30 #include "chrome/browser/autofill/personal_data_manager.h" 30 #include "chrome/browser/autofill/personal_data_manager.h"
31 #include "chrome/browser/automation/automation_browser_tracker.h" 31 #include "chrome/browser/automation/automation_browser_tracker.h"
32 #include "chrome/browser/automation/automation_omnibox_tracker.h"
33 #include "chrome/browser/automation/automation_provider_json.h" 32 #include "chrome/browser/automation/automation_provider_json.h"
34 #include "chrome/browser/automation/automation_provider_list.h" 33 #include "chrome/browser/automation/automation_provider_list.h"
35 #include "chrome/browser/automation/automation_provider_observers.h" 34 #include "chrome/browser/automation/automation_provider_observers.h"
36 #include "chrome/browser/automation/automation_tab_tracker.h" 35 #include "chrome/browser/automation/automation_tab_tracker.h"
37 #include "chrome/browser/automation/automation_util.h" 36 #include "chrome/browser/automation/automation_util.h"
38 #include "chrome/browser/automation/automation_window_tracker.h" 37 #include "chrome/browser/automation/automation_window_tracker.h"
39 #include "chrome/browser/automation/ui_controls.h" 38 #include "chrome/browser/automation/ui_controls.h"
40 #include "chrome/browser/bookmarks/bookmark_model.h" 39 #include "chrome/browser/bookmarks/bookmark_model.h"
41 #include "chrome/browser/bookmarks/bookmark_storage.h" 40 #include "chrome/browser/bookmarks/bookmark_storage.h"
42 #include "chrome/browser/browser_process.h" 41 #include "chrome/browser/browser_process.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h" 73 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog.h"
75 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h" 74 #include "chrome/browser/ui/app_modal_dialogs/app_modal_dialog_queue.h"
76 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h" 75 #include "chrome/browser/ui/app_modal_dialogs/js_modal_dialog.h"
77 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h" 76 #include "chrome/browser/ui/app_modal_dialogs/native_app_modal_dialog.h"
78 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h" 77 #include "chrome/browser/ui/blocked_content/blocked_content_tab_helper.h"
79 #include "chrome/browser/ui/browser_window.h" 78 #include "chrome/browser/ui/browser_window.h"
80 #include "chrome/browser/ui/download/download_tab_helper.h" 79 #include "chrome/browser/ui/download/download_tab_helper.h"
81 #include "chrome/browser/ui/find_bar/find_bar.h" 80 #include "chrome/browser/ui/find_bar/find_bar.h"
82 #include "chrome/browser/ui/login/login_prompt.h" 81 #include "chrome/browser/ui/login/login_prompt.h"
83 #include "chrome/browser/ui/omnibox/location_bar.h" 82 #include "chrome/browser/ui/omnibox/location_bar.h"
83 #include "chrome/browser/ui/omnibox/omnibox_view.h"
84 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h" 84 #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
85 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" 85 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
86 #include "chrome/browser/ui/webui/active_downloads_ui.h" 86 #include "chrome/browser/ui/webui/active_downloads_ui.h"
87 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h" 87 #include "chrome/browser/ui/webui/ntp/shown_sections_handler.h"
88 #include "chrome/common/automation_messages.h" 88 #include "chrome/common/automation_messages.h"
89 #include "chrome/common/chrome_constants.h" 89 #include "chrome/common/chrome_constants.h"
90 #include "chrome/common/chrome_paths.h" 90 #include "chrome/common/chrome_paths.h"
91 #include "chrome/common/chrome_switches.h" 91 #include "chrome/common/chrome_switches.h"
92 #include "chrome/common/extensions/extension.h" 92 #include "chrome/common/extensions/extension.h"
93 #include "chrome/common/extensions/url_pattern.h" 93 #include "chrome/common/extensions/url_pattern.h"
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 IsBrowserInApplicationMode) 295 IsBrowserInApplicationMode)
296 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab) 296 IPC_MESSAGE_HANDLER(AutomationMsg_Tab, GetTab)
297 IPC_MESSAGE_HANDLER(AutomationMsg_TabProcessID, GetTabProcessID) 297 IPC_MESSAGE_HANDLER(AutomationMsg_TabProcessID, GetTabProcessID)
298 IPC_MESSAGE_HANDLER(AutomationMsg_TabTitle, GetTabTitle) 298 IPC_MESSAGE_HANDLER(AutomationMsg_TabTitle, GetTabTitle)
299 IPC_MESSAGE_HANDLER(AutomationMsg_TabIndex, GetTabIndex) 299 IPC_MESSAGE_HANDLER(AutomationMsg_TabIndex, GetTabIndex)
300 IPC_MESSAGE_HANDLER(AutomationMsg_TabURL, GetTabURL) 300 IPC_MESSAGE_HANDLER(AutomationMsg_TabURL, GetTabURL)
301 IPC_MESSAGE_HANDLER(AutomationMsg_ShelfVisibility, GetShelfVisibility) 301 IPC_MESSAGE_HANDLER(AutomationMsg_ShelfVisibility, GetShelfVisibility)
302 IPC_MESSAGE_HANDLER(AutomationMsg_IsFullscreen, IsFullscreen) 302 IPC_MESSAGE_HANDLER(AutomationMsg_IsFullscreen, IsFullscreen)
303 IPC_MESSAGE_HANDLER(AutomationMsg_IsFullscreenBubbleVisible, 303 IPC_MESSAGE_HANDLER(AutomationMsg_IsFullscreenBubbleVisible,
304 GetFullscreenBubbleVisibility) 304 GetFullscreenBubbleVisibility)
305 IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditForBrowser,
306 GetAutocompleteEditForBrowser)
307 IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditGetText,
308 GetAutocompleteEditText)
309 IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditSetText,
310 SetAutocompleteEditText)
311 IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditIsQueryInProgress,
312 AutocompleteEditIsQueryInProgress)
313 IPC_MESSAGE_HANDLER(AutomationMsg_AutocompleteEditGetMatches,
314 AutocompleteEditGetMatches)
315 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForAutocompleteEditFocus,
316 WaitForAutocompleteEditFocus)
317 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_DomOperation, 305 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_DomOperation,
318 ExecuteJavascript) 306 ExecuteJavascript)
319 IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowCount, 307 IPC_MESSAGE_HANDLER(AutomationMsg_ConstrainedWindowCount,
320 GetConstrainedWindowCount) 308 GetConstrainedWindowCount)
321 #if defined(TOOLKIT_VIEWS) 309 #if defined(TOOLKIT_VIEWS)
322 IPC_MESSAGE_HANDLER(AutomationMsg_GetFocusedViewID, GetFocusedViewID) 310 IPC_MESSAGE_HANDLER(AutomationMsg_GetFocusedViewID, GetFocusedViewID)
323 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForFocusedViewIDToChange, 311 IPC_MESSAGE_HANDLER_DELAY_REPLY(AutomationMsg_WaitForFocusedViewIDToChange,
324 WaitForFocusedViewIDToChange) 312 WaitForFocusedViewIDToChange)
325 IPC_MESSAGE_HANDLER(AutomationMsg_StartTrackingPopupMenus, 313 IPC_MESSAGE_HANDLER(AutomationMsg_StartTrackingPopupMenus,
326 StartTrackingPopupMenus) 314 StartTrackingPopupMenus)
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 bool* visible) { 1195 bool* visible) {
1208 *visible = false; 1196 *visible = false;
1209 1197
1210 if (browser_tracker_->ContainsHandle(handle)) { 1198 if (browser_tracker_->ContainsHandle(handle)) {
1211 Browser* browser = browser_tracker_->GetResource(handle); 1199 Browser* browser = browser_tracker_->GetResource(handle);
1212 if (browser) 1200 if (browser)
1213 *visible = browser->window()->IsFullscreenBubbleVisible(); 1201 *visible = browser->window()->IsFullscreenBubbleVisible();
1214 } 1202 }
1215 } 1203 }
1216 1204
1217 void TestingAutomationProvider::GetAutocompleteEditText(
1218 int autocomplete_edit_handle,
1219 bool* success,
1220 string16* text) {
1221 *success = false;
1222 if (automation_omnibox_tracker_->ContainsHandle(autocomplete_edit_handle)) {
1223 *text = automation_omnibox_tracker_->GetResource(autocomplete_edit_handle)->
1224 GetText();
1225 *success = true;
1226 }
1227 }
1228
1229 void TestingAutomationProvider::SetAutocompleteEditText(
1230 int autocomplete_edit_handle,
1231 const string16& text,
1232 bool* success) {
1233 *success = false;
1234 if (automation_omnibox_tracker_->ContainsHandle(autocomplete_edit_handle)) {
1235 automation_omnibox_tracker_->GetResource(autocomplete_edit_handle)->
1236 SetUserText(text);
1237 *success = true;
1238 }
1239 }
1240
1241 void TestingAutomationProvider::AutocompleteEditGetMatches(
1242 int autocomplete_edit_handle,
1243 bool* success,
1244 std::vector<AutocompleteMatchData>* matches) {
1245 *success = false;
1246 if (automation_omnibox_tracker_->ContainsHandle(autocomplete_edit_handle)) {
1247 const AutocompleteResult& result = automation_omnibox_tracker_->
1248 GetResource(autocomplete_edit_handle)->model()->result();
1249 for (AutocompleteResult::const_iterator i = result.begin();
1250 i != result.end(); ++i)
1251 matches->push_back(AutocompleteMatchData(*i));
1252 *success = true;
1253 }
1254 }
1255
1256 // Waits for the autocomplete edit to receive focus
1257 void TestingAutomationProvider::WaitForAutocompleteEditFocus(
1258 int autocomplete_edit_handle,
1259 IPC::Message* reply_message) {
1260 if (!automation_omnibox_tracker_->ContainsHandle(autocomplete_edit_handle)) {
1261 AutomationMsg_WaitForAutocompleteEditFocus::WriteReplyParams(
1262 reply_message_, false);
1263 Send(reply_message);
1264 return;
1265 }
1266
1267 AutocompleteEditModel* model = automation_omnibox_tracker_->
1268 GetResource(autocomplete_edit_handle)-> model();
1269 if (model->has_focus()) {
1270 AutomationMsg_WaitForAutocompleteEditFocus::WriteReplyParams(
1271 reply_message, true);
1272 Send(reply_message);
1273 return;
1274 }
1275
1276 // The observer deletes itself when the notification arrives.
1277 new AutocompleteEditFocusedObserver(this, model, reply_message);
1278 }
1279
1280 void TestingAutomationProvider::GetAutocompleteEditForBrowser(
1281 int browser_handle,
1282 bool* success,
1283 int* autocomplete_edit_handle) {
1284 *success = false;
1285 *autocomplete_edit_handle = 0;
1286
1287 if (browser_tracker_->ContainsHandle(browser_handle)) {
1288 Browser* browser = browser_tracker_->GetResource(browser_handle);
1289 LocationBar* loc_bar = browser->window()->GetLocationBar();
1290 OmniboxView* omnibox_view = loc_bar->location_entry();
1291 // Add() returns the existing handle for the resource if any.
1292 *autocomplete_edit_handle = automation_omnibox_tracker_->Add(omnibox_view);
1293 *success = true;
1294 }
1295 }
1296
1297 void TestingAutomationProvider::AutocompleteEditIsQueryInProgress(
1298 int autocomplete_edit_handle,
1299 bool* success,
1300 bool* query_in_progress) {
1301 *success = false;
1302 *query_in_progress = false;
1303 if (automation_omnibox_tracker_->ContainsHandle(autocomplete_edit_handle)) {
1304 *query_in_progress = !automation_omnibox_tracker_->
1305 GetResource(autocomplete_edit_handle)->model()->
1306 autocomplete_controller()->done();
1307 *success = true;
1308 }
1309 }
1310
1311 void TestingAutomationProvider::ExecuteJavascript( 1205 void TestingAutomationProvider::ExecuteJavascript(
1312 int handle, 1206 int handle,
1313 const std::wstring& frame_xpath, 1207 const std::wstring& frame_xpath,
1314 const std::wstring& script, 1208 const std::wstring& script,
1315 IPC::Message* reply_message) { 1209 IPC::Message* reply_message) {
1316 TabContents* tab_contents = GetTabContentsForHandle(handle, NULL); 1210 TabContents* tab_contents = GetTabContentsForHandle(handle, NULL);
1317 if (!tab_contents) { 1211 if (!tab_contents) {
1318 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string()); 1212 AutomationMsg_DomOperation::WriteReplyParams(reply_message, std::string());
1319 Send(reply_message); 1213 Send(reply_message);
1320 return; 1214 return;
(...skipping 4644 matching lines...) Expand 10 before | Expand all | Expand 10 after
5965 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); 5859 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl);
5966 5860
5967 Send(reply_message_); 5861 Send(reply_message_);
5968 redirect_query_ = 0; 5862 redirect_query_ = 0;
5969 reply_message_ = NULL; 5863 reply_message_ = NULL;
5970 } 5864 }
5971 5865
5972 void TestingAutomationProvider::OnRemoveProvider() { 5866 void TestingAutomationProvider::OnRemoveProvider() {
5973 AutomationProviderList::GetInstance()->RemoveProvider(this); 5867 AutomationProviderList::GetInstance()->RemoveProvider(this);
5974 } 5868 }
OLDNEW
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.h ('k') | chrome/chrome.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698