OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/automation/automation_provider.h" | 5 #include "chrome/browser/automation/automation_provider.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "app/message_box_flags.h" | 10 #include "app/message_box_flags.h" |
11 #include "base/file_version_info.h" | 11 #include "base/file_version_info.h" |
12 #include "base/json_reader.h" | 12 #include "base/json/json_reader.h" |
13 #include "base/keyboard_codes.h" | 13 #include "base/keyboard_codes.h" |
14 #include "base/message_loop.h" | 14 #include "base/message_loop.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/stl_util-inl.h" | 16 #include "base/stl_util-inl.h" |
17 #include "base/string_util.h" | 17 #include "base/string_util.h" |
18 #include "base/thread.h" | 18 #include "base/thread.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
20 #include "chrome/app/chrome_dll_resource.h" | 20 #include "chrome/app/chrome_dll_resource.h" |
21 #include "chrome/browser/app_modal_dialog.h" | 21 #include "chrome/browser/app_modal_dialog.h" |
22 #include "chrome/browser/app_modal_dialog_queue.h" | 22 #include "chrome/browser/app_modal_dialog_queue.h" |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1647 return false; | 1647 return false; |
1648 | 1648 |
1649 if (origin != extension_automation_constants::kAutomationOrigin) { | 1649 if (origin != extension_automation_constants::kAutomationOrigin) { |
1650 LOG(WARNING) << "Wrong origin on automation browser event " << origin; | 1650 LOG(WARNING) << "Wrong origin on automation browser event " << origin; |
1651 return false; | 1651 return false; |
1652 } | 1652 } |
1653 | 1653 |
1654 // The message is a JSON-encoded array with two elements, both strings. The | 1654 // The message is a JSON-encoded array with two elements, both strings. The |
1655 // first is the name of the event to dispatch. The second is a JSON-encoding | 1655 // first is the name of the event to dispatch. The second is a JSON-encoding |
1656 // of the arguments specific to that event. | 1656 // of the arguments specific to that event. |
1657 scoped_ptr<Value> message_value(JSONReader::Read(message, false)); | 1657 scoped_ptr<Value> message_value(base::JSONReader::Read(message, false)); |
1658 if (!message_value.get() || !message_value->IsType(Value::TYPE_LIST)) { | 1658 if (!message_value.get() || !message_value->IsType(Value::TYPE_LIST)) { |
1659 LOG(WARNING) << "Invalid browser event specified through automation"; | 1659 LOG(WARNING) << "Invalid browser event specified through automation"; |
1660 return false; | 1660 return false; |
1661 } | 1661 } |
1662 | 1662 |
1663 const ListValue* args = static_cast<const ListValue*>(message_value.get()); | 1663 const ListValue* args = static_cast<const ListValue*>(message_value.get()); |
1664 | 1664 |
1665 std::string event_name; | 1665 std::string event_name; |
1666 if (!args->GetString(0, &event_name)) { | 1666 if (!args->GetString(0, &event_name)) { |
1667 LOG(WARNING) << "No browser event name specified through automation"; | 1667 LOG(WARNING) << "No browser event name specified through automation"; |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2150 reply_message); | 2150 reply_message); |
2151 | 2151 |
2152 profile_->GetExtensionsService()->LoadExtension(extension_dir); | 2152 profile_->GetExtensionsService()->LoadExtension(extension_dir); |
2153 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); | 2153 profile_->GetUserScriptMaster()->AddWatchedPath(extension_dir); |
2154 } else { | 2154 } else { |
2155 AutomationMsg_LoadExpandedExtension::WriteReplyParams( | 2155 AutomationMsg_LoadExpandedExtension::WriteReplyParams( |
2156 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); | 2156 reply_message, AUTOMATION_MSG_EXTENSION_INSTALL_FAILED); |
2157 Send(reply_message); | 2157 Send(reply_message); |
2158 } | 2158 } |
2159 } | 2159 } |
OLD | NEW |