Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 2219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2230 handler_map["GetAppModalDialogMessage"] = | 2230 handler_map["GetAppModalDialogMessage"] = |
| 2231 &TestingAutomationProvider::GetAppModalDialogMessage; | 2231 &TestingAutomationProvider::GetAppModalDialogMessage; |
| 2232 handler_map["AcceptOrDismissAppModalDialog"] = | 2232 handler_map["AcceptOrDismissAppModalDialog"] = |
| 2233 &TestingAutomationProvider::AcceptOrDismissAppModalDialog; | 2233 &TestingAutomationProvider::AcceptOrDismissAppModalDialog; |
| 2234 handler_map["GetChromeDriverAutomationVersion"] = | 2234 handler_map["GetChromeDriverAutomationVersion"] = |
| 2235 &TestingAutomationProvider::GetChromeDriverAutomationVersion; | 2235 &TestingAutomationProvider::GetChromeDriverAutomationVersion; |
| 2236 handler_map["UpdateExtensionsNow"] = | 2236 handler_map["UpdateExtensionsNow"] = |
| 2237 &TestingAutomationProvider::UpdateExtensionsNow; | 2237 &TestingAutomationProvider::UpdateExtensionsNow; |
| 2238 handler_map["CreateNewAutomationProvider"] = | 2238 handler_map["CreateNewAutomationProvider"] = |
| 2239 &TestingAutomationProvider::CreateNewAutomationProvider; | 2239 &TestingAutomationProvider::CreateNewAutomationProvider; |
| 2240 handler_map["GetBrowserInfo"] = | |
| 2241 &TestingAutomationProvider::GetBrowserInfo; | |
| 2240 #if defined(OS_CHROMEOS) | 2242 #if defined(OS_CHROMEOS) |
| 2241 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; | 2243 handler_map["GetLoginInfo"] = &TestingAutomationProvider::GetLoginInfo; |
| 2242 handler_map["ShowCreateAccountUI"] = | 2244 handler_map["ShowCreateAccountUI"] = |
| 2243 &TestingAutomationProvider::ShowCreateAccountUI; | 2245 &TestingAutomationProvider::ShowCreateAccountUI; |
| 2244 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; | 2246 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; |
| 2245 handler_map["Login"] = &TestingAutomationProvider::Login; | 2247 handler_map["Login"] = &TestingAutomationProvider::Login; |
| 2246 | 2248 |
| 2247 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; | 2249 handler_map["LockScreen"] = &TestingAutomationProvider::LockScreen; |
| 2248 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; | 2250 handler_map["UnlockScreen"] = &TestingAutomationProvider::UnlockScreen; |
| 2249 handler_map["SignoutInScreenLocker"] = | 2251 handler_map["SignoutInScreenLocker"] = |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2300 #endif // defined(OS_CHROMEOS) | 2302 #endif // defined(OS_CHROMEOS) |
| 2301 | 2303 |
| 2302 std::map<std::string, BrowserJsonHandler> browser_handler_map; | 2304 std::map<std::string, BrowserJsonHandler> browser_handler_map; |
| 2303 browser_handler_map["DisablePlugin"] = | 2305 browser_handler_map["DisablePlugin"] = |
| 2304 &TestingAutomationProvider::DisablePlugin; | 2306 &TestingAutomationProvider::DisablePlugin; |
| 2305 browser_handler_map["EnablePlugin"] = | 2307 browser_handler_map["EnablePlugin"] = |
| 2306 &TestingAutomationProvider::EnablePlugin; | 2308 &TestingAutomationProvider::EnablePlugin; |
| 2307 browser_handler_map["GetPluginsInfo"] = | 2309 browser_handler_map["GetPluginsInfo"] = |
| 2308 &TestingAutomationProvider::GetPluginsInfo; | 2310 &TestingAutomationProvider::GetPluginsInfo; |
| 2309 | 2311 |
| 2310 browser_handler_map["GetBrowserInfo"] = | |
| 2311 &TestingAutomationProvider::GetBrowserInfo; | |
| 2312 | |
| 2313 browser_handler_map["GetNavigationInfo"] = | 2312 browser_handler_map["GetNavigationInfo"] = |
| 2314 &TestingAutomationProvider::GetNavigationInfo; | 2313 &TestingAutomationProvider::GetNavigationInfo; |
| 2315 | 2314 |
| 2316 browser_handler_map["PerformActionOnInfobar"] = | 2315 browser_handler_map["PerformActionOnInfobar"] = |
| 2317 &TestingAutomationProvider::PerformActionOnInfobar; | 2316 &TestingAutomationProvider::PerformActionOnInfobar; |
| 2318 | 2317 |
| 2319 browser_handler_map["GetHistoryInfo"] = | 2318 browser_handler_map["GetHistoryInfo"] = |
| 2320 &TestingAutomationProvider::GetHistoryInfo; | 2319 &TestingAutomationProvider::GetHistoryInfo; |
| 2321 browser_handler_map["AddHistoryItem"] = | 2320 browser_handler_map["AddHistoryItem"] = |
| 2322 &TestingAutomationProvider::AddHistoryItem; | 2321 &TestingAutomationProvider::AddHistoryItem; |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2672 | 2671 |
| 2673 DISALLOW_COPY_AND_ASSIGN(GetChildProcessHostInfoTask); | 2672 DISALLOW_COPY_AND_ASSIGN(GetChildProcessHostInfoTask); |
| 2674 }; | 2673 }; |
| 2675 | 2674 |
| 2676 } // namespace | 2675 } // namespace |
| 2677 | 2676 |
| 2678 // Sample json input: { "command": "GetBrowserInfo" } | 2677 // Sample json input: { "command": "GetBrowserInfo" } |
| 2679 // Refer to GetBrowserInfo() in chrome/test/pyautolib/pyauto.py for | 2678 // Refer to GetBrowserInfo() in chrome/test/pyautolib/pyauto.py for |
| 2680 // sample json output. | 2679 // sample json output. |
| 2681 void TestingAutomationProvider::GetBrowserInfo( | 2680 void TestingAutomationProvider::GetBrowserInfo( |
| 2682 Browser* browser, | |
| 2683 DictionaryValue* args, | 2681 DictionaryValue* args, |
| 2684 IPC::Message* reply_message) { | 2682 IPC::Message* reply_message) { |
| 2685 base::ThreadRestrictions::ScopedAllowIO allow_io; // needed for PathService | 2683 base::ThreadRestrictions::ScopedAllowIO allow_io; // needed for PathService |
| 2686 DictionaryValue* properties = new DictionaryValue; | 2684 DictionaryValue* properties = new DictionaryValue; |
| 2687 properties->SetString("ChromeVersion", chrome::kChromeVersion); | 2685 properties->SetString("ChromeVersion", chrome::kChromeVersion); |
| 2688 properties->SetString("BrowserProcessExecutableName", | 2686 properties->SetString("BrowserProcessExecutableName", |
| 2689 chrome::kBrowserProcessExecutableName); | 2687 chrome::kBrowserProcessExecutableName); |
| 2690 properties->SetString("HelperProcessExecutableName", | 2688 properties->SetString("HelperProcessExecutableName", |
| 2691 chrome::kHelperProcessExecutableName); | 2689 chrome::kHelperProcessExecutableName); |
| 2692 properties->SetString("BrowserProcessExecutablePath", | 2690 properties->SetString("BrowserProcessExecutablePath", |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 2720 | 2718 |
| 2721 return_value->SetInteger("browser_pid", base::GetCurrentProcId()); | 2719 return_value->SetInteger("browser_pid", base::GetCurrentProcId()); |
| 2722 // Add info about all windows in a list of dictionaries, one dictionary | 2720 // Add info about all windows in a list of dictionaries, one dictionary |
| 2723 // item per window. | 2721 // item per window. |
| 2724 ListValue* windows = new ListValue; | 2722 ListValue* windows = new ListValue; |
| 2725 int windex = 0; | 2723 int windex = 0; |
| 2726 for (BrowserList::const_iterator it = BrowserList::begin(); | 2724 for (BrowserList::const_iterator it = BrowserList::begin(); |
| 2727 it != BrowserList::end(); | 2725 it != BrowserList::end(); |
| 2728 ++it, ++windex) { | 2726 ++it, ++windex) { |
| 2729 DictionaryValue* browser_item = new DictionaryValue; | 2727 DictionaryValue* browser_item = new DictionaryValue; |
| 2730 browser = *it; | 2728 Browser* browser = *it; |
|
dtu
2011/08/25 19:07:45
Huh, I'm surprised the parameter was never used.
Nirnimesh
2011/08/25 19:16:45
Yes. Calls into question my coding skills.
| |
| 2731 browser_item->SetInteger("index", windex); | 2729 browser_item->SetInteger("index", windex); |
| 2732 // Window properties | 2730 // Window properties |
| 2733 gfx::Rect rect = browser->window()->GetRestoredBounds(); | 2731 gfx::Rect rect = browser->window()->GetRestoredBounds(); |
| 2734 browser_item->SetInteger("x", rect.x()); | 2732 browser_item->SetInteger("x", rect.x()); |
| 2735 browser_item->SetInteger("y", rect.y()); | 2733 browser_item->SetInteger("y", rect.y()); |
| 2736 browser_item->SetInteger("width", rect.width()); | 2734 browser_item->SetInteger("width", rect.width()); |
| 2737 browser_item->SetInteger("height", rect.height()); | 2735 browser_item->SetInteger("height", rect.height()); |
| 2738 browser_item->SetBoolean("fullscreen", | 2736 browser_item->SetBoolean("fullscreen", |
| 2739 browser->window()->IsFullscreen()); | 2737 browser->window()->IsFullscreen()); |
| 2740 browser_item->SetInteger("selected_tab", browser->active_index()); | 2738 browser_item->SetInteger("selected_tab", browser->active_index()); |
| (...skipping 3593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6334 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); | 6332 IPC::ParamTraits<std::vector<GURL> >::Write(reply_message_, redirects_gurl); |
| 6335 | 6333 |
| 6336 Send(reply_message_); | 6334 Send(reply_message_); |
| 6337 redirect_query_ = 0; | 6335 redirect_query_ = 0; |
| 6338 reply_message_ = NULL; | 6336 reply_message_ = NULL; |
| 6339 } | 6337 } |
| 6340 | 6338 |
| 6341 void TestingAutomationProvider::OnRemoveProvider() { | 6339 void TestingAutomationProvider::OnRemoveProvider() { |
| 6342 AutomationProviderList::GetInstance()->RemoveProvider(this); | 6340 AutomationProviderList::GetInstance()->RemoveProvider(this); |
| 6343 } | 6341 } |
| OLD | NEW |