#include "chrome/browser/extensions/crx_installer.h"
#include "chrome/browser/extensions/extension_action.h"
#include "chrome/browser/extensions/extension_action_manager.h"
-#include "chrome/browser/extensions/extension_host.h"
-#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_tab_util.h"
#include "chrome/browser/extensions/extension_util.h"
+#include "chrome/browser/extensions/launch_util.h"
#include "chrome/browser/extensions/unpacked_installer.h"
#include "chrome/browser/extensions/updater/extension_updater.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/top_sites.h"
#include "chrome/browser/infobars/confirm_infobar_delegate.h"
+#include "chrome/browser/infobars/infobar.h"
#include "chrome/browser/infobars/infobar_service.h"
#include "chrome/browser/lifetime/application_lifetime.h"
#include "chrome/browser/notifications/balloon.h"
#include "chrome/browser/notifications/balloon_collection.h"
-#include "chrome/browser/notifications/balloon_notification_ui_manager.h"
#include "chrome/browser/notifications/notification.h"
-#include "chrome/browser/password_manager/password_store.h"
-#include "chrome/browser/password_manager/password_store_change.h"
#include "chrome/browser/password_manager/password_store_factory.h"
#include "chrome/browser/platform_util.h"
#include "chrome/browser/plugins/plugin_prefs.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/common/extensions/background_info.h"
-#include "chrome/common/extensions/extension.h"
+#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/manifest_url_handler.h"
-#include "chrome/common/extensions/permissions/permissions_data.h"
#include "chrome/common/pref_names.h"
#include "chrome/common/render_messages.h"
+#include "components/password_manager/core/browser/password_store.h"
+#include "components/password_manager/core/browser/password_store_change.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
#include "content/public/browser/child_process_data.h"
#include "content/public/browser/favicon_status.h"
#include "content/public/common/geoposition.h"
#include "content/public/common/ssl_status.h"
#include "content/public/common/webplugininfo.h"
+#include "extensions/browser/extension_host.h"
+#include "extensions/browser/extension_registry.h"
+#include "extensions/browser/extension_system.h"
+#include "extensions/browser/process_manager.h"
#include "extensions/browser/view_type_utils.h"
+#include "extensions/common/extension.h"
+#include "extensions/common/extension_set.h"
+#include "extensions/common/manifest_handlers/background_info.h"
#include "extensions/common/permissions/permission_set.h"
+#include "extensions/common/permissions/permissions_data.h"
#include "extensions/common/url_pattern.h"
#include "extensions/common/url_pattern_set.h"
#include "net/cookies/cookie_store.h"
#include "ui/events/keycodes/keyboard_codes.h"
#if defined(ENABLE_CONFIGURATION_POLICY)
-#include "chrome/browser/policy/policy_service.h"
+#include "components/policy/core/common/policy_service.h"
#endif
#if defined(OS_CHROMEOS)
#include "chromeos/dbus/dbus_thread_manager.h"
+#else
+#include "chrome/browser/notifications/balloon_notification_ui_manager.h"
#endif
#if defined(OS_MACOSX)
using extensions::Extension;
using extensions::ExtensionActionManager;
using extensions::ExtensionList;
+using extensions::ExtensionRegistry;
using extensions::Manifest;
namespace {
Send(reply_message);
}
-void TestingAutomationProvider::WebkitMouseClick(DictionaryValue* args,
+void TestingAutomationProvider::WebkitMouseClick(base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
return;
}
- WebKit::WebMouseEvent mouse_event;
+ blink::WebMouseEvent mouse_event;
if (!args->GetInteger("x", &mouse_event.x) ||
!args->GetInteger("y", &mouse_event.y)) {
AutomationJSONReply(this, reply_message)
return;
}
if (button == automation::kLeftButton) {
- mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
+ mouse_event.button = blink::WebMouseEvent::ButtonLeft;
} else if (button == automation::kRightButton) {
- mouse_event.button = WebKit::WebMouseEvent::ButtonRight;
+ mouse_event.button = blink::WebMouseEvent::ButtonRight;
} else if (button == automation::kMiddleButton) {
- mouse_event.button = WebKit::WebMouseEvent::ButtonMiddle;
+ mouse_event.button = blink::WebMouseEvent::ButtonMiddle;
} else {
AutomationJSONReply(this, reply_message)
.SendError("Invalid button press requested");
return;
}
- mouse_event.type = WebKit::WebInputEvent::MouseDown;
+ mouse_event.type = blink::WebInputEvent::MouseDown;
mouse_event.clickCount = 1;
view->ForwardMouseEvent(mouse_event);
- mouse_event.type = WebKit::WebInputEvent::MouseUp;
+ mouse_event.type = blink::WebInputEvent::MouseUp;
new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
1);
view->ForwardMouseEvent(mouse_event);
}
void TestingAutomationProvider::WebkitMouseMove(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
return;
}
- WebKit::WebMouseEvent mouse_event;
+ blink::WebMouseEvent mouse_event;
if (!args->GetInteger("x", &mouse_event.x) ||
!args->GetInteger("y", &mouse_event.y)) {
AutomationJSONReply(this, reply_message)
return;
}
- mouse_event.type = WebKit::WebInputEvent::MouseMove;
+ mouse_event.type = blink::WebInputEvent::MouseMove;
new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
1);
view->ForwardMouseEvent(mouse_event);
}
-void TestingAutomationProvider::WebkitMouseDrag(DictionaryValue* args,
+void TestingAutomationProvider::WebkitMouseDrag(base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
return;
}
- WebKit::WebMouseEvent mouse_event;
+ blink::WebMouseEvent mouse_event;
int start_x, start_y, end_x, end_y;
if (!args->GetInteger("start_x", &start_x) ||
!args->GetInteger("start_y", &start_y) ||
return;
}
- mouse_event.type = WebKit::WebInputEvent::MouseMove;
+ mouse_event.type = blink::WebInputEvent::MouseMove;
// Step 1- Move the mouse to the start position.
mouse_event.x = start_x;
mouse_event.y = start_y;
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.type = blink::WebInputEvent::MouseDown;
+ mouse_event.button = blink::WebMouseEvent::ButtonLeft;
mouse_event.clickCount = 1;
view->ForwardMouseEvent(mouse_event);
// Step 3 - Move the mouse to the end position.
- mouse_event.type = WebKit::WebInputEvent::MouseMove;
+ mouse_event.type = blink::WebInputEvent::MouseMove;
mouse_event.x = end_x;
mouse_event.y = end_y;
mouse_event.clickCount = 0;
view->ForwardMouseEvent(mouse_event);
// Step 4 - Release the left mouse button.
- mouse_event.type = WebKit::WebInputEvent::MouseUp;
+ mouse_event.type = blink::WebInputEvent::MouseUp;
mouse_event.clickCount = 1;
new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
1);
}
void TestingAutomationProvider::WebkitMouseButtonDown(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
return;
}
- WebKit::WebMouseEvent mouse_event;
+ blink::WebMouseEvent mouse_event;
if (!args->GetInteger("x", &mouse_event.x) ||
!args->GetInteger("y", &mouse_event.y)) {
AutomationJSONReply(this, reply_message)
return;
}
- mouse_event.type = WebKit::WebInputEvent::MouseDown;
- mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
+ mouse_event.type = blink::WebInputEvent::MouseDown;
+ mouse_event.button = blink::WebMouseEvent::ButtonLeft;
mouse_event.clickCount = 1;
new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
1);
}
void TestingAutomationProvider::WebkitMouseButtonUp(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
return;
}
- WebKit::WebMouseEvent mouse_event;
+ blink::WebMouseEvent mouse_event;
if (!args->GetInteger("x", &mouse_event.x) ||
!args->GetInteger("y", &mouse_event.y)) {
AutomationJSONReply(this, reply_message)
return;
}
- mouse_event.type = WebKit::WebInputEvent::MouseUp;
- mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
+ mouse_event.type = blink::WebInputEvent::MouseUp;
+ mouse_event.button = blink::WebMouseEvent::ButtonLeft;
mouse_event.clickCount = 1;
new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
1);
}
void TestingAutomationProvider::WebkitMouseDoubleClick(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
return;
}
- WebKit::WebMouseEvent mouse_event;
+ blink::WebMouseEvent mouse_event;
if (!args->GetInteger("x", &mouse_event.x) ||
!args->GetInteger("y", &mouse_event.y)) {
AutomationJSONReply(this, reply_message)
return;
}
- mouse_event.type = WebKit::WebInputEvent::MouseDown;
- mouse_event.button = WebKit::WebMouseEvent::ButtonLeft;
+ mouse_event.type = blink::WebInputEvent::MouseDown;
+ mouse_event.button = blink::WebMouseEvent::ButtonLeft;
mouse_event.clickCount = 1;
view->ForwardMouseEvent(mouse_event);
- mouse_event.type = WebKit::WebInputEvent::MouseUp;
+ mouse_event.type = blink::WebInputEvent::MouseUp;
new InputEventAckNotificationObserver(this, reply_message, mouse_event.type,
2);
view->ForwardMouseEvent(mouse_event);
- mouse_event.type = WebKit::WebInputEvent::MouseDown;
+ mouse_event.type = blink::WebInputEvent::MouseDown;
mouse_event.clickCount = 2;
view->ForwardMouseEvent(mouse_event);
- mouse_event.type = WebKit::WebInputEvent::MouseUp;
+ mouse_event.type = blink::WebInputEvent::MouseUp;
view->ForwardMouseEvent(mouse_event);
}
void TestingAutomationProvider::DragAndDropFilePaths(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
return;
}
- ListValue* paths = NULL;
+ base::ListValue* paths = NULL;
if (!args->GetList("paths", &paths)) {
AutomationJSONReply(this, reply_message)
.SendError("'paths' missing or invalid");
// Emulate drag and drop to set the file paths to the file upload control.
content::DropData drop_data;
for (size_t path_index = 0; path_index < paths->GetSize(); ++path_index) {
- string16 path;
+ base::string16 path;
if (!paths->GetString(path_index, &path)) {
AutomationJSONReply(this, reply_message)
.SendError("'paths' contains a non-string type");
}
drop_data.filenames.push_back(
- content::DropData::FileInfo(path, string16()));
+ ui::FileInfo(base::FilePath::FromUTF16Unsafe(path), base::FilePath()));
}
const gfx::Point client(x, y);
const gfx::Point screen;
int operations = 0;
- operations |= WebKit::WebDragOperationCopy;
- operations |= WebKit::WebDragOperationLink;
- operations |= WebKit::WebDragOperationMove;
+ operations |= blink::WebDragOperationCopy;
+ operations |= blink::WebDragOperationLink;
+ operations |= blink::WebDragOperationMove;
view->DragTargetDragEnter(
drop_data, client, screen,
- static_cast<WebKit::WebDragOperationsMask>(operations), 0);
+ static_cast<blink::WebDragOperationsMask>(operations), 0);
new DragTargetDropAckNotificationObserver(this, reply_message);
view->DragTargetDrop(client, screen, 0);
}
NavigationController* tab = tab_tracker_->GetResource(handle);
NavigationEntry* entry = tab->GetActiveEntry();
if (entry != NULL) {
- *title = UTF16ToWideHack(entry->GetTitleForDisplay(std::string()));
+ *title = base::UTF16ToWideHack(entry->GetTitleForDisplay(std::string()));
} else {
*title = std::wstring();
}
}
void TestingAutomationProvider::ExecuteJavascriptInRenderViewFrame(
- const string16& frame_xpath,
- const string16& script,
+ const base::string16& frame_xpath,
+ const base::string16& script,
IPC::Message* reply_message,
RenderViewHost* render_view_host) {
// Set the routing id of this message with the controller.
// this javascript execution.
render_view_host->ExecuteJavascriptInWebFrame(
frame_xpath,
- UTF8ToUTF16("window.domAutomationController.setAutomationId(0);"));
+ base::ASCIIToUTF16("window.domAutomationController.setAutomationId(0);"));
render_view_host->ExecuteJavascriptInWebFrame(
frame_xpath, script);
}
}
new DomOperationMessageSender(this, reply_message, false);
- ExecuteJavascriptInRenderViewFrame(WideToUTF16Hack(frame_xpath),
- WideToUTF16Hack(script), reply_message,
+ ExecuteJavascriptInRenderViewFrame(base::WideToUTF16Hack(frame_xpath),
+ base::WideToUTF16Hack(script),
+ reply_message,
web_contents->GetRenderViewHost());
}
ProfileManager* profile_manager = g_browser_process->profile_manager();
new BrowserOpenedWithNewProfileNotificationObserver(this, reply_message);
profile_manager->CreateMultiProfileAsync(
- string16(), string16(), ProfileManager::CreateCallback(), std::string());
+ base::string16(), base::string16(),
+ ProfileManager::CreateCallback(), std::string());
}
// Sample json input: { "command": "GetMultiProfileInfo" }
// See GetMultiProfileInfo() in pyauto.py for sample output.
void TestingAutomationProvider::GetMultiProfileInfo(
base::DictionaryValue* args, IPC::Message* reply_message) {
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
ProfileManager* profile_manager = g_browser_process->profile_manager();
const ProfileInfoCache& profile_info_cache =
profile_manager->GetProfileInfoCache();
return_value->SetBoolean("enabled", profiles::IsMultipleProfilesEnabled());
- ListValue* profiles = new ListValue;
+ base::ListValue* profiles = new base::ListValue;
for (size_t index = 0; index < profile_info_cache.GetNumberOfProfiles();
++index) {
- DictionaryValue* item = new DictionaryValue;
+ base::DictionaryValue* item = new base::DictionaryValue;
item->SetString("name", profile_info_cache.GetNameOfProfileAtIndex(index));
item->SetString("path",
profile_info_cache.GetPathOfProfileAtIndex(index).value());
Browser* browser = new Browser(
Browser::CreateParams(static_cast<Browser::Type>(type), profile_,
chrome::HOST_DESKTOP_TYPE_NATIVE));
- chrome::AddBlankTabAt(browser, -1, true);
+ chrome::AddTabAt(browser, GURL(), -1, true);
if (show)
browser->window()->Show();
}
Browser* browser = new Browser(
Browser::CreateParams(Browser::TYPE_TABBED, profile_,
chrome::HOST_DESKTOP_TYPE_NATIVE));
- chrome::AddBlankTabAt(browser, -1, true);
+ chrome::AddTabAt(browser, GURL(), -1, true);
if (show)
browser->window()->Show();
}
void TestingAutomationProvider::GetBrowserWindowCountJSON(
base::DictionaryValue* args,
IPC::Message* reply_message) {
- DictionaryValue dict;
+ base::DictionaryValue dict;
// The automation layer doesn't support non-native desktops.
dict.SetInteger("count",
static_cast<int>(BrowserList::GetInstance(
// Bookmark bar visibility is based on the pref (e.g. is it in the toolbar).
// Presence in the NTP is signalled in |detached|.
void TestingAutomationProvider::GetBookmarkBarStatus(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
// browser->window()->IsBookmarkBarVisible() is not consistent across
// platforms. bookmark_bar_state() also follows prefs::kShowBookmarkBar
// and has a shared implementation on all platforms.
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("visible",
browser->bookmark_bar_state() == BookmarkBar::SHOW);
dict.SetBoolean("animating", browser->window()->IsBookmarkBarAnimating());
}
void TestingAutomationProvider::GetBookmarksAsJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendError("Failed to serialize bookmarks");
return;
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetString("bookmarks_as_json", bookmarks_as_json);
reply.SendSuccess(&dict);
}
}
void TestingAutomationProvider::WaitForBookmarkModelToLoadJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
Browser* browser;
std::string error_msg;
}
void TestingAutomationProvider::AddBookmark(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
std::string error_msg, url;
- string16 title;
+ base::string16 title;
int parent_id, index;
bool folder;
if (!GetBrowserFromJSONArgs(args, &browser, &error_msg)) {
reply.SendSuccess(NULL);
}
-void TestingAutomationProvider::ReparentBookmark(DictionaryValue* args,
+void TestingAutomationProvider::ReparentBookmark(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendSuccess(NULL);
}
-void TestingAutomationProvider::SetBookmarkTitle(DictionaryValue* args,
+void TestingAutomationProvider::SetBookmarkTitle(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
std::string error_msg;
- string16 title;
+ base::string16 title;
int id;
if (!GetBrowserFromJSONArgs(args, &browser, &error_msg)) {
reply.SendError(error_msg);
reply.SendSuccess(NULL);
}
-void TestingAutomationProvider::SetBookmarkURL(DictionaryValue* args,
+void TestingAutomationProvider::SetBookmarkURL(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendSuccess(NULL);
}
-void TestingAutomationProvider::RemoveBookmark(DictionaryValue* args,
+void TestingAutomationProvider::RemoveBookmark(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
browser_handler_map_["SaveTabContents"] =
&TestingAutomationProvider::SaveTabContents;
- browser_handler_map_["AddSavedPassword"] =
- &TestingAutomationProvider::AddSavedPassword;
- browser_handler_map_["RemoveSavedPassword"] =
- &TestingAutomationProvider::RemoveSavedPassword;
browser_handler_map_["GetSavedPasswords"] =
&TestingAutomationProvider::GetSavedPasswords;
browser_handler_map_["FindInPage"] = &TestingAutomationProvider::FindInPage;
- browser_handler_map_["GetAllNotifications"] =
- &TestingAutomationProvider::GetAllNotifications;
- browser_handler_map_["CloseNotification"] =
- &TestingAutomationProvider::CloseNotification;
- browser_handler_map_["WaitForNotificationCount"] =
- &TestingAutomationProvider::WaitForNotificationCount;
-
browser_handler_map_["GetNTPInfo"] =
&TestingAutomationProvider::GetNTPInfo;
browser_handler_map_["RemoveNTPMostVisitedThumbnail"] =
&TestingAutomationProvider::DenyCurrentFullscreenOrMouseLockRequest;
}
-scoped_ptr<DictionaryValue> TestingAutomationProvider::ParseJSONRequestCommand(
+scoped_ptr<base::DictionaryValue>
+TestingAutomationProvider::ParseJSONRequestCommand(
const std::string& json_request,
std::string* command,
std::string* error) {
- scoped_ptr<DictionaryValue> dict_value;
- scoped_ptr<Value> values(base::JSONReader::ReadAndReturnError(json_request,
- base::JSON_ALLOW_TRAILING_COMMAS, NULL, error));
+ scoped_ptr<base::DictionaryValue> dict_value;
+ scoped_ptr<base::Value> values(
+ base::JSONReader::ReadAndReturnError(json_request,
+ base::JSON_ALLOW_TRAILING_COMMAS, NULL, error));
if (values.get()) {
// Make sure input is a dict with a string command.
- if (values->GetType() != Value::TYPE_DICTIONARY) {
+ if (values->GetType() != base::Value::TYPE_DICTIONARY) {
*error = "Command dictionary is not a dictionary.";
} else {
- dict_value.reset(static_cast<DictionaryValue*>(values.release()));
+ dict_value.reset(static_cast<base::DictionaryValue*>(values.release()));
if (!dict_value->GetStringASCII("command", command)) {
*error = "Command key string missing from dictionary.";
dict_value.reset(NULL);
const std::string& json_request,
IPC::Message* reply_message) {
std::string command, error_string;
- scoped_ptr<DictionaryValue> dict_value(
+ scoped_ptr<base::DictionaryValue> dict_value(
ParseJSONRequestCommand(json_request, &command, &error_string));
if (!dict_value.get() || command.empty()) {
AutomationJSONReply(this, reply_message).SendError(error_string);
}
void TestingAutomationProvider::BringBrowserToFrontJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
// "height": 600 } # optional
void TestingAutomationProvider::SetWindowDimensions(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
gfx::Rect rect = browser->window()->GetRestoredBounds();
int x, y, width, height;
AutomationJSONReply(this, reply_message).SendSuccess(NULL);
}
-ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) {
+base::ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) {
// Each infobar may have different properties depending on the type.
- ListValue* infobars = new ListValue;
+ base::ListValue* infobars = new base::ListValue;
InfoBarService* infobar_service = InfoBarService::FromWebContents(wc);
for (size_t i = 0; i < infobar_service->infobar_count(); ++i) {
- DictionaryValue* infobar_item = new DictionaryValue;
- InfoBarDelegate* infobar = infobar_service->infobar_at(i);
+ base::DictionaryValue* infobar_item = new base::DictionaryValue;
+ InfoBarDelegate* infobar = infobar_service->infobar_at(i)->delegate();
switch (infobar->GetInfoBarAutomationType()) {
case InfoBarDelegate::CONFIRM_INFOBAR:
infobar_item->SetString("type", "confirm_infobar");
infobar->AsConfirmInfoBarDelegate();
infobar_item->SetString("text", confirm_infobar->GetMessageText());
infobar_item->SetString("link_text", confirm_infobar->GetLinkText());
- ListValue* buttons_list = new ListValue;
+ base::ListValue* buttons_list = new base::ListValue;
int buttons = confirm_infobar->GetButtons();
if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) {
- StringValue* button_label = new StringValue(
+ base::StringValue* button_label = new base::StringValue(
confirm_infobar->GetButtonLabel(
ConfirmInfoBarDelegate::BUTTON_OK));
buttons_list->Append(button_label);
}
if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) {
- StringValue* button_label = new StringValue(
+ base::StringValue* button_label = new base::StringValue(
confirm_infobar->GetButtonLabel(
ConfirmInfoBarDelegate::BUTTON_CANCEL));
buttons_list->Append(button_label);
// Sample output: {}
void TestingAutomationProvider::PerformActionOnInfobar(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
int tab_index;
infobar_index));
return;
}
- InfoBarDelegate* infobar_delegate =
- infobar_service->infobar_at(infobar_index);
+ InfoBar* infobar = infobar_service->infobar_at(infobar_index);
+ InfoBarDelegate* infobar_delegate = infobar->delegate();
if (action == "dismiss") {
infobar_delegate->InfoBarDismissed();
- infobar_service->RemoveInfoBar(infobar_delegate);
+ infobar_service->RemoveInfoBar(infobar);
reply.SendSuccess(NULL);
return;
}
}
if ((action == "accept") ?
confirm_infobar_delegate->Accept() : confirm_infobar_delegate->Cancel())
- infobar_service->RemoveInfoBar(infobar_delegate);
+ infobar_service->RemoveInfoBar(infobar);
reply.SendSuccess(NULL);
return;
}
// Gets info about BrowserChildProcessHost. Must run on IO thread to
// honor the semantics of BrowserChildProcessHostIterator.
// Used by AutomationProvider::GetBrowserInfo().
-void GetChildProcessHostInfo(ListValue* child_processes) {
+void GetChildProcessHostInfo(base::ListValue* child_processes) {
for (BrowserChildProcessHostIterator iter; !iter.Done(); ++iter) {
// Only add processes which are already started, since we need their handle.
if (iter.GetData().handle == base::kNullProcessHandle)
continue;
- DictionaryValue* item = new DictionaryValue;
+ base::DictionaryValue* item = new base::DictionaryValue;
item->SetString("name", iter.GetData().name);
item->SetString(
"type",
// Refer to GetBrowserInfo() in chrome/test/pyautolib/pyauto.py for
// sample json output.
void TestingAutomationProvider::GetBrowserInfo(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
base::ThreadRestrictions::ScopedAllowIO allow_io; // needed for PathService
- DictionaryValue* properties = new DictionaryValue;
+ base::DictionaryValue* properties = new base::DictionaryValue;
properties->SetString("ChromeVersion", chrome::kChromeVersion);
properties->SetString("BrowserProcessExecutableName",
chrome::kBrowserProcessExecutableName);
#endif
properties->SetBoolean("is_official", is_official_build);
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
return_value->Set("properties", properties);
return_value->SetInteger("browser_pid", base::GetCurrentProcId());
// Add info about all windows in a list of dictionaries, one dictionary
// item per window.
- ListValue* windows = new ListValue;
+ base::ListValue* windows = new base::ListValue;
int windex = 0;
for (chrome::BrowserIterator it; !it.done(); it.Next(), ++windex) {
- DictionaryValue* browser_item = new DictionaryValue;
+ base::DictionaryValue* browser_item = new base::DictionaryValue;
Browser* browser = *it;
browser_item->SetInteger("index", windex);
// Window properties
browser_item->SetInteger("height", rect.height());
browser_item->SetBoolean("fullscreen",
browser->window()->IsFullscreen());
- ListValue* visible_page_actions = new ListValue;
+ base::ListValue* visible_page_actions = new base::ListValue;
// Add info about all visible page actions. Skipped on panels, which do not
// have a location bar.
LocationBar* loc_bar = browser->window()->GetLocationBar();
size_t page_action_visible_count =
static_cast<size_t>(loc_bar_test->PageActionVisibleCount());
for (size_t i = 0; i < page_action_visible_count; ++i) {
- StringValue* extension_id = new StringValue(
+ base::StringValue* extension_id = new base::StringValue(
loc_bar_test->GetVisiblePageAction(i)->extension_id());
visible_page_actions->Append(extension_id);
}
browser_item->SetString("type", type);
// For each window, add info about all tabs in a list of dictionaries,
// one dictionary item per tab.
- ListValue* tabs = new ListValue;
+ base::ListValue* tabs = new base::ListValue;
for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
WebContents* wc = browser->tab_strip_model()->GetWebContentsAt(i);
- DictionaryValue* tab = new DictionaryValue;
+ base::DictionaryValue* tab = new base::DictionaryValue;
tab->SetInteger("index", i);
tab->SetString("url", wc->GetURL().spec());
tab->SetInteger("renderer_pid",
// Add all extension processes in a list of dictionaries, one dictionary
// item per extension process.
- ListValue* extension_views = new ListValue;
+ base::ListValue* extension_views = new base::ListValue;
ProfileManager* profile_manager = g_browser_process->profile_manager();
std::vector<Profile*> profiles(profile_manager->GetLoadedProfiles());
for (size_t i = 0; i < profiles.size(); ++i) {
- ExtensionProcessManager* process_manager =
+ extensions::ProcessManager* process_manager =
extensions::ExtensionSystem::Get(profiles[i])->process_manager();
if (!process_manager)
continue;
- const ExtensionProcessManager::ViewSet view_set =
+ const extensions::ProcessManager::ViewSet view_set =
process_manager->GetAllViews();
- for (ExtensionProcessManager::ViewSet::const_iterator jt =
+ for (extensions::ProcessManager::ViewSet::const_iterator jt =
view_set.begin();
jt != view_set.end(); ++jt) {
content::RenderViewHost* render_view_host = *jt;
process_manager->GetExtensionForRenderViewHost(render_view_host);
if (!extension)
continue;
- DictionaryValue* item = new DictionaryValue;
+ base::DictionaryValue* item = new base::DictionaryValue;
item->SetString("name", extension->name());
item->SetString("extension_id", extension->id());
item->SetInteger(
"pid",
base::GetProcId(render_view_host->GetProcess()->GetHandle()));
- DictionaryValue* view = new DictionaryValue;
+ base::DictionaryValue* view = new base::DictionaryValue;
view->SetInteger(
"render_process_id",
render_view_host->GetProcess()->GetID());
case extensions::VIEW_TYPE_EXTENSION_DIALOG:
type = "EXTENSION_DIALOG";
break;
- case extensions::VIEW_TYPE_APP_SHELL:
- type = "APP_SHELL";
+ case extensions::VIEW_TYPE_APP_WINDOW:
+ type = "APP_WINDOW";
break;
case extensions::VIEW_TYPE_PANEL:
type = "PANEL";
// Child processes are the processes for plugins and other workers.
// Add all child processes in a list of dictionaries, one dictionary item
// per child process.
- ListValue* child_processes = new ListValue;
+ base::ListValue* child_processes = new base::ListValue;
return_value->Set("child_processes", child_processes);
BrowserThread::PostTaskAndReply(
BrowserThread::IO, FROM_HERE,
// Refer to GetProcessInfo() in chrome/test/pyautolib/pyauto.py for
// sample json output.
void TestingAutomationProvider::GetProcessInfo(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
scoped_refptr<ProcessInfoObserver>
proc_observer(new ProcessInfoObserver(this, reply_message));
// sample json output.
void TestingAutomationProvider::GetNavigationInfo(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
int tab_index;
reply.SendError("tab_index missing or invalid.");
return;
}
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
const NavigationController& controller = web_contents->GetController();
NavigationEntry* nav_entry = controller.GetActiveEntry();
DCHECK(nav_entry);
// Security info.
- DictionaryValue* ssl = new DictionaryValue;
+ base::DictionaryValue* ssl = new base::DictionaryValue;
std::map<content::SecurityStyle, std::string> style_to_string;
style_to_string[content::SECURITY_STYLE_UNKNOWN] = "SECURITY_STYLE_UNKNOWN";
style_to_string[content::SECURITY_STYLE_UNAUTHENTICATED] =
// "search_text": "some text" }
// Refer chrome/test/pyautolib/history_info.py for sample json output.
void TestingAutomationProvider::GetHistoryInfo(Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
consumer_.CancelAllRequests();
- string16 search_text;
+ base::string16 search_text;
args->GetString("search_text", &search_text);
// Fetch history.
// Sample json input: { "command": "GetDownloadsInfo" }
// Refer chrome/test/pyautolib/download_info.py for sample json output.
void TestingAutomationProvider::GetDownloadsInfo(Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
- ListValue* list_of_downloads = new ListValue;
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
+ base::ListValue* list_of_downloads = new base::ListValue;
DownloadService* download_service(
DownloadServiceFactory::GetForBrowserContext(browser->profile()));
void TestingAutomationProvider::WaitForAllDownloadsToComplete(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
- ListValue* pre_download_ids = NULL;
+ base::ListValue* pre_download_ids = NULL;
if (!args->GetList("pre_download_ids", &pre_download_ids)) {
AutomationJSONReply(this, reply_message)
// json input and output.
void TestingAutomationProvider::PerformActionOnDownload(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
int id;
std::string action;
}
void TestingAutomationProvider::SetDownloadShelfVisibleJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
}
void TestingAutomationProvider::IsDownloadShelfVisibleJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendError(error_msg);
return;
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("is_visible", browser->window()->IsDownloadShelfVisible());
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::GetDownloadDirectoryJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
WebContents* web_contents;
DownloadManager* dlm =
BrowserContext::GetDownloadManager(
web_contents->GetController().GetBrowserContext());
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetString("path",
DownloadPrefs::FromDownloadManager(dlm)->DownloadPath().value());
reply.SendSuccess(&dict);
// Sample JSON input { "command": "LoadSearchEngineInfo" }
void TestingAutomationProvider::LoadSearchEngineInfo(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
TemplateURLService* url_model =
TemplateURLServiceFactory::GetForProfile(browser->profile());
// Refer to pyauto.py for sample output.
void TestingAutomationProvider::GetSearchEngineInfo(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
TemplateURLService* url_model =
TemplateURLServiceFactory::GetForProfile(browser->profile());
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
- ListValue* search_engines = new ListValue;
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
+ base::ListValue* search_engines = new base::ListValue;
TemplateURLService::TemplateURLVector template_urls =
url_model->GetTemplateURLs();
for (TemplateURLService::TemplateURLVector::const_iterator it =
template_urls.begin(); it != template_urls.end(); ++it) {
- DictionaryValue* search_engine = new DictionaryValue;
- search_engine->SetString("short_name", UTF16ToUTF8((*it)->short_name()));
- search_engine->SetString("keyword", UTF16ToUTF8((*it)->keyword()));
+ base::DictionaryValue* search_engine = new base::DictionaryValue;
+ search_engine->SetString("short_name",
+ base::UTF16ToUTF8((*it)->short_name()));
+ search_engine->SetString("keyword", base::UTF16ToUTF8((*it)->keyword()));
search_engine->SetBoolean("in_default_list", (*it)->ShowInDefaultList());
search_engine->SetBoolean("is_default",
(*it) == url_model->GetDefaultSearchProvider());
search_engine->SetString("host", (*it)->url_ref().GetHost());
search_engine->SetString("path", (*it)->url_ref().GetPath());
search_engine->SetString("display_url",
- UTF16ToUTF8((*it)->url_ref().DisplayURL()));
+ base::UTF16ToUTF8((*it)->url_ref().DisplayURL()));
search_engines->Append(search_engine);
}
return_value->Set("search_engines", search_engines);
// Refer to pyauto.py for sample JSON input.
void TestingAutomationProvider::AddOrEditSearchEngine(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
TemplateURLService* url_model =
TemplateURLServiceFactory::GetForProfile(browser->profile());
- string16 new_title;
- string16 new_keyword;
+ base::string16 new_title;
+ base::string16 new_keyword;
std::string new_url;
std::string keyword;
if (!args->GetString("new_title", &new_title) ||
return;
}
std::string new_ref_url = TemplateURLRef::DisplayURLToURLRef(
- UTF8ToUTF16(new_url));
+ base::UTF8ToUTF16(new_url));
scoped_ptr<KeywordEditorController> controller(
new KeywordEditorController(browser->profile()));
if (args->GetString("keyword", &keyword)) {
TemplateURL* template_url =
- url_model->GetTemplateURLForKeyword(UTF8ToUTF16(keyword));
+ url_model->GetTemplateURLForKeyword(base::UTF8ToUTF16(keyword));
if (template_url == NULL) {
AutomationJSONReply(this, reply_message).SendError(
"No match for keyword: " + keyword);
// "keyword": keyword, "action": action }
void TestingAutomationProvider::PerformActionOnSearchEngine(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
TemplateURLService* url_model =
TemplateURLServiceFactory::GetForProfile(browser->profile());
return;
}
TemplateURL* template_url =
- url_model->GetTemplateURLForKeyword(UTF8ToUTF16(keyword));
+ url_model->GetTemplateURLForKeyword(base::UTF8ToUTF16(keyword));
if (template_url == NULL) {
AutomationJSONReply(this, reply_message).SendError(
"No match for keyword: " + keyword);
// Sample json input: { "command": "GetLocalStatePrefsInfo" }
// Refer chrome/test/pyautolib/prefs_info.py for sample json output.
void TestingAutomationProvider::GetLocalStatePrefsInfo(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
- scoped_ptr<DictionaryValue> items(
+ scoped_ptr<base::DictionaryValue> items(
g_browser_process->local_state()->GetPreferenceValues());
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
return_value->Set("prefs", items.release()); // return_value owns items.
AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
}
// Sample json input: { "command": "SetLocalStatePrefs", "path": path,
// "value": value }
void TestingAutomationProvider::SetLocalStatePrefs(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
std::string path;
- Value* val = NULL;
+ base::Value* val = NULL;
AutomationJSONReply reply(this, reply_message);
if (args->GetString("path", &path) && args->Get("value", &val)) {
PrefService* pref_service = g_browser_process->local_state();
// Sample json input: { "command": "GetPrefsInfo", "windex": 0 }
// Refer chrome/test/pyautolib/prefs_info.py for sample json output.
-void TestingAutomationProvider::GetPrefsInfo(DictionaryValue* args,
+void TestingAutomationProvider::GetPrefsInfo(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendError(error_msg);
return;
}
- scoped_ptr<DictionaryValue> items(
+ scoped_ptr<base::DictionaryValue> items(
browser->profile()->GetPrefs()->GetPreferenceValues());
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
return_value->Set("prefs", items.release()); // return_value owns items.
reply.SendSuccess(return_value.get());
}
// "windex": 0,
// "path": path,
// "value": value }
-void TestingAutomationProvider::SetPrefs(DictionaryValue* args,
+void TestingAutomationProvider::SetPrefs(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
return;
}
std::string path;
- Value* val = NULL;
+ base::Value* val = NULL;
if (args->GetString("path", &path) && args->Get("value", &val)) {
PrefService* pref_service = browser->profile()->GetPrefs();
const PrefService::Preference* pref =
// Sample json input: { "command": "GetOmniboxInfo" }
// Refer chrome/test/pyautolib/omnibox_info.py for sample json output.
void TestingAutomationProvider::GetOmniboxInfo(Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
AutomationJSONReply reply(this, reply_message);
LocationBar* loc_bar = browser->window()->GetLocationBar();
reply.SendError("The specified browser does not have a location bar.");
return;
}
- const OmniboxView* omnibox_view = loc_bar->GetLocationEntry();
+ const OmniboxView* omnibox_view = loc_bar->GetOmniboxView();
const OmniboxEditModel* model = omnibox_view->model();
// Fill up matches.
- ListValue* matches = new ListValue;
+ base::ListValue* matches = new base::ListValue;
const AutocompleteResult& result = model->result();
for (AutocompleteResult::const_iterator i(result.begin()); i != result.end();
++i) {
const AutocompleteMatch& match = *i;
- DictionaryValue* item = new DictionaryValue; // owned by return_value
+ base::DictionaryValue* item =
+ new base::DictionaryValue; // owned by return_value
item->SetString("type", AutocompleteMatchType::ToString(match.type));
item->SetBoolean("starred", match.starred);
item->SetString("destination_url", match.destination_url.spec());
return_value->Set("matches", matches);
// Fill up other properties.
- DictionaryValue* properties = new DictionaryValue; // owned by return_value
+ base::DictionaryValue* properties =
+ new base::DictionaryValue; // owned by return_value
properties->SetBoolean("has_focus", model->has_focus());
properties->SetBoolean("query_in_progress",
!model->autocomplete_controller()->done());
// Sample json input: { "command": "SetOmniboxText",
// "text": "goog" }
void TestingAutomationProvider::SetOmniboxText(Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
- string16 text;
+ base::string16 text;
AutomationJSONReply reply(this, reply_message);
if (!args->GetString("text", &text)) {
reply.SendError("text missing");
reply.SendError("The specified browser does not have a location bar.");
return;
}
- OmniboxView* omnibox_view = loc_bar->GetLocationEntry();
+ OmniboxView* omnibox_view = loc_bar->GetOmniboxView();
omnibox_view->model()->OnSetFocus(false);
omnibox_view->SetUserText(text);
reply.SendSuccess(NULL);
// capped by the size of the popup list.
void TestingAutomationProvider::OmniboxMovePopupSelection(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
int count;
AutomationJSONReply reply(this, reply_message);
reply.SendError("The specified browser does not have a location bar.");
return;
}
- loc_bar->GetLocationEntry()->model()->OnUpOrDownKeyPressed(count);
+ loc_bar->GetOmniboxView()->model()->OnUpOrDownKeyPressed(count);
reply.SendSuccess(NULL);
}
// Sample json input: { "command": "OmniboxAcceptInput" }
void TestingAutomationProvider::OmniboxAcceptInput(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
NavigationController& controller =
browser->tab_strip_model()->GetActiveWebContents()->GetController();
// Refer to InitialLoadObserver::GetTimingInformation() for sample output.
void TestingAutomationProvider::GetInitialLoadTimes(
Browser*,
- DictionaryValue*,
+ base::DictionaryValue*,
IPC::Message* reply_message) {
- scoped_ptr<DictionaryValue> return_value(
+ scoped_ptr<base::DictionaryValue> return_value(
initial_load_observer_->GetTimingInformation());
std::string json_return;
// Refer chrome/test/pyautolib/plugins_info.py for sample json output.
void TestingAutomationProvider::GetPluginsInfo(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
PluginService::GetInstance()->GetPlugins(
base::Bind(&TestingAutomationProvider::GetPluginsInfoCallback,
void TestingAutomationProvider::GetPluginsInfoCallback(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message,
const std::vector<content::WebPluginInfo>& plugins) {
PluginPrefs* plugin_prefs =
PluginPrefs::GetForProfile(browser->profile()).get();
- ListValue* items = new ListValue;
+ base::ListValue* items = new base::ListValue;
for (std::vector<content::WebPluginInfo>::const_iterator it =
plugins.begin();
it != plugins.end();
++it) {
- DictionaryValue* item = new DictionaryValue;
+ base::DictionaryValue* item = new base::DictionaryValue;
item->SetString("name", it->name);
item->SetString("path", it->path.value());
item->SetString("version", it->version);
item->SetString("desc", it->desc);
item->SetBoolean("enabled", plugin_prefs->IsPluginEnabled(*it));
// Add info about mime types.
- ListValue* mime_types = new ListValue();
+ base::ListValue* mime_types = new base::ListValue();
for (std::vector<content::WebPluginMimeType>::const_iterator type_it =
it->mime_types.begin();
type_it != it->mime_types.end();
++type_it) {
- DictionaryValue* mime_type = new DictionaryValue();
+ base::DictionaryValue* mime_type = new base::DictionaryValue();
mime_type->SetString("mimeType", type_it->mime_type);
mime_type->SetString("description", type_it->description);
- ListValue* file_extensions = new ListValue();
+ base::ListValue* file_extensions = new base::ListValue();
for (std::vector<std::string>::const_iterator ext_it =
type_it->file_extensions.begin();
ext_it != type_it->file_extensions.end();
++ext_it) {
- file_extensions->Append(new StringValue(*ext_it));
+ file_extensions->Append(new base::StringValue(*ext_it));
}
mime_type->Set("fileExtensions", file_extensions);
item->Set("mimeTypes", mime_types);
items->Append(item);
}
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
return_value->Set("plugins", items); // return_value owns items.
AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
// { "command": "EnablePlugin",
// "path": "/Library/Internet Plug-Ins/Flash Player.plugin" }
void TestingAutomationProvider::EnablePlugin(Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
base::FilePath::StringType path;
if (!args->GetString("path", &path)) {
// { "command": "DisablePlugin",
// "path": "/Library/Internet Plug-Ins/Flash Player.plugin" }
void TestingAutomationProvider::DisablePlugin(Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
base::FilePath::StringType path;
if (!args->GetString("path", &path)) {
// {}
void TestingAutomationProvider::SaveTabContents(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
int tab_index = 0;
base::FilePath::StringType filename;
this, reply_message);
}
-namespace {
-
-// Translates a dictionary password to a PasswordForm struct.
-autofill::PasswordForm GetPasswordFormFromDict(
- const DictionaryValue& password_dict) {
-
- // If the time is specified, change time to the specified time.
- base::Time time = base::Time::Now();
- int it;
- double dt;
- if (password_dict.GetInteger("time", &it))
- time = base::Time::FromTimeT(it);
- else if (password_dict.GetDouble("time", &dt))
- time = base::Time::FromDoubleT(dt);
-
- std::string signon_realm;
- string16 username_value;
- string16 password_value;
- string16 origin_url_text;
- string16 username_element;
- string16 password_element;
- string16 submit_element;
- string16 action_target_text;
- bool blacklist;
- string16 old_password_element;
- string16 old_password_value;
-
- // We don't care if any of these fail - they are either optional or checked
- // before this function is called.
- password_dict.GetString("signon_realm", &signon_realm);
- password_dict.GetString("username_value", &username_value);
- password_dict.GetString("password_value", &password_value);
- password_dict.GetString("origin_url", &origin_url_text);
- password_dict.GetString("username_element", &username_element);
- password_dict.GetString("password_element", &password_element);
- password_dict.GetString("submit_element", &submit_element);
- password_dict.GetString("action_target", &action_target_text);
- if (!password_dict.GetBoolean("blacklist", &blacklist))
- blacklist = false;
-
- GURL origin_gurl(origin_url_text);
- GURL action_target(action_target_text);
-
- autofill::PasswordForm password_form;
- password_form.signon_realm = signon_realm;
- password_form.username_value = username_value;
- password_form.password_value = password_value;
- password_form.origin = origin_gurl;
- password_form.username_element = username_element;
- password_form.password_element = password_element;
- password_form.submit_element = submit_element;
- password_form.action = action_target;
- password_form.blacklisted_by_user = blacklist;
- password_form.date_created = time;
-
- return password_form;
-}
-
-} // namespace
-
-// See AddSavedPassword() in chrome/test/functional/pyauto.py for sample json
-// input.
-// Sample json output: { "password_added": true }
-void TestingAutomationProvider::AddSavedPassword(
- Browser* browser,
- DictionaryValue* args,
- IPC::Message* reply_message) {
- DictionaryValue* password_dict = NULL;
- if (!args->GetDictionary("password", &password_dict)) {
- AutomationJSONReply(this, reply_message).SendError(
- "Must specify a password dictionary.");
- return;
- }
-
- // The "signon realm" is effectively the primary key and must be included.
- // Check here before calling GetPasswordFormFromDict.
- if (!password_dict->HasKey("signon_realm")) {
- AutomationJSONReply(this, reply_message).SendError(
- "Password must include a value for 'signon_realm.'");
- return;
- }
-
- autofill::PasswordForm new_password =
- GetPasswordFormFromDict(*password_dict);
-
- // Use IMPLICIT_ACCESS since new passwords aren't added in incognito mode.
- PasswordStore* password_store = PasswordStoreFactory::GetForProfile(
- browser->profile(), Profile::IMPLICIT_ACCESS).get();
-
- // The password store does not exist for an incognito window.
- if (password_store == NULL) {
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
- return_value->SetBoolean("password_added", false);
- AutomationJSONReply(this, reply_message).SendSuccess(return_value.get());
- return;
- }
-
- // This observer will delete itself.
- PasswordStoreLoginsChangedObserver* observer =
- new PasswordStoreLoginsChangedObserver(this, reply_message,
- PasswordStoreChange::ADD,
- "password_added");
- observer->Init();
- password_store->AddLogin(new_password);
-}
-
-// See RemoveSavedPassword() in chrome/test/functional/pyauto.py for sample
-// json input.
-// Sample json output: {}
-void TestingAutomationProvider::RemoveSavedPassword(
- Browser* browser,
- DictionaryValue* args,
- IPC::Message* reply_message) {
- DictionaryValue* password_dict = NULL;
-
- if (!args->GetDictionary("password", &password_dict)) {
- AutomationJSONReply(this, reply_message).SendError(
- "Must specify a password dictionary.");
- return;
- }
-
- // The "signon realm" is effectively the primary key and must be included.
- // Check here before calling GetPasswordFormFromDict.
- if (!password_dict->HasKey("signon_realm")) {
- AutomationJSONReply(this, reply_message).SendError(
- "Password must include a value for 'signon_realm.'");
- return;
- }
- autofill::PasswordForm to_remove =
- GetPasswordFormFromDict(*password_dict);
-
- // Use EXPLICIT_ACCESS since passwords can be removed in incognito mode.
- PasswordStore* password_store = PasswordStoreFactory::GetForProfile(
- browser->profile(), Profile::EXPLICIT_ACCESS).get();
- if (password_store == NULL) {
- AutomationJSONReply(this, reply_message).SendError(
- "Unable to get password store.");
- return;
- }
-
- // This observer will delete itself.
- PasswordStoreLoginsChangedObserver* observer =
- new PasswordStoreLoginsChangedObserver(
- this, reply_message, PasswordStoreChange::REMOVE, std::string());
- observer->Init();
-
- password_store->RemoveLogin(to_remove);
-}
-
// Sample json input: { "command": "GetSavedPasswords" }
// Refer to GetSavedPasswords() in chrome/test/pyautolib/pyauto.py for sample
// json output.
void TestingAutomationProvider::GetSavedPasswords(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
// Use EXPLICIT_ACCESS since saved passwords can be retrieved in
// incognito mode.
// Get the WebContents from a dictionary of arguments.
WebContents* GetWebContentsFromDict(const Browser* browser,
- const DictionaryValue* args,
+ const base::DictionaryValue* args,
std::string* error_message) {
int tab_index;
if (!args->GetInteger("tab_index", &tab_index)) {
void TestingAutomationProvider::FindInPage(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
std::string error_message;
WebContents* web_contents =
AutomationJSONReply(this, reply_message).SendError(error_message);
return;
}
- string16 search_string;
+ base::string16 search_string;
bool forward;
bool match_case;
bool find_next;
}
void TestingAutomationProvider::OpenFindInPage(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
}
void TestingAutomationProvider::IsFindInPageVisible(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
bool visible;
FindBarTesting* find_bar =
browser->GetFindBarController()->find_bar()->GetFindBarTesting();
find_bar->GetFindBarWindowInfo(NULL, &visible);
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("is_visible", visible);
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::InstallExtension(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
base::FilePath::StringType path_string;
bool with_ui;
bool from_webstore = false;
}
args->GetBoolean("from_webstore", &from_webstore);
- ExtensionService* service = extensions::ExtensionSystem::Get(
- browser->profile())->extension_service();
- ExtensionProcessManager* manager =
- extensions::ExtensionSystem::Get(browser->profile())->process_manager();
- if (service && manager) {
+ extensions::ExtensionSystem* system =
+ extensions::ExtensionSystem::Get(browser->profile());
+ ExtensionService* service = system->extension_service();
+ if (service) {
// The observer will delete itself when done.
new ExtensionReadyNotificationObserver(
- manager,
- service,
+ system,
this,
reply_message);
}
} else {
AutomationJSONReply(this, reply_message).SendError(
- "Extensions service/process manager is not available");
+ "Extensions service is not available");
}
}
namespace {
-ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) {
+base::ListValue* GetHostPermissions(const Extension* ext, bool effective_perm) {
extensions::URLPatternSet pattern_set;
if (effective_perm) {
pattern_set =
pattern_set = ext->GetActivePermissions()->explicit_hosts();
}
- ListValue* permissions = new ListValue;
+ base::ListValue* permissions = new base::ListValue;
for (extensions::URLPatternSet::const_iterator perm = pattern_set.begin();
perm != pattern_set.end(); ++perm) {
- permissions->Append(new StringValue(perm->GetAsString()));
+ permissions->Append(new base::StringValue(perm->GetAsString()));
}
return permissions;
}
-ListValue* GetAPIPermissions(const Extension* ext) {
- ListValue* permissions = new ListValue;
+base::ListValue* GetAPIPermissions(const Extension* ext) {
+ base::ListValue* permissions = new base::ListValue;
std::set<std::string> perm_list =
ext->GetActivePermissions()->GetAPIsAsStrings();
for (std::set<std::string>::const_iterator perm = perm_list.begin();
perm != perm_list.end(); ++perm) {
- permissions->Append(new StringValue(perm->c_str()));
+ permissions->Append(new base::StringValue(perm->c_str()));
}
return permissions;
}
// Sample json input: { "command": "GetExtensionsInfo" }
// See GetExtensionsInfo() in chrome/test/pyautolib/pyauto.py for sample json
// output.
-void TestingAutomationProvider::GetExtensionsInfo(DictionaryValue* args,
+void TestingAutomationProvider::GetExtensionsInfo(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendError("No extensions service.");
return;
}
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
- ListValue* extensions_values = new ListValue;
- const ExtensionSet* extensions = service->extensions();
- const ExtensionSet* disabled_extensions = service->disabled_extensions();
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
+ base::ListValue* extensions_values = new base::ListValue;
+ ExtensionRegistry* registry = ExtensionRegistry::Get(browser->profile());
+ const extensions::ExtensionSet& extensions = registry->enabled_extensions();
+ const extensions::ExtensionSet& disabled_extensions =
+ registry->disabled_extensions();
ExtensionList all;
- all.insert(all.end(),
- extensions->begin(),
- extensions->end());
- all.insert(all.end(),
- disabled_extensions->begin(),
- disabled_extensions->end());
+ all.insert(all.end(), extensions.begin(), extensions.end());
+ all.insert(all.end(), disabled_extensions.begin(), disabled_extensions.end());
ExtensionActionManager* extension_action_manager =
ExtensionActionManager::Get(browser->profile());
for (ExtensionList::const_iterator it = all.begin();
it != all.end(); ++it) {
const Extension* extension = it->get();
std::string id = extension->id();
- DictionaryValue* extension_value = new DictionaryValue;
+ base::DictionaryValue* extension_value = new base::DictionaryValue;
extension_value->SetString("id", id);
extension_value->SetString("version", extension->VersionString());
extension_value->SetString("name", extension->name());
Manifest::IsUnpackedLocation(location));
extension_value->SetBoolean("is_enabled", service->IsExtensionEnabled(id));
extension_value->SetBoolean("allowed_in_incognito",
- extension_util::IsIncognitoEnabled(id, service));
+ extensions::util::IsIncognitoEnabled(id, browser->profile()));
extension_value->SetBoolean(
"has_page_action",
extension_action_manager->GetPageAction(*extension) != NULL);
// json input.
// Sample json output: {}
void TestingAutomationProvider::UninstallExtensionById(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
const Extension* extension;
std::string error;
// See SetExtensionStateById() in chrome/test/pyautolib/pyauto.py
// for sample json input.
void TestingAutomationProvider::SetExtensionStateById(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
const Extension* extension;
std::string error;
return;
}
- ExtensionService* service = extensions::ExtensionSystem::Get(
- browser->profile())->extension_service();
- ExtensionProcessManager* manager =
- extensions::ExtensionSystem::Get(browser->profile())->process_manager();
+ extensions::ExtensionSystem* system =
+ extensions::ExtensionSystem::Get(browser->profile());
+ ExtensionService* service = system->extension_service();
if (!service) {
AutomationJSONReply(this, reply_message)
- .SendError("No extensions service or process manager.");
+ .SendError("No extensions service.");
return;
}
if (enable) {
if (!service->IsExtensionEnabled(extension->id())) {
new ExtensionReadyNotificationObserver(
- manager,
- service,
+ system,
this,
reply_message);
service->EnableExtension(extension->id());
AutomationJSONReply(this, reply_message).SendSuccess(NULL);
}
- extension_util::SetIsIncognitoEnabled(
- extension->id(), service, allow_in_incognito);
+ extensions::util::SetIsIncognitoEnabled(
+ extension->id(), browser->profile(), allow_in_incognito);
}
// See TriggerPageActionById() in chrome/test/pyautolib/pyauto.py
// for sample json input.
void TestingAutomationProvider::TriggerPageActionById(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
std::string error;
Browser* browser;
return;
}
- if (page_action->HasPopup(ExtensionTabUtil::GetTabId(tab))) {
+ if (page_action->HasPopup(extensions::ExtensionTabUtil::GetTabId(tab))) {
// This observer will delete itself.
new ExtensionPopupObserver(
this, reply_message, extension->id());
// See TriggerBrowserActionById() in chrome/test/pyautolib/pyauto.py
// for sample json input.
void TestingAutomationProvider::TriggerBrowserActionById(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
std::string error;
Browser* browser;
}
browser_actions.Press(action_index);
- if (action->HasPopup(ExtensionTabUtil::GetTabId(tab))) {
+ if (action->HasPopup(extensions::ExtensionTabUtil::GetTabId(tab))) {
// This observer will delete itself.
new ExtensionPopupObserver(
this, reply_message, extension->id());
}
void TestingAutomationProvider::ActionOnSSLBlockingPage(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
WebContents* web_contents;
bool proceed;
AutomationJSONReply(this, reply_message).SendError(error);
}
-void TestingAutomationProvider::GetSecurityState(DictionaryValue* args,
+void TestingAutomationProvider::GetSecurityState(base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
WebContents* web_contents;
return;
}
NavigationEntry* entry = web_contents->GetController().GetActiveEntry();
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetInteger("security_style",
static_cast<int>(entry->GetSSL().security_style));
dict.SetInteger("ssl_cert_status",
// Sample json input: { "command": "UpdateExtensionsNow" }
// Sample json output: {}
void TestingAutomationProvider::UpdateExtensionsNow(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
std::string error;
Browser* browser;
return;
}
- ExtensionProcessManager* manager =
+ extensions::ProcessManager* manager =
extensions::ExtensionSystem::Get(browser->profile())->process_manager();
if (!manager) {
AutomationJSONReply(this, reply_message).SendError(
base::Bind(&SendSuccessIfAlive, AsWeakPtr(), reply_message));
}
-// Refer to GetAllNotifications() in chrome/test/pyautolib/pyauto.py for
-// sample json input/output.
-void TestingAutomationProvider::GetAllNotifications(
- Browser* browser,
- DictionaryValue* args,
- IPC::Message* reply_message) {
- new GetAllNotificationsObserver(this, reply_message);
-}
-
-// Refer to CloseNotification() in chrome/test/pyautolib/pyauto.py for
-// sample json input.
-// Returns empty json message.
-void TestingAutomationProvider::CloseNotification(
- Browser* browser,
- DictionaryValue* args,
- IPC::Message* reply_message) {
- int index;
- if (!args->GetInteger("index", &index)) {
- AutomationJSONReply(this, reply_message)
- .SendError("'index' missing or invalid.");
- return;
- }
- BalloonNotificationUIManager* manager =
- BalloonNotificationUIManager::GetInstanceForTesting();
- BalloonCollection* collection = manager->balloon_collection();
- const BalloonCollection::Balloons& balloons = collection->GetActiveBalloons();
- int balloon_count = static_cast<int>(balloons.size());
- if (index < 0 || index >= balloon_count) {
- AutomationJSONReply(this, reply_message)
- .SendError(base::StringPrintf("No notification at index %d", index));
- return;
- }
- std::vector<const Notification*> queued_notes;
- manager->GetQueuedNotificationsForTesting(&queued_notes);
- if (queued_notes.empty()) {
- new OnNotificationBalloonCountObserver(
- this, reply_message, balloon_count - 1);
- } else {
- new NewNotificationBalloonObserver(this, reply_message);
- }
- manager->CancelById(balloons[index]->notification().notification_id());
-}
-
-// Refer to WaitForNotificationCount() in chrome/test/pyautolib/pyauto.py for
-// sample json input.
-// Returns empty json message.
-void TestingAutomationProvider::WaitForNotificationCount(
- Browser* browser,
- DictionaryValue* args,
- IPC::Message* reply_message) {
- int count;
- if (!args->GetInteger("count", &count)) {
- AutomationJSONReply(this, reply_message)
- .SendError("'count' missing or invalid.");
- return;
- }
- // This will delete itself when finished.
- new OnNotificationBalloonCountObserver(this, reply_message, count);
-}
-
// Sample JSON input: { "command": "GetNTPInfo" }
// For output, refer to chrome/test/pyautolib/ntp_model.py.
void TestingAutomationProvider::GetNTPInfo(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
// This observer will delete itself.
new NTPInfoObserver(this, reply_message);
void TestingAutomationProvider::RemoveNTPMostVisitedThumbnail(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
std::string url;
void TestingAutomationProvider::RestoreAllNTPMostVisitedThumbnails(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
history::TopSites* top_sites = browser->profile()->GetTopSites();
void TestingAutomationProvider::KillRendererProcess(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
int pid;
uint32 kAccessFlags = base::kProcessAccessTerminate |
}
bool TestingAutomationProvider::BuildWebKeyEventFromArgs(
- DictionaryValue* args,
+ base::DictionaryValue* args,
std::string* error,
NativeWebKeyboardEvent* event) {
int type, modifiers;
bool is_system_key;
- string16 unmodified_text, text;
+ base::string16 unmodified_text, text;
std::string key_identifier;
if (!args->GetInteger("type", &type)) {
*error = "'type' missing or invalid.";
if (args->GetString("keyIdentifier", &key_identifier)) {
base::strlcpy(event->keyIdentifier,
key_identifier.c_str(),
- WebKit::WebKeyboardEvent::keyIdentifierLengthCap);
+ blink::WebKeyboardEvent::keyIdentifierLengthCap);
} else {
*error = "'keyIdentifier' missing or invalid.";
return false;
}
if (type == automation::kRawKeyDownType) {
- event->type = WebKit::WebInputEvent::RawKeyDown;
+ event->type = blink::WebInputEvent::RawKeyDown;
} else if (type == automation::kKeyDownType) {
- event->type = WebKit::WebInputEvent::KeyDown;
+ event->type = blink::WebInputEvent::KeyDown;
} else if (type == automation::kKeyUpType) {
- event->type = WebKit::WebInputEvent::KeyUp;
+ event->type = blink::WebInputEvent::KeyUp;
} else if (type == automation::kCharType) {
- event->type = WebKit::WebInputEvent::Char;
+ event->type = blink::WebInputEvent::Char;
} else {
*error = "'type' refers to an unrecognized keyboard event type";
return false;
}
- string16 unmodified_text_truncated = unmodified_text.substr(
- 0, WebKit::WebKeyboardEvent::textLengthCap - 1);
+ base::string16 unmodified_text_truncated = unmodified_text.substr(
+ 0, blink::WebKeyboardEvent::textLengthCap - 1);
memcpy(event->unmodifiedText,
unmodified_text_truncated.c_str(),
unmodified_text_truncated.length() + 1);
- string16 text_truncated = text.substr(
- 0, WebKit::WebKeyboardEvent::textLengthCap - 1);
+ base::string16 text_truncated = text.substr(
+ 0, blink::WebKeyboardEvent::textLengthCap - 1);
memcpy(event->text, text_truncated.c_str(), text_truncated.length() + 1);
event->modifiers = 0;
if (modifiers & automation::kShiftKeyMask)
- event->modifiers |= WebKit::WebInputEvent::ShiftKey;
+ event->modifiers |= blink::WebInputEvent::ShiftKey;
if (modifiers & automation::kControlKeyMask)
- event->modifiers |= WebKit::WebInputEvent::ControlKey;
+ event->modifiers |= blink::WebInputEvent::ControlKey;
if (modifiers & automation::kAltKeyMask)
- event->modifiers |= WebKit::WebInputEvent::AltKey;
+ event->modifiers |= blink::WebInputEvent::AltKey;
if (modifiers & automation::kMetaKeyMask)
- event->modifiers |= WebKit::WebInputEvent::MetaKey;
+ event->modifiers |= blink::WebInputEvent::MetaKey;
event->isSystemKey = is_system_key;
event->timeStampSeconds = base::Time::Now().ToDoubleT();
}
void TestingAutomationProvider::SendWebkitKeyEvent(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
} // namespace
void TestingAutomationProvider::GetAppModalDialogMessage(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
std::string error_msg;
JavaScriptAppModalDialog* dialog = GetActiveJavaScriptModalDialog(&error_msg);
reply.SendError(error_msg);
return;
}
- DictionaryValue result_dict;
- result_dict.SetString("message", UTF16ToUTF8(dialog->message_text()));
+ base::DictionaryValue result_dict;
+ result_dict.SetString("message", base::UTF16ToUTF8(dialog->message_text()));
reply.SendSuccess(&result_dict);
}
void TestingAutomationProvider::AcceptOrDismissAppModalDialog(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
bool accept;
if (!args->GetBoolean("accept", &accept)) {
if (accept) {
std::string prompt_text;
if (args->GetString("prompt_text", &prompt_text))
- dialog->SetOverridePromptText(UTF8ToUTF16(prompt_text));
+ dialog->SetOverridePromptText(base::UTF8ToUTF16(prompt_text));
dialog->native_dialog()->AcceptAppModalDialog();
} else {
dialog->native_dialog()->CancelAppModalDialog();
// Sample JSON output: {}
void TestingAutomationProvider::LaunchApp(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
std::string id;
if (!args->GetString("id", &id)) {
// Sample JSON output: {}
void TestingAutomationProvider::SetAppLaunchType(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
return;
}
- extensions::ExtensionPrefs::LaunchType launch_type;
+ extensions::LaunchType launch_type;
if (launch_type_str == "pinned") {
- launch_type = extensions::ExtensionPrefs::LAUNCH_PINNED;
+ launch_type = extensions::LAUNCH_TYPE_PINNED;
} else if (launch_type_str == "regular") {
- launch_type = extensions::ExtensionPrefs::LAUNCH_REGULAR;
+ launch_type = extensions::LAUNCH_TYPE_REGULAR;
} else if (launch_type_str == "fullscreen") {
- launch_type = extensions::ExtensionPrefs::LAUNCH_FULLSCREEN;
+ launch_type = extensions::LAUNCH_TYPE_FULLSCREEN;
} else if (launch_type_str == "window") {
- launch_type = extensions::ExtensionPrefs::LAUNCH_WINDOW;
+ launch_type = extensions::LAUNCH_TYPE_WINDOW;
} else {
reply.SendError(base::StringPrintf(
"Unexpected launch type '%s'.", launch_type_str.c_str()));
return;
}
- service->extension_prefs()->SetLaunchType(extension->id(), launch_type);
+ extensions::SetLaunchType(service, extension->id(), launch_type);
reply.SendSuccess(NULL);
}
// sample json output.
void TestingAutomationProvider::GetV8HeapStats(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
WebContents* web_contents;
int tab_index;
// sample json output.
void TestingAutomationProvider::GetFPS(
Browser* browser,
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
WebContents* web_contents;
int tab_index;
void TestingAutomationProvider::IsFullscreenForBrowser(Browser* browser,
base::DictionaryValue* args,
IPC::Message* reply_message) {
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("result",
browser->fullscreen_controller()->IsFullscreenForBrowser());
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
void TestingAutomationProvider::IsFullscreenForTab(Browser* browser,
base::DictionaryValue* args,
IPC::Message* reply_message) {
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("result",
- browser->fullscreen_controller()->IsFullscreenForTabOrPending());
+ browser->fullscreen_controller()->IsWindowFullscreenForTabOrPending());
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
}
void TestingAutomationProvider::IsMouseLocked(Browser* browser,
base::DictionaryValue* args,
IPC::Message* reply_message) {
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("result", browser->tab_strip_model()->GetActiveWebContents()->
GetRenderViewHost()->GetView()->IsMouseLocked());
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
browser->fullscreen_controller()->GetFullscreenExitBubbleType();
bool mouse_lock = false;
fullscreen_bubble::PermissionRequestedByType(type, NULL, &mouse_lock);
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("result", mouse_lock);
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
}
browser->fullscreen_controller()->GetFullscreenExitBubbleType();
bool fullscreen = false;
fullscreen_bubble::PermissionRequestedByType(type, &fullscreen, NULL);
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("result", fullscreen);
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
}
IPC::Message* reply_message) {
FullscreenExitBubbleType type =
browser->fullscreen_controller()->GetFullscreenExitBubbleType();
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("result",
type != FEB_TYPE_BROWSER_FULLSCREEN_EXIT_INSTRUCTION);
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
IPC::Message* reply_message) {
FullscreenExitBubbleType type =
browser->fullscreen_controller()->GetFullscreenExitBubbleType();
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("result", fullscreen_bubble::ShowButtonsForType(type));
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
}
}
void TestingAutomationProvider::WaitForTabToBeRestored(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
WebContents* web_contents;
std::string error;
}
void TestingAutomationProvider::GetIndicesFromTab(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
int id_or_handle = 0;
SessionTabHelper* session_tab_helper =
SessionTabHelper::FromWebContents(tab);
if (session_tab_helper->session_id().id() == id) {
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetInteger("windex", browser_index);
dict.SetInteger("tab_index", tab_index);
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::NavigateToURL(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
}
void TestingAutomationProvider::GetActiveTabIndexJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
return;
}
int tab_index = browser->tab_strip_model()->active_index();
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
return_value->SetInteger("tab_index", tab_index);
reply.SendSuccess(return_value.get());
}
-void TestingAutomationProvider::AppendTabJSON(DictionaryValue* args,
+void TestingAutomationProvider::AppendTabJSON(base::DictionaryValue* args,
IPC::Message* reply_message) {
TabAppendedNotificationObserver* observer = NULL;
int append_tab_response = -1;
}
void TestingAutomationProvider::WaitUntilNavigationCompletes(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
}
void TestingAutomationProvider::ExecuteJavascriptJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
- string16 frame_xpath, javascript;
+ base::string16 frame_xpath, javascript;
std::string error;
RenderViewHost* render_view;
if (!GetRenderViewFromJSONArgs(args, profile(), &render_view, &error)) {
}
void TestingAutomationProvider::ExecuteJavascriptInRenderView(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
- string16 frame_xpath, javascript, extension_id, url_text;
+ base::string16 frame_xpath, javascript, extension_id, url_text;
int render_process_id, render_view_id;
if (!args->GetString("frame_xpath", &frame_xpath)) {
AutomationJSONReply(this, reply_message)
}
void TestingAutomationProvider::AddDomEventObserver(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
int observer_id = automation_event_queue_->AddObserver(
new DomEventObserver(automation_event_queue_.get(), event_name,
automation_id, recurring));
- scoped_ptr<DictionaryValue> return_value(new DictionaryValue);
+ scoped_ptr<base::DictionaryValue> return_value(new base::DictionaryValue);
return_value->SetInteger("observer_id", observer_id);
reply.SendSuccess(return_value.get());
}
void TestingAutomationProvider::RemoveEventObserver(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
int observer_id;
}
void TestingAutomationProvider::ClearEventQueue(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
automation_event_queue_.reset();
AutomationJSONReply(this, reply_message).SendSuccess(NULL);
}
void TestingAutomationProvider::GetNextEvent(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
scoped_ptr<AutomationJSONReply> reply(
new AutomationJSONReply(this, reply_message));
}
void TestingAutomationProvider::GoForward(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
}
NavigationController& controller = web_contents->GetController();
if (!controller.CanGoForward()) {
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("did_go_forward", false);
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
return;
}
void TestingAutomationProvider::ExecuteBrowserCommandAsyncJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
int command;
}
void TestingAutomationProvider::ExecuteBrowserCommandJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
int command;
Browser* browser;
}
void TestingAutomationProvider::IsMenuCommandEnabledJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
int command;
Browser* browser;
"'accelerator' missing or invalid.");
return;
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("enabled", chrome::IsCommandEnabled(browser, command));
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
}
void TestingAutomationProvider::GetTabInfo(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendError("Unable to get active navigation entry");
return;
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetString("title", entry->GetTitleForDisplay(std::string()));
dict.SetString("url", entry->GetVirtualURL().spec());
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::GetTabCountJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
Browser* browser;
reply.SendError(error);
return;
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetInteger("tab_count", browser->tab_strip_model()->count());
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::GoBack(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
}
NavigationController& controller = web_contents->GetController();
if (!controller.CanGoBack()) {
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("did_go_back", false);
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
return;
}
void TestingAutomationProvider::ReloadJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
}
void TestingAutomationProvider::GetCookiesJSON(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
automation_util::GetCookiesJSON(this, args, reply_message);
}
void TestingAutomationProvider::DeleteCookieJSON(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
automation_util::DeleteCookieJSON(this, args, reply_message);
}
void TestingAutomationProvider::SetCookieJSON(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
automation_util::SetCookieJSON(this, args, reply_message);
}
void TestingAutomationProvider::GetCookiesInBrowserContext(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
WebContents* web_contents;
url_string.c_str()));
return;
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetString("cookies", value);
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::DeleteCookieInBrowserContext(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
WebContents* web_contents;
}
void TestingAutomationProvider::SetCookieInBrowserContext(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
WebContents* web_contents;
}
void TestingAutomationProvider::GetTabIds(
- DictionaryValue* args, IPC::Message* reply_message) {
- ListValue* id_list = new ListValue();
+ base::DictionaryValue* args, IPC::Message* reply_message) {
+ base::ListValue* id_list = new base::ListValue();
for (chrome::BrowserIterator it; !it.done(); it.Next()) {
Browser* browser = *it;
for (int i = 0; i < browser->tab_strip_model()->count(); ++i) {
int id = SessionTabHelper::FromWebContents(
browser->tab_strip_model()->GetWebContentsAt(i))->session_id().id();
- id_list->Append(Value::CreateIntegerValue(id));
+ id_list->Append(base::Value::CreateIntegerValue(id));
}
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.Set("ids", id_list);
AutomationJSONReply(this, reply_message).SendSuccess(&dict);
}
void TestingAutomationProvider::IsTabIdValid(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
int id;
if (!args->GetInteger("id", &id)) {
}
}
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("is_valid", is_valid);
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::CloseTabJSON(
- DictionaryValue* args, IPC::Message* reply_message) {
+ base::DictionaryValue* args, IPC::Message* reply_message) {
Browser* browser;
WebContents* tab;
std::string error;
}
void TestingAutomationProvider::ActivateTabJSON(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
if (SendErrorIfModalDialogActive(this, reply_message))
return;
break;
}
}
- DictionaryValue dict;
+ base::DictionaryValue dict;
dict.SetBoolean("is_visible", is_visible);
reply.SendSuccess(&dict);
}
void TestingAutomationProvider::CreateNewAutomationProvider(
- DictionaryValue* args,
+ base::DictionaryValue* args,
IPC::Message* reply_message) {
AutomationJSONReply reply(this, reply_message);
std::string channel_id;