| Index: chrome/browser/automation/testing_automation_provider.cc
|
| diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc
|
| index c2aa4ec623e7de3d4c138d2d2dd39ffa00b346a4..89d91becd42a5f9bbe107ae976766c3d7293b090 100644
|
| --- a/chrome/browser/automation/testing_automation_provider.cc
|
| +++ b/chrome/browser/automation/testing_automation_provider.cc
|
| @@ -101,6 +101,7 @@
|
| #include "chrome/browser/ui/omnibox/omnibox_view.h"
|
| #include "chrome/browser/ui/search_engines/keyword_editor_controller.h"
|
| #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h"
|
| +#include "chrome/common/automation_id.h"
|
| #include "chrome/common/automation_messages.h"
|
| #include "chrome/common/chrome_constants.h"
|
| #include "chrome/common/chrome_notification_types.h"
|
| @@ -931,9 +932,9 @@ void TestingAutomationProvider::WebkitMouseClick(DictionaryValue* args,
|
| if (SendErrorIfModalDialogActive(this, reply_message))
|
| return;
|
|
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -967,12 +968,12 @@ void TestingAutomationProvider::WebkitMouseClick(DictionaryValue* args,
|
| mouse_event.type = WebKit::WebInputEvent::MouseDown;
|
| mouse_event.clickCount = 1;
|
|
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
|
|
| mouse_event.type = WebKit::WebInputEvent::MouseUp;
|
| new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
|
| 1);
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
| }
|
|
|
| void TestingAutomationProvider::WebkitMouseMove(
|
| @@ -980,9 +981,9 @@ void TestingAutomationProvider::WebkitMouseMove(
|
| if (SendErrorIfModalDialogActive(this, reply_message))
|
| return;
|
|
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -998,7 +999,7 @@ void TestingAutomationProvider::WebkitMouseMove(
|
| mouse_event.type = WebKit::WebInputEvent::MouseMove;
|
| new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
|
| 1);
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
| }
|
|
|
| void TestingAutomationProvider::WebkitMouseDrag(DictionaryValue* args,
|
| @@ -1006,9 +1007,9 @@ void TestingAutomationProvider::WebkitMouseDrag(DictionaryValue* args,
|
| if (SendErrorIfModalDialogActive(this, reply_message))
|
| return;
|
|
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -1028,29 +1029,27 @@ void TestingAutomationProvider::WebkitMouseDrag(DictionaryValue* args,
|
| // Step 1- Move the mouse to the start position.
|
| mouse_event.x = start_x;
|
| mouse_event.y = start_y;
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
|
|
| // Step 2- Left click mouse down, the mouse button is fixed.
|
| mouse_event.type = WebKit::WebInputEvent::MouseDown;
|
| mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
|
| mouse_event.clickCount = 1;
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
|
|
| // Step 3 - Move the mouse to the end position.
|
| - // TODO(JMikhail): See if we should simulate the by not making such
|
| - // a drastic jump by placing incrmental stops along the way.
|
| mouse_event.type = WebKit::WebInputEvent::MouseMove;
|
| mouse_event.x = end_x;
|
| mouse_event.y = end_y;
|
| mouse_event.clickCount = 0;
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
|
|
| // Step 4 - Release the left mouse button.
|
| mouse_event.type = WebKit::WebInputEvent::MouseUp;
|
| mouse_event.clickCount = 1;
|
| new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
|
| 1);
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
| }
|
|
|
| void TestingAutomationProvider::WebkitMouseButtonDown(
|
| @@ -1058,9 +1057,9 @@ void TestingAutomationProvider::WebkitMouseButtonDown(
|
| if (SendErrorIfModalDialogActive(this, reply_message))
|
| return;
|
|
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -1078,7 +1077,7 @@ void TestingAutomationProvider::WebkitMouseButtonDown(
|
| mouse_event.clickCount = 1;
|
| new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
|
| 1);
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
| }
|
|
|
| void TestingAutomationProvider::WebkitMouseButtonUp(
|
| @@ -1086,9 +1085,9 @@ void TestingAutomationProvider::WebkitMouseButtonUp(
|
| if (SendErrorIfModalDialogActive(this, reply_message))
|
| return;
|
|
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -1106,7 +1105,7 @@ void TestingAutomationProvider::WebkitMouseButtonUp(
|
| mouse_event.clickCount = 1;
|
| new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
|
| 1);
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
| }
|
|
|
| void TestingAutomationProvider::WebkitMouseDoubleClick(
|
| @@ -1114,9 +1113,9 @@ void TestingAutomationProvider::WebkitMouseDoubleClick(
|
| if (SendErrorIfModalDialogActive(this, reply_message))
|
| return;
|
|
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -1132,19 +1131,19 @@ void TestingAutomationProvider::WebkitMouseDoubleClick(
|
| mouse_event.type = WebKit::WebInputEvent::MouseDown;
|
| mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
|
| mouse_event.clickCount = 1;
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
|
|
| mouse_event.type = WebKit::WebInputEvent::MouseUp;
|
| new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
|
| 2);
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
|
|
| mouse_event.type = WebKit::WebInputEvent::MouseDown;
|
| mouse_event.clickCount = 2;
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
|
|
| mouse_event.type = WebKit::WebInputEvent::MouseUp;
|
| - tab_contents->render_view_host()->ForwardMouseEvent(mouse_event);
|
| + view->ForwardMouseEvent(mouse_event);
|
| }
|
|
|
| void TestingAutomationProvider::DragAndDropFilePaths(
|
| @@ -1152,9 +1151,9 @@ void TestingAutomationProvider::DragAndDropFilePaths(
|
| if (SendErrorIfModalDialogActive(this, reply_message))
|
| return;
|
|
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -1196,12 +1195,11 @@ void TestingAutomationProvider::DragAndDropFilePaths(
|
| operations |= WebKit::WebDragOperationLink;
|
| operations |= WebKit::WebDragOperationMove;
|
|
|
| - RenderViewHost* host = tab_contents->render_view_host();
|
| - host->DragTargetDragEnter(
|
| + view->DragTargetDragEnter(
|
| drop_data, client, screen,
|
| static_cast<WebKit::WebDragOperationsMask>(operations));
|
| new DragTargetDropAckNotificationObserver(this, reply_message);
|
| - host->DragTargetDrop(client, screen);
|
| + view->DragTargetDrop(client, screen);
|
| }
|
|
|
| void TestingAutomationProvider::GetTabCount(int handle, int* tab_count) {
|
| @@ -2262,10 +2260,6 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
|
| &TestingAutomationProvider::GoBack;
|
| handler_map["Reload"] =
|
| &TestingAutomationProvider::ReloadJSON;
|
| - handler_map["GetTabURL"] =
|
| - &TestingAutomationProvider::GetTabURLJSON;
|
| - handler_map["GetTabTitle"] =
|
| - &TestingAutomationProvider::GetTabTitleJSON;
|
| handler_map["CaptureEntirePage"] =
|
| &TestingAutomationProvider::CaptureEntirePageJSON;
|
| handler_map["GetCookies"] =
|
| @@ -2276,8 +2270,12 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
|
| &TestingAutomationProvider::SetCookieJSON;
|
| handler_map["GetTabIds"] =
|
| &TestingAutomationProvider::GetTabIds;
|
| + handler_map["GetViews"] =
|
| + &TestingAutomationProvider::GetViews;
|
| handler_map["IsTabIdValid"] =
|
| &TestingAutomationProvider::IsTabIdValid;
|
| + handler_map["DoesAutomationObjectExist"] =
|
| + &TestingAutomationProvider::DoesAutomationObjectExist;
|
| handler_map["CloseTab"] =
|
| &TestingAutomationProvider::CloseTabJSON;
|
| handler_map["WebkitMouseMove"] =
|
| @@ -2326,6 +2324,10 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
|
| &TestingAutomationProvider::InstallExtension;
|
| handler_map["GetExtensionsInfo"] =
|
| &TestingAutomationProvider::GetExtensionsInfo;
|
| + handler_map["UninstallExtensionById"] =
|
| + &TestingAutomationProvider::UninstallExtensionById;
|
| + handler_map["SetExtensionStateById"] =
|
| + &TestingAutomationProvider::SetExtensionStateById;
|
| handler_map["RefreshPolicies"] =
|
| &TestingAutomationProvider::RefreshPolicies;
|
| handler_map["TriggerPageActionById"] =
|
| @@ -2474,11 +2476,6 @@ void TestingAutomationProvider::SendJSONRequest(int handle,
|
| browser_handler_map["GetThemeInfo"] =
|
| &TestingAutomationProvider::GetThemeInfo;
|
|
|
| - browser_handler_map["UninstallExtensionById"] =
|
| - &TestingAutomationProvider::UninstallExtensionById;
|
| - browser_handler_map["SetExtensionStateById"] =
|
| - &TestingAutomationProvider::SetExtensionStateById;
|
| -
|
| browser_handler_map["FindInPage"] = &TestingAutomationProvider::FindInPage;
|
|
|
| browser_handler_map["SelectTranslateOption"] =
|
| @@ -4409,10 +4406,12 @@ void TestingAutomationProvider::GetExtensionsInfo(
|
| extension_value->Set("effective_host_permissions",
|
| GetHostPermissions(extension, true));
|
| extension_value->Set("api_permissions", GetAPIPermissions(extension));
|
| + Extension::Location location = extension->location();
|
| extension_value->SetBoolean("is_component",
|
| - extension->location() == Extension::COMPONENT);
|
| - extension_value->SetBoolean("is_internal",
|
| - extension->location() == Extension::INTERNAL);
|
| + location == Extension::COMPONENT);
|
| + extension_value->SetBoolean("is_internal", location == Extension::INTERNAL);
|
| + extension_value->SetBoolean("is_user_installed",
|
| + location == Extension::INTERNAL || location == Extension::LOAD);
|
| extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id));
|
| extension_value->SetBoolean("allowed_in_incognito",
|
| service->IsIncognitoEnabled(id));
|
| @@ -4426,7 +4425,6 @@ void TestingAutomationProvider::GetExtensionsInfo(
|
| // json input.
|
| // Sample json output: {}
|
| void TestingAutomationProvider::UninstallExtensionById(
|
| - Browser* browser,
|
| DictionaryValue* args,
|
| IPC::Message* reply_message) {
|
| std::string id;
|
| @@ -4460,37 +4458,41 @@ void TestingAutomationProvider::UninstallExtensionById(
|
| // See SetExtensionStateById() in chrome/test/pyautolib/pyauto.py
|
| // for sample json input.
|
| void TestingAutomationProvider::SetExtensionStateById(
|
| - Browser* browser,
|
| DictionaryValue* args,
|
| IPC::Message* reply_message) {
|
| - AutomationJSONReply reply(this, reply_message);
|
| std::string id;
|
| if (!args->GetString("id", &id)) {
|
| - reply.SendError("Missing or invalid key: id");
|
| + AutomationJSONReply(this, reply_message)
|
| + .SendError("Missing or invalid key: id");
|
| return;
|
| }
|
|
|
| bool enable;
|
| if (!args->GetBoolean("enable", &enable)) {
|
| - reply.SendError("Missing or invalid key: enable");
|
| + AutomationJSONReply(this, reply_message)
|
| + .SendError("Missing or invalid key: enable");
|
| return;
|
| }
|
|
|
| bool allow_in_incognito;
|
| if (!args->GetBoolean("allow_in_incognito", &allow_in_incognito)) {
|
| - reply.SendError("Missing or invalid key: allow_in_incognito");
|
| + AutomationJSONReply(this, reply_message)
|
| + .SendError("Missing or invalid key: allow_in_incognito");
|
| return;
|
| }
|
|
|
| if (allow_in_incognito && !enable) {
|
| - reply.SendError("Invalid state: Disabled extension "
|
| + AutomationJSONReply(this, reply_message)
|
| + .SendError("Invalid state: Disabled extension "
|
| "cannot be allowed in incognito mode.");
|
| return;
|
| }
|
|
|
| ExtensionService* service = profile()->GetExtensionService();
|
| + ExtensionProcessManager* manager = profile()->GetExtensionProcessManager();
|
| if (!service) {
|
| - reply.SendError("No extensions service.");
|
| + AutomationJSONReply(this, reply_message)
|
| + .SendError("No extensions service or process manager.");
|
| return;
|
| }
|
|
|
| @@ -4498,18 +4500,28 @@ void TestingAutomationProvider::SetExtensionStateById(
|
| !service->GetTerminatedExtension(id)) {
|
| // The extension ID does not correspond to any extension, whether crashed
|
| // or not.
|
| - reply.SendError(base::StringPrintf("Extension does not exist: %s.",
|
| - id.c_str()));
|
| + AutomationJSONReply(this, reply_message).SendError(
|
| + base::StringPrintf("Extension does not exist: %s.", id.c_str()));
|
| return;
|
| }
|
|
|
| - if (enable)
|
| - service->EnableExtension(id);
|
| - else
|
| - service->DisableExtension(id);
|
| -
|
| service->SetIsIncognitoEnabled(id, allow_in_incognito);
|
| - reply.SendSuccess(NULL);
|
| +
|
| + if (enable) {
|
| + if (!service->IsExtensionEnabled(id)) {
|
| + new ExtensionReadyNotificationObserver(
|
| + manager,
|
| + service,
|
| + this,
|
| + reply_message);
|
| + service->EnableExtension(id);
|
| + } else {
|
| + AutomationJSONReply(this, reply_message).SendSuccess(NULL);
|
| + }
|
| + } else {
|
| + service->DisableExtension(id);
|
| + AutomationJSONReply(this, reply_message).SendSuccess(NULL);
|
| + }
|
| }
|
|
|
| // See TriggerPageActionById() in chrome/test/pyautolib/pyauto.py
|
| @@ -5631,13 +5643,13 @@ void TestingAutomationProvider::SendWebkitKeyEvent(
|
| return;
|
| }
|
|
|
| - TabContents* tab_contents;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + RenderViewHost* view;
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| new InputEventAckNotificationObserver(this, reply_message, event.type, 1);
|
| - tab_contents->render_view_host()->ForwardKeyboardEvent(event);
|
| + view->ForwardKeyboardEvent(event);
|
| }
|
|
|
| void TestingAutomationProvider::SendOSLevelKeyEventToTab(
|
| @@ -6063,8 +6075,8 @@ void TestingAutomationProvider::ExecuteJavascriptJSON(
|
|
|
| string16 frame_xpath, javascript;
|
| std::string error;
|
| - TabContents* tab_contents;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| + RenderViewHost* render_view;
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &render_view, &error)) {
|
| AutomationJSONReply(this, reply_message).SendError(error);
|
| return;
|
| }
|
| @@ -6081,7 +6093,7 @@ void TestingAutomationProvider::ExecuteJavascriptJSON(
|
|
|
| new DomOperationMessageSender(this, reply_message, true);
|
| ExecuteJavascriptInRenderViewFrame(frame_xpath, javascript, reply_message,
|
| - tab_contents->render_view_host());
|
| + render_view);
|
| }
|
|
|
| void TestingAutomationProvider::ExecuteJavascriptInRenderView(
|
| @@ -6190,36 +6202,6 @@ void TestingAutomationProvider::ReloadJSON(
|
| controller.Reload(false);
|
| }
|
|
|
| -void TestingAutomationProvider::GetTabURLJSON(
|
| - DictionaryValue* args,
|
| - IPC::Message* reply_message) {
|
| - AutomationJSONReply reply(this, reply_message);
|
| - TabContents* tab_contents;
|
| - std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| - reply.SendError(error);
|
| - return;
|
| - }
|
| - DictionaryValue dict;
|
| - dict.SetString("url", tab_contents->GetURL().possibly_invalid_spec());
|
| - reply.SendSuccess(&dict);
|
| -}
|
| -
|
| -void TestingAutomationProvider::GetTabTitleJSON(
|
| - DictionaryValue* args,
|
| - IPC::Message* reply_message) {
|
| - AutomationJSONReply reply(this, reply_message);
|
| - TabContents* tab_contents;
|
| - std::string error;
|
| - if (!GetTabFromJSONArgs(args, &tab_contents, &error)) {
|
| - reply.SendError(error);
|
| - return;
|
| - }
|
| - DictionaryValue dict;
|
| - dict.SetString("title", tab_contents->GetTitle());
|
| - reply.SendSuccess(&dict);
|
| -}
|
| -
|
| void TestingAutomationProvider::CaptureEntirePageJSON(
|
| DictionaryValue* args,
|
| IPC::Message* reply_message) {
|
| @@ -6287,6 +6269,41 @@ void TestingAutomationProvider::GetTabIds(
|
| AutomationJSONReply(this, reply_message).SendSuccess(&dict);
|
| }
|
|
|
| +void TestingAutomationProvider::GetViews(
|
| + DictionaryValue* args, IPC::Message* reply_message) {
|
| + ListValue* view_list = new ListValue();
|
| + BrowserList::const_iterator browser_iter = BrowserList::begin();
|
| + for (; browser_iter != BrowserList::end(); ++browser_iter) {
|
| + Browser* browser = *browser_iter;
|
| + for (int i = 0; i < browser->tab_count(); ++i) {
|
| + DictionaryValue* dict = new DictionaryValue();
|
| + AutomationId id = automation_util::GetIdForTab(
|
| + browser->GetTabContentsWrapperAt(i));
|
| + dict->Set("auto_id", id.ToValue());
|
| + view_list->Append(dict);
|
| + }
|
| + }
|
| +
|
| + ExtensionProcessManager* extension_mgr =
|
| + profile()->GetExtensionProcessManager();
|
| + ExtensionProcessManager::const_iterator iter;
|
| + for (iter = extension_mgr->begin(); iter != extension_mgr->end();
|
| + ++iter) {
|
| + ExtensionHost* host = *iter;
|
| + DictionaryValue* dict = new DictionaryValue();
|
| + AutomationId id = automation_util::GetIdForExtensionView(host);
|
| + if (!id.is_valid())
|
| + continue;
|
| + dict->Set("auto_id", id.ToValue());
|
| + dict->Set("extension_id", automation_util::GetIdForExtension(
|
| + host->extension()).ToValue());
|
| + view_list->Append(dict);
|
| + }
|
| + DictionaryValue dict;
|
| + dict.Set("views", view_list);
|
| + AutomationJSONReply(this, reply_message).SendSuccess(&dict);
|
| +}
|
| +
|
| void TestingAutomationProvider::IsTabIdValid(
|
| DictionaryValue* args, IPC::Message* reply_message) {
|
| AutomationJSONReply reply(this, reply_message);
|
| @@ -6312,17 +6329,32 @@ void TestingAutomationProvider::IsTabIdValid(
|
| reply.SendSuccess(&dict);
|
| }
|
|
|
| +void TestingAutomationProvider::DoesAutomationObjectExist(
|
| + DictionaryValue* args, IPC::Message* reply_message) {
|
| + AutomationJSONReply reply(this, reply_message);
|
| + AutomationId id;
|
| + std::string error_msg;
|
| + if (!GetAutomationIdFromJSONArgs(args, "auto_id", &id, &error_msg)) {
|
| + reply.SendError(error_msg);
|
| + return;
|
| + }
|
| + DictionaryValue dict;
|
| + dict.SetBoolean(
|
| + "does_exist",
|
| + automation_util::DoesObjectWithIdExist(id, profile()));
|
| + reply.SendSuccess(&dict);
|
| +}
|
| +
|
| void TestingAutomationProvider::CloseTabJSON(
|
| DictionaryValue* args, IPC::Message* reply_message) {
|
| AutomationJSONReply reply(this, reply_message);
|
| - Browser* browser;
|
| - TabContents* tab_contents;
|
| + RenderViewHost* view;
|
| std::string error;
|
| - if (!GetBrowserAndTabFromJSONArgs(args, &browser, &tab_contents, &error)) {
|
| + if (!GetRenderViewFromJSONArgs(args, profile(), &view, &error)) {
|
| reply.SendError(error);
|
| return;
|
| }
|
| - browser->CloseTabContents(tab_contents);
|
| + view->ClosePage();
|
| reply.SendSuccess(NULL);
|
| }
|
|
|
|
|