| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 | 1551 |
| 1552 // Basic error checking. | 1552 // Basic error checking. |
| 1553 if (browser_tracker_->ContainsHandle(handle)) { | 1553 if (browser_tracker_->ContainsHandle(handle)) { |
| 1554 browser = browser_tracker_->GetResource(handle); | 1554 browser = browser_tracker_->GetResource(handle); |
| 1555 } | 1555 } |
| 1556 if (!browser) { | 1556 if (!browser) { |
| 1557 error_string = "no browser object"; | 1557 error_string = "no browser object"; |
| 1558 } else { | 1558 } else { |
| 1559 base::JSONReader reader; | 1559 base::JSONReader reader; |
| 1560 std::string error; | 1560 std::string error; |
| 1561 values.reset(reader.ReadAndReturnError(json_request, true, &error)); | 1561 values.reset(reader.ReadAndReturnError(json_request, true, NULL, &error)); |
| 1562 if (!error.empty()) { | 1562 if (!error.empty()) { |
| 1563 error_string = error; | 1563 error_string = error; |
| 1564 } | 1564 } |
| 1565 } | 1565 } |
| 1566 | 1566 |
| 1567 // Make sure input is a dict with a string command. | 1567 // Make sure input is a dict with a string command. |
| 1568 std::string command; | 1568 std::string command; |
| 1569 DictionaryValue* dict_value = NULL; | 1569 DictionaryValue* dict_value = NULL; |
| 1570 if (error_string.empty()) { | 1570 if (error_string.empty()) { |
| 1571 if (values->GetType() != Value::TYPE_DICTIONARY) { | 1571 if (values->GetType() != Value::TYPE_DICTIONARY) { |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 class SetProxyConfigTask : public Task { | 1636 class SetProxyConfigTask : public Task { |
| 1637 public: | 1637 public: |
| 1638 SetProxyConfigTask(URLRequestContextGetter* request_context_getter, | 1638 SetProxyConfigTask(URLRequestContextGetter* request_context_getter, |
| 1639 const std::string& new_proxy_config) | 1639 const std::string& new_proxy_config) |
| 1640 : request_context_getter_(request_context_getter), proxy_config_(new_proxy
_config) {} | 1640 : request_context_getter_(request_context_getter), proxy_config_(new_proxy
_config) {} |
| 1641 virtual void Run() { | 1641 virtual void Run() { |
| 1642 // First, deserialize the JSON string. If this fails, log and bail. | 1642 // First, deserialize the JSON string. If this fails, log and bail. |
| 1643 JSONStringValueSerializer deserializer(proxy_config_); | 1643 JSONStringValueSerializer deserializer(proxy_config_); |
| 1644 std::string error_message; | 1644 std::string error_msg; |
| 1645 scoped_ptr<Value> root(deserializer.Deserialize(&error_message)); | 1645 scoped_ptr<Value> root(deserializer.Deserialize(NULL, &error_msg)); |
| 1646 if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { | 1646 if (!root.get() || root->GetType() != Value::TYPE_DICTIONARY) { |
| 1647 DLOG(WARNING) << "Received bad JSON string for ProxyConfig: " | 1647 DLOG(WARNING) << "Received bad JSON string for ProxyConfig: " |
| 1648 << error_message; | 1648 << error_msg; |
| 1649 return; | 1649 return; |
| 1650 } | 1650 } |
| 1651 | 1651 |
| 1652 scoped_ptr<DictionaryValue> dict( | 1652 scoped_ptr<DictionaryValue> dict( |
| 1653 static_cast<DictionaryValue*>(root.release())); | 1653 static_cast<DictionaryValue*>(root.release())); |
| 1654 // Now put together a proxy configuration from the deserialized string. | 1654 // Now put together a proxy configuration from the deserialized string. |
| 1655 net::ProxyConfig pc; | 1655 net::ProxyConfig pc; |
| 1656 PopulateProxyConfig(*dict.get(), &pc); | 1656 PopulateProxyConfig(*dict.get(), &pc); |
| 1657 | 1657 |
| 1658 net::ProxyService* proxy_service = | 1658 net::ProxyService* proxy_service = |
| (...skipping 1024 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2683 | 2683 |
| 2684 void AutomationProvider::StartTrackingPopupMenus( | 2684 void AutomationProvider::StartTrackingPopupMenus( |
| 2685 int browser_handle, bool* success) { | 2685 int browser_handle, bool* success) { |
| 2686 NOTIMPLEMENTED(); | 2686 NOTIMPLEMENTED(); |
| 2687 } | 2687 } |
| 2688 | 2688 |
| 2689 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { | 2689 void AutomationProvider::WaitForPopupMenuToOpen(IPC::Message* reply_message) { |
| 2690 NOTIMPLEMENTED(); | 2690 NOTIMPLEMENTED(); |
| 2691 } | 2691 } |
| 2692 #endif // !defined(TOOLKIT_VIEWS) | 2692 #endif // !defined(TOOLKIT_VIEWS) |
| OLD | NEW |