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 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 StringPrintf(error_msg.c_str(), path.c_str())); | 215 StringPrintf(error_msg.c_str(), path.c_str())); |
216 } | 216 } |
217 } | 217 } |
218 } | 218 } |
219 | 219 |
220 // Helper to resolve the overloading of PostTask. | 220 // Helper to resolve the overloading of PostTask. |
221 void PostTask(BrowserThread::ID id, const base::Closure& callback) { | 221 void PostTask(BrowserThread::ID id, const base::Closure& callback) { |
222 BrowserThread::PostTask(id, FROM_HERE, callback); | 222 BrowserThread::PostTask(id, FROM_HERE, callback); |
223 } | 223 } |
224 | 224 |
225 void SendMouseClick(int flags) { | |
226 ui_controls::MouseButton button = ui_controls::LEFT; | |
227 if ((flags & ui::EF_LEFT_MOUSE_BUTTON) == | |
228 ui::EF_LEFT_MOUSE_BUTTON) { | |
229 button = ui_controls::LEFT; | |
230 } else if ((flags & ui::EF_RIGHT_MOUSE_BUTTON) == | |
231 ui::EF_RIGHT_MOUSE_BUTTON) { | |
232 button = ui_controls::RIGHT; | |
233 } else if ((flags & ui::EF_MIDDLE_MOUSE_BUTTON) == | |
234 ui::EF_MIDDLE_MOUSE_BUTTON) { | |
235 button = ui_controls::MIDDLE; | |
236 } else { | |
237 NOTREACHED(); | |
238 } | |
239 | |
240 ui_controls::SendMouseClick(button); | |
241 } | |
242 | |
243 class AutomationInterstitialPage : public content::InterstitialPageDelegate { | 225 class AutomationInterstitialPage : public content::InterstitialPageDelegate { |
244 public: | 226 public: |
245 AutomationInterstitialPage(WebContents* tab, | 227 AutomationInterstitialPage(WebContents* tab, |
246 const GURL& url, | 228 const GURL& url, |
247 const std::string& contents) | 229 const std::string& contents) |
248 : contents_(contents) { | 230 : contents_(contents) { |
249 interstitial_page_ = InterstitialPage::Create(tab, true, url, this); | 231 interstitial_page_ = InterstitialPage::Create(tab, true, url, this); |
250 interstitial_page_->Show(); | 232 interstitial_page_->Show(); |
251 } | 233 } |
252 | 234 |
(...skipping 6092 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6345 void TestingAutomationProvider::OnRemoveProvider() { | 6327 void TestingAutomationProvider::OnRemoveProvider() { |
6346 if (g_browser_process) | 6328 if (g_browser_process) |
6347 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); | 6329 g_browser_process->GetAutomationProviderList()->RemoveProvider(this); |
6348 } | 6330 } |
6349 | 6331 |
6350 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, | 6332 void TestingAutomationProvider::EnsureTabSelected(Browser* browser, |
6351 WebContents* tab) { | 6333 WebContents* tab) { |
6352 if (chrome::GetActiveWebContents(browser) != tab) | 6334 if (chrome::GetActiveWebContents(browser) != tab) |
6353 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); | 6335 chrome::ActivateTabAt(browser, chrome::GetIndexOfTab(browser, tab), true); |
6354 } | 6336 } |
OLD | NEW |