| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/extension_webrequest_api.h" | 5 #include "chrome/browser/extensions/extension_webrequest_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 1678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1689 } | 1689 } |
| 1690 response_headers_string += '\n'; | 1690 response_headers_string += '\n'; |
| 1691 response->response_headers_string.swap(response_headers_string); | 1691 response->response_headers_string.swap(response_headers_string); |
| 1692 } | 1692 } |
| 1693 | 1693 |
| 1694 if (value->HasKey(keys::kAuthCredentialsKey)) { | 1694 if (value->HasKey(keys::kAuthCredentialsKey)) { |
| 1695 DictionaryValue* credentials_value = NULL; | 1695 DictionaryValue* credentials_value = NULL; |
| 1696 EXTENSION_FUNCTION_VALIDATE(value->GetDictionary( | 1696 EXTENSION_FUNCTION_VALIDATE(value->GetDictionary( |
| 1697 keys::kAuthCredentialsKey, | 1697 keys::kAuthCredentialsKey, |
| 1698 &credentials_value)); | 1698 &credentials_value)); |
| 1699 response->auth_credentials.reset(new net::AuthCredentials()); | 1699 string16 username; |
| 1700 string16 password; |
| 1700 EXTENSION_FUNCTION_VALIDATE( | 1701 EXTENSION_FUNCTION_VALIDATE( |
| 1701 credentials_value->GetString(keys::kUsernameKey, | 1702 credentials_value->GetString(keys::kUsernameKey, &username)); |
| 1702 &response->auth_credentials->username)); | |
| 1703 EXTENSION_FUNCTION_VALIDATE( | 1703 EXTENSION_FUNCTION_VALIDATE( |
| 1704 credentials_value->GetString(keys::kPasswordKey, | 1704 credentials_value->GetString(keys::kPasswordKey, &password)); |
| 1705 &response->auth_credentials->password)); | 1705 response->auth_credentials.reset( |
| 1706 new net::AuthCredentials(username, password)); |
| 1706 } | 1707 } |
| 1707 } | 1708 } |
| 1708 | 1709 |
| 1709 ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled( | 1710 ExtensionWebRequestEventRouter::GetInstance()->OnEventHandled( |
| 1710 profile_id(), extension_id(), event_name, sub_event_name, request_id, | 1711 profile_id(), extension_id(), event_name, sub_event_name, request_id, |
| 1711 response.release()); | 1712 response.release()); |
| 1712 | 1713 |
| 1713 return true; | 1714 return true; |
| 1714 } | 1715 } |
| 1715 | 1716 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 1736 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1737 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 1737 adblock = true; | 1738 adblock = true; |
| 1738 } else { | 1739 } else { |
| 1739 other = true; | 1740 other = true; |
| 1740 } | 1741 } |
| 1741 } | 1742 } |
| 1742 } | 1743 } |
| 1743 | 1744 |
| 1744 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1745 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 1745 } | 1746 } |
| OLD | NEW |