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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
144 } | 144 } |
145 | 145 |
146 virtual std::string GetHTMLContents() { return contents_; } | 146 virtual std::string GetHTMLContents() { return contents_; } |
147 | 147 |
148 private: | 148 private: |
149 const std::string contents_; | 149 const std::string contents_; |
150 | 150 |
151 DISALLOW_COPY_AND_ASSIGN(AutomationInterstitialPage); | 151 DISALLOW_COPY_AND_ASSIGN(AutomationInterstitialPage); |
152 }; | 152 }; |
153 | 153 |
154 Browser* GetBrowserAt(int index) { | |
155 if (index < 0) | |
156 return NULL; | |
157 BrowserList::const_iterator iter = BrowserList::begin(); | |
158 for (; (iter != BrowserList::end()) && (index > 0); ++iter, --index) {} | |
159 if (iter == BrowserList::end()) | |
160 return NULL; | |
161 return *iter; | |
162 } | |
163 | |
164 TabContents* GetTabContentsAt(int browser_index, int tab_index) { | |
165 if (tab_index < 0) | |
166 return NULL; | |
167 Browser* browser = GetBrowserAt(browser_index); | |
168 if (!browser || tab_index >= browser->tab_count()) | |
169 return NULL; | |
170 return browser->GetTabContentsAt(tab_index); | |
171 } | |
172 | |
173 } // namespace | 154 } // namespace |
174 | 155 |
175 TestingAutomationProvider::TestingAutomationProvider(Profile* profile) | 156 TestingAutomationProvider::TestingAutomationProvider(Profile* profile) |
176 : AutomationProvider(profile), | 157 : AutomationProvider(profile), |
177 #if defined(TOOLKIT_VIEWS) | 158 #if defined(TOOLKIT_VIEWS) |
178 popup_menu_waiter_(NULL), | 159 popup_menu_waiter_(NULL), |
179 #endif | 160 #endif |
180 redirect_query_(0) { | 161 redirect_query_(0) { |
181 BrowserList::AddObserver(this); | 162 BrowserList::AddObserver(this); |
182 registrar_.Add(this, NotificationType::SESSION_END, | 163 registrar_.Add(this, NotificationType::SESSION_END, |
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
768 *window_count = static_cast<int>(BrowserList::size()); | 749 *window_count = static_cast<int>(BrowserList::size()); |
769 } | 750 } |
770 | 751 |
771 void TestingAutomationProvider::GetNormalBrowserWindowCount(int* window_count) { | 752 void TestingAutomationProvider::GetNormalBrowserWindowCount(int* window_count) { |
772 *window_count = static_cast<int>( | 753 *window_count = static_cast<int>( |
773 BrowserList::GetBrowserCountForType(profile_, Browser::TYPE_NORMAL)); | 754 BrowserList::GetBrowserCountForType(profile_, Browser::TYPE_NORMAL)); |
774 } | 755 } |
775 | 756 |
776 void TestingAutomationProvider::GetBrowserWindow(int index, int* handle) { | 757 void TestingAutomationProvider::GetBrowserWindow(int index, int* handle) { |
777 *handle = 0; | 758 *handle = 0; |
778 Browser* browser = GetBrowserAt(index); | 759 if (index < 0) |
779 if (browser) | 760 return; |
780 *handle = browser_tracker_->Add(browser); | 761 BrowserList::const_iterator iter = BrowserList::begin(); |
Paweł Hajdan Jr.
2011/03/07 21:03:39
Hmm, now this seems duplicated even across files i
kkania
2011/03/07 21:57:51
Sure. I realized that this code could be simplifie
Paweł Hajdan Jr.
2011/03/08 07:29:08
I'd prefer 3), but if we can't get that into Brows
| |
762 for (; (iter != BrowserList::end()) && (index > 0); ++iter, --index) {} | |
763 if (iter != BrowserList::end()) | |
764 *handle = browser_tracker_->Add(*iter); | |
781 } | 765 } |
782 | 766 |
783 void TestingAutomationProvider::FindNormalBrowserWindow(int* handle) { | 767 void TestingAutomationProvider::FindNormalBrowserWindow(int* handle) { |
784 *handle = 0; | 768 *handle = 0; |
785 Browser* browser = BrowserList::FindBrowserWithType(profile_, | 769 Browser* browser = BrowserList::FindBrowserWithType(profile_, |
786 Browser::TYPE_NORMAL, | 770 Browser::TYPE_NORMAL, |
787 false); | 771 false); |
788 if (browser) | 772 if (browser) |
789 *handle = browser_tracker_->Add(browser); | 773 *handle = browser_tracker_->Add(browser); |
790 } | 774 } |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
906 ((flags & ui::EF_CONTROL_DOWN) == | 890 ((flags & ui::EF_CONTROL_DOWN) == |
907 ui::EF_CONTROL_DOWN), | 891 ui::EF_CONTROL_DOWN), |
908 ((flags & ui::EF_SHIFT_DOWN) == | 892 ((flags & ui::EF_SHIFT_DOWN) == |
909 ui::EF_SHIFT_DOWN), | 893 ui::EF_SHIFT_DOWN), |
910 ((flags & ui::EF_ALT_DOWN) == | 894 ((flags & ui::EF_ALT_DOWN) == |
911 ui::EF_ALT_DOWN), | 895 ui::EF_ALT_DOWN), |
912 ((flags & ui::EF_COMMAND_DOWN) == | 896 ((flags & ui::EF_COMMAND_DOWN) == |
913 ui::EF_COMMAND_DOWN)); | 897 ui::EF_COMMAND_DOWN)); |
914 } | 898 } |
915 | 899 |
916 void TestingAutomationProvider::WebkitMouseClick(Browser* browser, | 900 void TestingAutomationProvider::WebkitMouseClick(DictionaryValue* args, |
917 DictionaryValue* args, | |
918 IPC::Message* reply_message) { | 901 IPC::Message* reply_message) { |
902 TabContents* tab_contents; | |
903 std::string error; | |
904 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
905 AutomationJSONReply(this, reply_message).SendError(error); | |
906 return; | |
907 } | |
908 | |
919 WebKit::WebMouseEvent mouse_event; | 909 WebKit::WebMouseEvent mouse_event; |
920 | |
921 if (!args->GetInteger("x", &mouse_event.x) || | 910 if (!args->GetInteger("x", &mouse_event.x) || |
922 !args->GetInteger("y", &mouse_event.y)) { | 911 !args->GetInteger("y", &mouse_event.y)) { |
923 AutomationJSONReply(this, reply_message) | 912 AutomationJSONReply(this, reply_message) |
924 .SendError("(X,Y) coordinates missing or invalid"); | 913 .SendError("(X,Y) coordinates missing or invalid"); |
925 return; | 914 return; |
926 } | 915 } |
927 | 916 |
928 int button_flags; | 917 int button; |
929 if (!args->GetInteger("button_flags", &button_flags)) { | 918 if (!args->GetInteger("button", &button)) { |
930 AutomationJSONReply(this, reply_message) | 919 AutomationJSONReply(this, reply_message) |
931 .SendError("Mouse button missing or invalid"); | 920 .SendError("Mouse button missing or invalid"); |
932 return; | 921 return; |
933 } | 922 } |
934 | 923 if (button == automation::kLeftButton) { |
935 if (button_flags == ui::EF_LEFT_BUTTON_DOWN) { | |
936 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 924 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; |
937 } else if (button_flags == ui::EF_RIGHT_BUTTON_DOWN) { | 925 } else if (button == automation::kRightButton) { |
938 mouse_event.button = WebKit::WebMouseEvent::ButtonRight; | 926 mouse_event.button = WebKit::WebMouseEvent::ButtonRight; |
939 } else if (button_flags == ui::EF_MIDDLE_BUTTON_DOWN) { | 927 } else if (button == automation::kMiddleButton) { |
940 mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle; | 928 mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle; |
941 } else { | 929 } else { |
942 AutomationJSONReply(this, reply_message) | 930 AutomationJSONReply(this, reply_message) |
943 .SendError("Invalid button press requested"); | 931 .SendError("Invalid button press requested"); |
944 return; | 932 return; |
945 } | 933 } |
946 | 934 |
947 TabContents* tab_contents = browser->GetSelectedTabContents(); | |
948 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 935 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
949 mouse_event.clickCount = 1; | 936 mouse_event.clickCount = 1; |
950 | 937 |
951 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); | 938 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); |
952 | 939 |
953 mouse_event.type = WebKit::WebInputEvent::MouseUp; | 940 mouse_event.type = WebKit::WebInputEvent::MouseUp; |
954 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type); | 941 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type); |
955 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); | 942 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); |
956 } | 943 } |
957 | 944 |
958 void TestingAutomationProvider::WebkitMouseMove(Browser* browser, | 945 void TestingAutomationProvider::WebkitMouseMove( |
959 DictionaryValue* args, | 946 DictionaryValue* args, IPC::Message* reply_message) { |
960 IPC::Message* reply_message) { | 947 TabContents* tab_contents; |
948 std::string error; | |
949 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
950 AutomationJSONReply(this, reply_message).SendError(error); | |
951 return; | |
952 } | |
953 | |
961 WebKit::WebMouseEvent mouse_event; | 954 WebKit::WebMouseEvent mouse_event; |
962 | |
963 if (!args->GetInteger("x", &mouse_event.x) || | 955 if (!args->GetInteger("x", &mouse_event.x) || |
964 !args->GetInteger("y", &mouse_event.y)) { | 956 !args->GetInteger("y", &mouse_event.y)) { |
965 AutomationJSONReply(this, reply_message) | 957 AutomationJSONReply(this, reply_message) |
966 .SendError("(X,Y) coordinates missing or invalid"); | 958 .SendError("(X,Y) coordinates missing or invalid"); |
967 return; | 959 return; |
968 } | 960 } |
969 | 961 |
970 TabContents* tab_contents = browser->GetSelectedTabContents(); | |
971 mouse_event.type = WebKit::WebInputEvent::MouseMove; | 962 mouse_event.type = WebKit::WebInputEvent::MouseMove; |
972 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type); | 963 new InputEventAckNotificationObserver(this, reply_message, mouse_event.type); |
973 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); | 964 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); |
974 } | 965 } |
975 | 966 |
976 void TestingAutomationProvider::WebkitMouseDrag(Browser* browser, | 967 void TestingAutomationProvider::WebkitMouseDrag(DictionaryValue* args, |
977 DictionaryValue* args, | |
978 IPC::Message* reply_message) { | 968 IPC::Message* reply_message) { |
969 TabContents* tab_contents; | |
970 std::string error; | |
971 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
972 AutomationJSONReply(this, reply_message).SendError(error); | |
973 return; | |
974 } | |
975 | |
979 WebKit::WebMouseEvent mouse_event; | 976 WebKit::WebMouseEvent mouse_event; |
980 int start_x, start_y, end_x, end_y; | 977 int start_x, start_y, end_x, end_y; |
981 | |
982 if (!args->GetInteger("start_x", &start_x) || | 978 if (!args->GetInteger("start_x", &start_x) || |
983 !args->GetInteger("start_y", &start_y) || | 979 !args->GetInteger("start_y", &start_y) || |
984 !args->GetInteger("end_x", &end_x) || | 980 !args->GetInteger("end_x", &end_x) || |
985 !args->GetInteger("end_y", &end_y)) { | 981 !args->GetInteger("end_y", &end_y)) { |
986 AutomationJSONReply(this, reply_message) | 982 AutomationJSONReply(this, reply_message) |
987 .SendError("Invalid start/end positions"); | 983 .SendError("Invalid start/end positions"); |
988 return; | 984 return; |
989 } | 985 } |
990 | 986 |
991 mouse_event.type = WebKit::WebInputEvent::MouseMove; | 987 mouse_event.type = WebKit::WebInputEvent::MouseMove; |
992 TabContents* tab_contents = browser->GetSelectedTabContents(); | |
993 // Step 1- Move the mouse to the start position. | 988 // Step 1- Move the mouse to the start position. |
994 mouse_event.x = start_x; | 989 mouse_event.x = start_x; |
995 mouse_event.y = start_y; | 990 mouse_event.y = start_y; |
996 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); | 991 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); |
997 | 992 |
998 // Step 2- Left click mouse down, the mouse button is fixed. | 993 // Step 2- Left click mouse down, the mouse button is fixed. |
999 mouse_event.type = WebKit::WebInputEvent::MouseDown; | 994 mouse_event.type = WebKit::WebInputEvent::MouseDown; |
1000 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; | 995 mouse_event.button = WebKit::WebMouseEvent::ButtonLeft; |
1001 mouse_event.clickCount = 1; | 996 mouse_event.clickCount = 1; |
1002 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); | 997 tab_contents->render_view_host()->ForwardMouseEvent(mouse_event); |
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2111 } | 2106 } |
2112 | 2107 |
2113 // Map json commands to their handlers. | 2108 // Map json commands to their handlers. |
2114 std::map<std::string, JsonHandler> handler_map; | 2109 std::map<std::string, JsonHandler> handler_map; |
2115 handler_map["WaitForAllTabsToStopLoading"] = | 2110 handler_map["WaitForAllTabsToStopLoading"] = |
2116 &TestingAutomationProvider::WaitForAllTabsToStopLoading; | 2111 &TestingAutomationProvider::WaitForAllTabsToStopLoading; |
2117 handler_map["GetIndicesFromTab"] = | 2112 handler_map["GetIndicesFromTab"] = |
2118 &TestingAutomationProvider::GetIndicesFromTab; | 2113 &TestingAutomationProvider::GetIndicesFromTab; |
2119 handler_map["NavigateToURL"] = | 2114 handler_map["NavigateToURL"] = |
2120 &TestingAutomationProvider::NavigateToURL; | 2115 &TestingAutomationProvider::NavigateToURL; |
2116 handler_map["ExecuteJavascript"] = | |
2117 &TestingAutomationProvider::ExecuteJavascriptJSON; | |
2118 handler_map["GoForward"] = | |
2119 &TestingAutomationProvider::GoForward; | |
2120 handler_map["GoBack"] = | |
2121 &TestingAutomationProvider::GoBack; | |
2122 handler_map["Reload"] = | |
2123 &TestingAutomationProvider::ReloadJSON; | |
2124 handler_map["GetTabURL"] = | |
2125 &TestingAutomationProvider::GetTabURLJSON; | |
2126 handler_map["GetTabTitle"] = | |
2127 &TestingAutomationProvider::GetTabTitleJSON; | |
2128 handler_map["GetCookies"] = | |
2129 &TestingAutomationProvider::GetCookiesJSON; | |
2130 handler_map["DeleteCookie"] = | |
2131 &TestingAutomationProvider::DeleteCookieJSON; | |
2132 handler_map["SetCookie"] = | |
2133 &TestingAutomationProvider::SetCookieJSON; | |
2134 handler_map["GetTabIds"] = | |
2135 &TestingAutomationProvider::GetTabIds; | |
2136 handler_map["IsTabIdValid"] = | |
2137 &TestingAutomationProvider::IsTabIdValid; | |
2138 handler_map["CloseTab"] = | |
2139 &TestingAutomationProvider::CloseTabJSON; | |
2140 handler_map["WebkitMouseMove"] = | |
2141 &TestingAutomationProvider::WebkitMouseMove; | |
2142 handler_map["WebkitMouseClick"] = | |
2143 &TestingAutomationProvider::WebkitMouseClick; | |
2144 handler_map["WebkitMouseDrag"] = | |
2145 &TestingAutomationProvider::WebkitMouseDrag; | |
2146 handler_map["SendWebkitKeyEvent"] = | |
2147 &TestingAutomationProvider::SendWebkitKeyEvent; | |
2148 handler_map["ActivateTab"] = | |
2149 &TestingAutomationProvider::ActivateTabJSON; | |
2121 #if defined(OS_CHROMEOS) | 2150 #if defined(OS_CHROMEOS) |
2122 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; | 2151 handler_map["LoginAsGuest"] = &TestingAutomationProvider::LoginAsGuest; |
2123 handler_map["Login"] = &TestingAutomationProvider::Login; | 2152 handler_map["Login"] = &TestingAutomationProvider::Login; |
2124 handler_map["Logout"] = &TestingAutomationProvider::Logout; | 2153 handler_map["Logout"] = &TestingAutomationProvider::Logout; |
2125 handler_map["ScreenLock"] = &TestingAutomationProvider::ScreenLock; | 2154 handler_map["ScreenLock"] = &TestingAutomationProvider::ScreenLock; |
2126 handler_map["ScreenUnlock"] = &TestingAutomationProvider::ScreenUnlock; | 2155 handler_map["ScreenUnlock"] = &TestingAutomationProvider::ScreenUnlock; |
2127 #endif // defined(OS_CHROMEOS) | 2156 #endif // defined(OS_CHROMEOS) |
2128 | 2157 |
2129 std::map<std::string, BrowserJsonHandler> browser_handler_map; | 2158 std::map<std::string, BrowserJsonHandler> browser_handler_map; |
2130 browser_handler_map["DisablePlugin"] = | 2159 browser_handler_map["DisablePlugin"] = |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2253 browser_handler_map["RemoveNTPMostVisitedThumbnail"] = | 2282 browser_handler_map["RemoveNTPMostVisitedThumbnail"] = |
2254 &TestingAutomationProvider::RemoveNTPMostVisitedThumbnail; | 2283 &TestingAutomationProvider::RemoveNTPMostVisitedThumbnail; |
2255 browser_handler_map["UnpinNTPMostVisitedThumbnail"] = | 2284 browser_handler_map["UnpinNTPMostVisitedThumbnail"] = |
2256 &TestingAutomationProvider::UnpinNTPMostVisitedThumbnail; | 2285 &TestingAutomationProvider::UnpinNTPMostVisitedThumbnail; |
2257 browser_handler_map["RestoreAllNTPMostVisitedThumbnails"] = | 2286 browser_handler_map["RestoreAllNTPMostVisitedThumbnails"] = |
2258 &TestingAutomationProvider::RestoreAllNTPMostVisitedThumbnails; | 2287 &TestingAutomationProvider::RestoreAllNTPMostVisitedThumbnails; |
2259 | 2288 |
2260 browser_handler_map["KillRendererProcess"] = | 2289 browser_handler_map["KillRendererProcess"] = |
2261 &TestingAutomationProvider::KillRendererProcess; | 2290 &TestingAutomationProvider::KillRendererProcess; |
2262 | 2291 |
2263 browser_handler_map["SendKeyEventToActiveTab"] = | |
2264 &TestingAutomationProvider::SendKeyEventToActiveTab; | |
2265 | |
2266 browser_handler_map["GetNTPThumbnailMode"] = | 2292 browser_handler_map["GetNTPThumbnailMode"] = |
2267 &TestingAutomationProvider::GetNTPThumbnailMode; | 2293 &TestingAutomationProvider::GetNTPThumbnailMode; |
2268 browser_handler_map["SetNTPThumbnailMode"] = | 2294 browser_handler_map["SetNTPThumbnailMode"] = |
2269 &TestingAutomationProvider::SetNTPThumbnailMode; | 2295 &TestingAutomationProvider::SetNTPThumbnailMode; |
2270 browser_handler_map["GetNTPMenuMode"] = | 2296 browser_handler_map["GetNTPMenuMode"] = |
2271 &TestingAutomationProvider::GetNTPMenuMode; | 2297 &TestingAutomationProvider::GetNTPMenuMode; |
2272 browser_handler_map["SetNTPMenuMode"] = | 2298 browser_handler_map["SetNTPMenuMode"] = |
2273 &TestingAutomationProvider::SetNTPMenuMode; | 2299 &TestingAutomationProvider::SetNTPMenuMode; |
2274 | 2300 |
2275 browser_handler_map["WebkitMouseMove"] = | |
2276 &TestingAutomationProvider::WebkitMouseMove; | |
2277 browser_handler_map["WebkitMouseClick"] = | |
2278 &TestingAutomationProvider::WebkitMouseClick; | |
2279 browser_handler_map["WebkitMouseDrag"] = | |
2280 &TestingAutomationProvider::WebkitMouseDrag; | |
2281 | |
2282 if (handler_map.find(std::string(command)) != handler_map.end()) { | 2301 if (handler_map.find(std::string(command)) != handler_map.end()) { |
2283 (this->*handler_map[command])(dict_value, reply_message); | 2302 (this->*handler_map[command])(dict_value, reply_message); |
2284 } else if (browser_handler_map.find(std::string(command)) != | 2303 } else if (browser_handler_map.find(std::string(command)) != |
2285 browser_handler_map.end()) { | 2304 browser_handler_map.end()) { |
2286 Browser* browser = NULL; | 2305 Browser* browser = NULL; |
2287 if (!browser_tracker_->ContainsHandle(handle) || | 2306 if (!browser_tracker_->ContainsHandle(handle) || |
2288 !(browser = browser_tracker_->GetResource(handle))) { | 2307 !(browser = browser_tracker_->GetResource(handle))) { |
2289 AutomationJSONReply(this, reply_message).SendError("No browser object."); | 2308 AutomationJSONReply(this, reply_message).SendError("No browser object."); |
2290 return; | 2309 return; |
2291 } | 2310 } |
(...skipping 2268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4560 if (!base::OpenProcessHandle(static_cast<base::ProcessId>(pid), &process)) { | 4579 if (!base::OpenProcessHandle(static_cast<base::ProcessId>(pid), &process)) { |
4561 AutomationJSONReply(this, reply_message).SendError(base::StringPrintf( | 4580 AutomationJSONReply(this, reply_message).SendError(base::StringPrintf( |
4562 "Failed to open process handle for pid %d", pid)); | 4581 "Failed to open process handle for pid %d", pid)); |
4563 return; | 4582 return; |
4564 } | 4583 } |
4565 new RendererProcessClosedObserver(this, reply_message); | 4584 new RendererProcessClosedObserver(this, reply_message); |
4566 base::KillProcess(process, 0, false); | 4585 base::KillProcess(process, 0, false); |
4567 base::CloseProcessHandle(process); | 4586 base::CloseProcessHandle(process); |
4568 } | 4587 } |
4569 | 4588 |
4570 void TestingAutomationProvider::SendKeyEventToActiveTab( | 4589 void TestingAutomationProvider::SendWebkitKeyEvent( |
4571 Browser* browser, | |
4572 DictionaryValue* args, | 4590 DictionaryValue* args, |
4573 IPC::Message* reply_message) { | 4591 IPC::Message* reply_message) { |
4592 TabContents* tab_contents; | |
4593 std::string error; | |
4594 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
4595 AutomationJSONReply(this, reply_message).SendError(error); | |
4596 return; | |
4597 } | |
4598 | |
4574 int type, modifiers; | 4599 int type, modifiers; |
4575 bool is_system_key; | 4600 bool is_system_key; |
4576 string16 unmodified_text, text; | 4601 string16 unmodified_text, text; |
4577 std::string key_identifier; | 4602 std::string key_identifier; |
4578 NativeWebKeyboardEvent event; | 4603 NativeWebKeyboardEvent event; |
4579 if (!args->GetInteger("type", &type)) { | 4604 if (!args->GetInteger("type", &type)) { |
4580 AutomationJSONReply reply(this, reply_message); | 4605 AutomationJSONReply reply(this, reply_message); |
4581 reply.SendError("'type' missing or invalid."); | 4606 reply.SendError("'type' missing or invalid."); |
4582 return; | 4607 return; |
4583 } | 4608 } |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4649 event.modifiers |= WebKit::WebInputEvent::ControlKey; | 4674 event.modifiers |= WebKit::WebInputEvent::ControlKey; |
4650 if (modifiers & automation::kAltKeyMask) | 4675 if (modifiers & automation::kAltKeyMask) |
4651 event.modifiers |= WebKit::WebInputEvent::AltKey; | 4676 event.modifiers |= WebKit::WebInputEvent::AltKey; |
4652 if (modifiers & automation::kMetaKeyMask) | 4677 if (modifiers & automation::kMetaKeyMask) |
4653 event.modifiers |= WebKit::WebInputEvent::MetaKey; | 4678 event.modifiers |= WebKit::WebInputEvent::MetaKey; |
4654 | 4679 |
4655 event.isSystemKey = is_system_key; | 4680 event.isSystemKey = is_system_key; |
4656 event.timeStampSeconds = base::Time::Now().ToDoubleT(); | 4681 event.timeStampSeconds = base::Time::Now().ToDoubleT(); |
4657 event.skip_in_browser = true; | 4682 event.skip_in_browser = true; |
4658 new InputEventAckNotificationObserver(this, reply_message, event.type); | 4683 new InputEventAckNotificationObserver(this, reply_message, event.type); |
4659 browser->GetSelectedTabContents()->render_view_host()-> | 4684 tab_contents->render_view_host()->ForwardKeyboardEvent(event); |
4660 ForwardKeyboardEvent(event); | |
4661 } | 4685 } |
4662 | 4686 |
4663 // Sample JSON input: { "command": "GetNTPThumbnailMode" } | 4687 // Sample JSON input: { "command": "GetNTPThumbnailMode" } |
4664 // For output, refer to GetNTPThumbnailMode() in | 4688 // For output, refer to GetNTPThumbnailMode() in |
4665 // chrome/test/pyautolib/pyauto.py. | 4689 // chrome/test/pyautolib/pyauto.py. |
4666 void TestingAutomationProvider::GetNTPThumbnailMode( | 4690 void TestingAutomationProvider::GetNTPThumbnailMode( |
4667 Browser* browser, | 4691 Browser* browser, |
4668 DictionaryValue* args, | 4692 DictionaryValue* args, |
4669 IPC::Message* reply_message) { | 4693 IPC::Message* reply_message) { |
4670 const int shown_sections = ShownSectionsHandler::GetShownSections( | 4694 const int shown_sections = ShownSectionsHandler::GetShownSections( |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4795 void TestingAutomationProvider::WaitForAllTabsToStopLoading( | 4819 void TestingAutomationProvider::WaitForAllTabsToStopLoading( |
4796 DictionaryValue* args, | 4820 DictionaryValue* args, |
4797 IPC::Message* reply_message) { | 4821 IPC::Message* reply_message) { |
4798 new AllTabsStoppedLoadingObserver(this, reply_message); | 4822 new AllTabsStoppedLoadingObserver(this, reply_message); |
4799 } | 4823 } |
4800 | 4824 |
4801 void TestingAutomationProvider::GetIndicesFromTab( | 4825 void TestingAutomationProvider::GetIndicesFromTab( |
4802 DictionaryValue* args, | 4826 DictionaryValue* args, |
4803 IPC::Message* reply_message) { | 4827 IPC::Message* reply_message) { |
4804 AutomationJSONReply reply(this, reply_message); | 4828 AutomationJSONReply reply(this, reply_message); |
4805 int tab_handle = 0; | 4829 int id_or_handle = 0; |
4806 if (!args->GetInteger("tab_handle", &tab_handle) || | 4830 bool has_id = args->HasKey("tab_id"); |
4807 !tab_tracker_->ContainsHandle(tab_handle)) { | 4831 bool has_handle = args->HasKey("tab_handle"); |
4808 reply.SendError("'tab_handle' missing or invalid"); | 4832 if (has_id && has_handle) { |
4833 reply.SendError( | |
4834 "Both 'tab_id' and 'tab_handle' were specified. Only one is allowed"); | |
4835 return; | |
4836 } else if (!has_id && !has_handle) { | |
4837 reply.SendError("Either 'tab_id' or 'tab_handle' must be specified"); | |
4809 return; | 4838 return; |
4810 } | 4839 } |
4811 NavigationController* controller = tab_tracker_->GetResource(tab_handle); | 4840 if (has_id && !args->GetInteger("tab_id", &id_or_handle)) { |
4841 reply.SendError("'tab_id' is invalid"); | |
4842 return; | |
4843 } | |
4844 if (has_handle && (!args->GetInteger("tab_handle", &id_or_handle) || | |
4845 !tab_tracker_->ContainsHandle(id_or_handle))) { | |
4846 reply.SendError("'tab_handle' is invalid"); | |
4847 return; | |
4848 } | |
4849 int id = id_or_handle; | |
4850 if (has_handle) | |
4851 id = tab_tracker_->GetResource(id_or_handle)->session_id().id(); | |
4812 BrowserList::const_iterator iter = BrowserList::begin(); | 4852 BrowserList::const_iterator iter = BrowserList::begin(); |
4813 int browser_index = 0; | 4853 int browser_index = 0; |
4814 for (; iter != BrowserList::end(); ++iter, ++browser_index) { | 4854 for (; iter != BrowserList::end(); ++iter, ++browser_index) { |
4815 Browser* browser = *iter; | 4855 Browser* browser = *iter; |
4816 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { | 4856 for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { |
4817 if (browser->GetTabContentsAt(tab_index) == controller->tab_contents()) { | 4857 TabContents* tab = browser->GetTabContentsAt(tab_index); |
4858 if (tab->controller().session_id().id() == id) { | |
4818 DictionaryValue dict; | 4859 DictionaryValue dict; |
4819 dict.SetInteger("windex", browser_index); | 4860 dict.SetInteger("windex", browser_index); |
4820 dict.SetInteger("tab_index", tab_index); | 4861 dict.SetInteger("tab_index", tab_index); |
4821 reply.SendSuccess(&dict); | 4862 reply.SendSuccess(&dict); |
4822 return; | 4863 return; |
4823 } | 4864 } |
4824 } | 4865 } |
4825 } | 4866 } |
4826 reply.SendError("Could not find tab among current browser windows"); | 4867 reply.SendError("Could not find tab among current browser windows"); |
4827 } | 4868 } |
4828 | 4869 |
4829 void TestingAutomationProvider::NavigateToURL( | 4870 void TestingAutomationProvider::NavigateToURL( |
4830 DictionaryValue* args, | 4871 DictionaryValue* args, |
4831 IPC::Message* reply_message) { | 4872 IPC::Message* reply_message) { |
4832 int browser_index = 0, tab_index = 0, navigation_count = 0; | 4873 int navigation_count; |
4833 std::string url; | 4874 std::string url, error; |
4834 if (!args->GetInteger("windex", &browser_index)) { | 4875 Browser* browser; |
4835 AutomationJSONReply(this, reply_message) | 4876 TabContents* tab_contents; |
4836 .SendError("'windex' missing or invalid"); | 4877 if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab_contents, &error)) { |
4837 return; | 4878 AutomationJSONReply(this, reply_message).SendError(error); |
4838 } | |
4839 if (!args->GetInteger("tab_index", &tab_index)) { | |
4840 AutomationJSONReply(this, reply_message) | |
4841 .SendError("'tab_index' missing or invalid"); | |
4842 return; | 4879 return; |
4843 } | 4880 } |
4844 if (!args->GetString("url", &url)) { | 4881 if (!args->GetString("url", &url)) { |
4845 AutomationJSONReply(this, reply_message) | 4882 AutomationJSONReply(this, reply_message) |
4846 .SendError("'url' missing or invalid"); | 4883 .SendError("'url' missing or invalid"); |
4847 return; | 4884 return; |
4848 } | 4885 } |
4849 if (!args->GetInteger("navigation_count", &navigation_count)) { | 4886 if (!args->GetInteger("navigation_count", &navigation_count)) { |
4850 AutomationJSONReply(this, reply_message) | 4887 AutomationJSONReply(this, reply_message) |
4851 .SendError("'navigation_count' missing or invalid"); | 4888 .SendError("'navigation_count' missing or invalid"); |
4852 return; | 4889 return; |
4853 } | 4890 } |
4854 Browser* browser = GetBrowserAt(browser_index); | |
4855 TabContents* tab_contents = GetTabContentsAt(browser_index, tab_index); | |
4856 if (!browser || !tab_contents) { | |
4857 AutomationJSONReply(this, reply_message) | |
4858 .SendError("Cannot locate tab or browser to navigate"); | |
4859 return; | |
4860 } | |
4861 new NavigationNotificationObserver( | 4891 new NavigationNotificationObserver( |
4862 &tab_contents->controller(), this, reply_message, | 4892 &tab_contents->controller(), this, reply_message, |
4863 navigation_count, false, true); | 4893 navigation_count, false, true); |
4864 browser->OpenURLFromTab( | 4894 browser->OpenURLFromTab( |
4865 tab_contents, GURL(url), GURL(), CURRENT_TAB, PageTransition::TYPED); | 4895 tab_contents, GURL(url), GURL(), CURRENT_TAB, PageTransition::TYPED); |
4866 } | 4896 } |
4867 | 4897 |
4898 void TestingAutomationProvider::ExecuteJavascriptJSON( | |
4899 DictionaryValue* args, | |
4900 IPC::Message* reply_message) { | |
4901 string16 frame_xpath, javascript; | |
4902 std::string error; | |
4903 TabContents* tab_contents; | |
4904 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
4905 AutomationJSONReply(this, reply_message).SendError(error); | |
4906 return; | |
4907 } | |
4908 if (!args->GetString("frame_xpath", &frame_xpath)) { | |
4909 AutomationJSONReply(this, reply_message) | |
4910 .SendError("'frame_xpath' missing or invalid"); | |
4911 return; | |
4912 } | |
4913 if (!args->GetString("javascript", &javascript)) { | |
4914 AutomationJSONReply(this, reply_message) | |
4915 .SendError("'javascript' missing or invalid"); | |
4916 return; | |
4917 } | |
4918 | |
4919 // Set the routing id of this message with the controller. | |
4920 // This routing id needs to be remembered for the reverse | |
4921 // communication while sending back the response of | |
4922 // this javascript execution. | |
4923 std::string set_automation_id; | |
4924 base::SStringPrintf(&set_automation_id, | |
4925 "window.domAutomationController.setAutomationId(%d);", | |
4926 reply_message->routing_id()); | |
4927 | |
4928 new ExecuteJavascriptObserver(this, reply_message); | |
4929 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | |
4930 frame_xpath, UTF8ToUTF16(set_automation_id)); | |
4931 tab_contents->render_view_host()->ExecuteJavascriptInWebFrame( | |
4932 frame_xpath, javascript); | |
4933 } | |
4934 | |
4935 void TestingAutomationProvider::GoForward( | |
4936 DictionaryValue* args, | |
4937 IPC::Message* reply_message) { | |
4938 TabContents* tab_contents; | |
4939 std::string error; | |
4940 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
4941 AutomationJSONReply(this, reply_message).SendError(error); | |
4942 return; | |
4943 } | |
4944 NavigationController& controller = tab_contents->controller(); | |
4945 if (!controller.CanGoForward()) { | |
4946 DictionaryValue dict; | |
4947 dict.SetBoolean("did_go_forward", false); | |
4948 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | |
4949 return; | |
4950 } | |
4951 new NavigationNotificationObserver(&controller, this, reply_message, | |
4952 1, false, true); | |
4953 controller.GoForward(); | |
4954 } | |
4955 | |
4956 void TestingAutomationProvider::GoBack( | |
4957 DictionaryValue* args, | |
4958 IPC::Message* reply_message) { | |
4959 TabContents* tab_contents; | |
4960 std::string error; | |
4961 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
4962 AutomationJSONReply(this, reply_message).SendError(error); | |
4963 return; | |
4964 } | |
4965 NavigationController& controller = tab_contents->controller(); | |
4966 if (!controller.CanGoBack()) { | |
4967 DictionaryValue dict; | |
4968 dict.SetBoolean("did_go_back", false); | |
4969 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | |
4970 return; | |
4971 } | |
4972 new NavigationNotificationObserver(&controller, this, reply_message, | |
4973 1, false, true); | |
4974 controller.GoBack(); | |
4975 } | |
4976 | |
4977 void TestingAutomationProvider::ReloadJSON( | |
4978 DictionaryValue* args, | |
4979 IPC::Message* reply_message) { | |
4980 TabContents* tab_contents; | |
4981 std::string error; | |
4982 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
4983 AutomationJSONReply(this, reply_message).SendError(error); | |
4984 return; | |
4985 } | |
4986 NavigationController& controller = tab_contents->controller(); | |
4987 new NavigationNotificationObserver(&controller, this, reply_message, | |
4988 1, false, true); | |
4989 controller.Reload(false); | |
4990 } | |
4991 | |
4992 void TestingAutomationProvider::GetTabURLJSON( | |
4993 DictionaryValue* args, | |
4994 IPC::Message* reply_message) { | |
4995 AutomationJSONReply reply(this, reply_message); | |
4996 TabContents* tab_contents; | |
4997 std::string error; | |
4998 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
4999 reply.SendError(error); | |
5000 return; | |
5001 } | |
5002 DictionaryValue dict; | |
5003 dict.SetString("url", tab_contents->GetURL().possibly_invalid_spec()); | |
5004 reply.SendSuccess(&dict); | |
5005 } | |
5006 | |
5007 void TestingAutomationProvider::GetTabTitleJSON( | |
5008 DictionaryValue* args, | |
5009 IPC::Message* reply_message) { | |
5010 AutomationJSONReply reply(this, reply_message); | |
5011 TabContents* tab_contents; | |
5012 std::string error; | |
5013 if (!GetTabFromJSONArgs(args, &tab_contents, &error)) { | |
5014 reply.SendError(error); | |
5015 return; | |
5016 } | |
5017 DictionaryValue dict; | |
5018 dict.SetString("title", tab_contents->GetTitle()); | |
5019 reply.SendSuccess(&dict); | |
5020 } | |
5021 | |
5022 void TestingAutomationProvider::GetCookiesJSON( | |
5023 DictionaryValue* args, IPC::Message* reply_message) { | |
5024 AutomationJSONReply reply(this, reply_message); | |
5025 Browser* browser; | |
5026 std::string error; | |
5027 if (!GetBrowserFromJSONArgs(args, &browser, &error)) { | |
5028 reply.SendError(error); | |
5029 return; | |
5030 } | |
5031 std::string url; | |
5032 if (!args->GetString("url", &url)) { | |
5033 reply.SendError("'url' missing or invalid"); | |
5034 return; | |
5035 } | |
5036 | |
5037 // Since we are running on the UI thread don't call GetURLRequestContext(). | |
5038 scoped_refptr<URLRequestContextGetter> context_getter = | |
5039 browser->profile()->GetRequestContext(); | |
5040 | |
5041 std::string cookies; | |
5042 base::WaitableEvent event(true /* manual reset */, | |
5043 false /* not initially signaled */); | |
5044 Task* task = NewRunnableFunction( | |
5045 &GetCookiesOnIOThread, | |
5046 GURL(url), context_getter, &event, &cookies); | |
5047 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task)) { | |
5048 reply.SendError("Couldn't post task to get the cookies"); | |
5049 return; | |
5050 } | |
5051 event.Wait(); | |
5052 | |
5053 DictionaryValue dict; | |
5054 dict.SetString("cookies", cookies); | |
5055 reply.SendSuccess(&dict); | |
5056 } | |
5057 | |
5058 void TestingAutomationProvider::DeleteCookieJSON( | |
5059 DictionaryValue* args, IPC::Message* reply_message) { | |
5060 AutomationJSONReply reply(this, reply_message); | |
5061 Browser* browser; | |
5062 std::string error; | |
5063 if (!GetBrowserFromJSONArgs(args, &browser, &error)) { | |
5064 reply.SendError(error); | |
5065 return; | |
5066 } | |
5067 std::string url, name; | |
5068 if (!args->GetString("url", &url)) { | |
5069 reply.SendError("'url' missing or invalid"); | |
5070 return; | |
5071 } | |
5072 if (!args->GetString("name", &name)) { | |
5073 reply.SendError("'name' missing or invalid"); | |
5074 return; | |
5075 } | |
5076 | |
5077 // Since we are running on the UI thread don't call GetURLRequestContext(). | |
5078 scoped_refptr<URLRequestContextGetter> context_getter = | |
5079 browser->profile()->GetRequestContext(); | |
5080 | |
5081 base::WaitableEvent event(true /* manual reset */, | |
5082 false /* not initially signaled */); | |
5083 Task* task = NewRunnableFunction( | |
5084 &DeleteCookieOnIOThread, | |
5085 GURL(url), name, context_getter, &event); | |
5086 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task)) { | |
5087 reply.SendError("Couldn't post task to delete the cookie"); | |
Paweł Hajdan Jr.
2011/03/07 21:03:39
That leaks the task it seems (possibly applies to
kkania
2011/03/07 21:57:51
BrowserThread::PostTask takes ownership of the tas
Paweł Hajdan Jr.
2011/03/08 07:29:08
Right, I missed that info.
| |
5088 return; | |
5089 } | |
5090 event.Wait(); | |
5091 reply.SendSuccess(NULL); | |
5092 } | |
5093 | |
5094 void TestingAutomationProvider::SetCookieJSON( | |
5095 DictionaryValue* args, IPC::Message* reply_message) { | |
5096 AutomationJSONReply reply(this, reply_message); | |
5097 Browser* browser; | |
5098 std::string error; | |
5099 if (!GetBrowserFromJSONArgs(args, &browser, &error)) { | |
5100 reply.SendError(error); | |
5101 return; | |
5102 } | |
5103 std::string url, cookie; | |
5104 if (!args->GetString("url", &url)) { | |
5105 reply.SendError("'url' missing or invalid"); | |
5106 return; | |
5107 } | |
5108 if (!args->GetString("cookie", &cookie)) { | |
5109 reply.SendError("'cookie' missing or invalid"); | |
5110 return; | |
5111 } | |
5112 | |
5113 // Since we are running on the UI thread don't call GetURLRequestContext(). | |
5114 scoped_refptr<URLRequestContextGetter> context_getter = | |
5115 browser->profile()->GetRequestContext(); | |
5116 | |
5117 base::WaitableEvent event(true /* manual reset */, | |
5118 false /* not initially signaled */); | |
5119 bool success = false; | |
5120 Task* task = NewRunnableFunction( | |
5121 &SetCookieOnIOThread, | |
5122 GURL(url), cookie, context_getter, &event, &success); | |
5123 if (!BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, task)) { | |
5124 reply.SendError("Couldn't post task to set the cookie"); | |
5125 return; | |
5126 } | |
5127 event.Wait(); | |
5128 | |
5129 if (!success) { | |
5130 reply.SendError("Could not set the cookie"); | |
5131 return; | |
5132 } | |
5133 reply.SendSuccess(NULL); | |
5134 } | |
5135 | |
5136 void TestingAutomationProvider::GetTabIds( | |
5137 DictionaryValue* args, IPC::Message* reply_message) { | |
5138 ListValue* id_list = new ListValue(); | |
5139 BrowserList::const_iterator iter = BrowserList::begin(); | |
5140 for (; iter != BrowserList::end(); ++iter) { | |
5141 Browser* browser = *iter; | |
5142 for (int i = 0; i < browser->tab_count(); ++i) { | |
5143 int id = browser->GetTabContentsAt(i)->controller().session_id().id(); | |
5144 id_list->Append(Value::CreateIntegerValue(id)); | |
5145 } | |
5146 } | |
5147 DictionaryValue dict; | |
5148 dict.Set("ids", id_list); | |
5149 AutomationJSONReply(this, reply_message).SendSuccess(&dict); | |
5150 } | |
5151 | |
5152 void TestingAutomationProvider::IsTabIdValid( | |
5153 DictionaryValue* args, IPC::Message* reply_message) { | |
5154 AutomationJSONReply reply(this, reply_message); | |
5155 int id; | |
5156 if (!args->GetInteger("id", &id)) { | |
5157 reply.SendError("'id' missing or invalid"); | |
5158 return; | |
5159 } | |
5160 bool is_valid = false; | |
5161 BrowserList::const_iterator iter = BrowserList::begin(); | |
5162 for (; iter != BrowserList::end(); ++iter) { | |
5163 Browser* browser = *iter; | |
5164 for (int i = 0; i < browser->tab_count(); ++i) { | |
5165 TabContents* tab = browser->GetTabContentsAt(i); | |
5166 if (tab->controller().session_id().id() == id) { | |
5167 is_valid = true; | |
5168 break; | |
5169 } | |
5170 } | |
5171 } | |
5172 DictionaryValue dict; | |
5173 dict.SetBoolean("is_valid", is_valid); | |
5174 reply.SendSuccess(&dict); | |
5175 } | |
5176 | |
5177 void TestingAutomationProvider::CloseTabJSON( | |
5178 DictionaryValue* args, IPC::Message* reply_message) { | |
5179 AutomationJSONReply reply(this, reply_message); | |
5180 Browser* browser; | |
5181 TabContents* tab_contents; | |
5182 std::string error; | |
5183 if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab_contents, &error)) { | |
5184 reply.SendError(error); | |
5185 return; | |
5186 } | |
5187 browser->CloseTabContents(tab_contents); | |
5188 reply.SendSuccess(NULL); | |
5189 } | |
5190 | |
5191 void TestingAutomationProvider::ActivateTabJSON( | |
5192 DictionaryValue* args, | |
5193 IPC::Message* reply_message) { | |
5194 AutomationJSONReply reply(this, reply_message); | |
5195 Browser* browser; | |
5196 TabContents* tab_contents; | |
5197 std::string error; | |
5198 if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab_contents, &error)) { | |
5199 reply.SendError(error); | |
5200 return; | |
5201 } | |
5202 browser->SelectTabContentsAt( | |
5203 browser->GetIndexOfController(&tab_contents->controller()), true); | |
5204 reply.SendSuccess(NULL); | |
5205 } | |
5206 | |
4868 void TestingAutomationProvider::WaitForTabCountToBecome( | 5207 void TestingAutomationProvider::WaitForTabCountToBecome( |
4869 int browser_handle, | 5208 int browser_handle, |
4870 int target_tab_count, | 5209 int target_tab_count, |
4871 IPC::Message* reply_message) { | 5210 IPC::Message* reply_message) { |
4872 if (!browser_tracker_->ContainsHandle(browser_handle)) { | 5211 if (!browser_tracker_->ContainsHandle(browser_handle)) { |
4873 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, | 5212 AutomationMsg_WaitForTabCountToBecome::WriteReplyParams(reply_message, |
4874 false); | 5213 false); |
4875 Send(reply_message); | 5214 Send(reply_message); |
4876 return; | 5215 return; |
4877 } | 5216 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5023 // If you change this, update Observer for NotificationType::SESSION_END | 5362 // If you change this, update Observer for NotificationType::SESSION_END |
5024 // below. | 5363 // below. |
5025 MessageLoop::current()->PostTask(FROM_HERE, | 5364 MessageLoop::current()->PostTask(FROM_HERE, |
5026 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); | 5365 NewRunnableMethod(this, &TestingAutomationProvider::OnRemoveProvider)); |
5027 } | 5366 } |
5028 } | 5367 } |
5029 | 5368 |
5030 void TestingAutomationProvider::OnRemoveProvider() { | 5369 void TestingAutomationProvider::OnRemoveProvider() { |
5031 AutomationProviderList::GetInstance()->RemoveProvider(this); | 5370 AutomationProviderList::GetInstance()->RemoveProvider(this); |
5032 } | 5371 } |
OLD | NEW |