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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 #include "content/public/browser/navigation_entry.h" | 132 #include "content/public/browser/navigation_entry.h" |
133 #include "content/public/browser/notification_service.h" | 133 #include "content/public/browser/notification_service.h" |
134 #include "content/public/browser/plugin_service.h" | 134 #include "content/public/browser/plugin_service.h" |
135 #include "content/public/browser/render_process_host.h" | 135 #include "content/public/browser/render_process_host.h" |
136 #include "content/public/browser/render_view_host.h" | 136 #include "content/public/browser/render_view_host.h" |
137 #include "content/public/browser/render_view_host_delegate.h" | 137 #include "content/public/browser/render_view_host_delegate.h" |
138 #include "content/public/browser/render_widget_host_view.h" | 138 #include "content/public/browser/render_widget_host_view.h" |
139 #include "content/public/browser/web_contents.h" | 139 #include "content/public/browser/web_contents.h" |
140 #include "content/public/common/child_process_host.h" | 140 #include "content/public/common/child_process_host.h" |
141 #include "content/public/common/common_param_traits.h" | 141 #include "content/public/common/common_param_traits.h" |
| 142 #include "content/public/common/geoposition.h" |
142 #include "content/public/common/ssl_status.h" | 143 #include "content/public/common/ssl_status.h" |
143 #include "net/cookies/cookie_store.h" | 144 #include "net/cookies/cookie_store.h" |
144 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" | 145 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputEvent.h" |
145 #include "ui/base/events.h" | 146 #include "ui/base/events.h" |
146 #include "ui/base/keycodes/keyboard_codes.h" | 147 #include "ui/base/keycodes/keyboard_codes.h" |
147 #include "ui/base/ui_base_types.h" | 148 #include "ui/base/ui_base_types.h" |
148 #include "ui/ui_controls/ui_controls.h" | 149 #include "ui/ui_controls/ui_controls.h" |
149 #include "webkit/glue/webdropdata.h" | 150 #include "webkit/glue/webdropdata.h" |
150 #include "webkit/plugins/webplugininfo.h" | 151 #include "webkit/plugins/webplugininfo.h" |
151 | 152 |
(...skipping 4769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4921 base::DictionaryValue* args, | 4922 base::DictionaryValue* args, |
4922 IPC::Message* reply_message) { | 4923 IPC::Message* reply_message) { |
4923 double latitude, longitude, altitude; | 4924 double latitude, longitude, altitude; |
4924 if (!args->GetDouble("latitude", &latitude) || | 4925 if (!args->GetDouble("latitude", &latitude) || |
4925 !args->GetDouble("longitude", &longitude) || | 4926 !args->GetDouble("longitude", &longitude) || |
4926 !args->GetDouble("altitude", &altitude)) { | 4927 !args->GetDouble("altitude", &altitude)) { |
4927 AutomationJSONReply(this, reply_message).SendError( | 4928 AutomationJSONReply(this, reply_message).SendError( |
4928 "Missing or invalid geolocation parameters"); | 4929 "Missing or invalid geolocation parameters"); |
4929 return; | 4930 return; |
4930 } | 4931 } |
| 4932 content::Geoposition position; |
| 4933 position.latitude = latitude; |
| 4934 position.longitude = longitude; |
| 4935 position.altitude = altitude; |
| 4936 position.accuracy = 0.; |
| 4937 position.timestamp = base::Time::Now(); |
4931 content::OverrideLocationForTesting( | 4938 content::OverrideLocationForTesting( |
4932 latitude, longitude, altitude, | 4939 position, |
4933 base::Bind(&SendSuccessIfAlive, AsWeakPtr(), reply_message)); | 4940 base::Bind(&SendSuccessIfAlive, AsWeakPtr(), reply_message)); |
4934 } | 4941 } |
4935 | 4942 |
4936 // Sample json input: | 4943 // Sample json input: |
4937 // { "command": "GetAutofillProfile" } | 4944 // { "command": "GetAutofillProfile" } |
4938 // Refer to GetAutofillProfile() in chrome/test/pyautolib/pyauto.py for sample | 4945 // Refer to GetAutofillProfile() in chrome/test/pyautolib/pyauto.py for sample |
4939 // json output. | 4946 // json output. |
4940 void TestingAutomationProvider::GetAutofillProfile( | 4947 void TestingAutomationProvider::GetAutofillProfile( |
4941 Browser* browser, | 4948 Browser* browser, |
4942 DictionaryValue* args, | 4949 DictionaryValue* args, |
(...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7127 *browser_handle = browser_tracker_->Add(browser); | 7134 *browser_handle = browser_tracker_->Add(browser); |
7128 *success = true; | 7135 *success = true; |
7129 } | 7136 } |
7130 } | 7137 } |
7131 } | 7138 } |
7132 | 7139 |
7133 void TestingAutomationProvider::OnRemoveProvider() { | 7140 void TestingAutomationProvider::OnRemoveProvider() { |
7134 if (g_browser_process) | 7141 if (g_browser_process) |
7135 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 7142 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
7136 } | 7143 } |
OLD | NEW |