Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(421)

Side by Side Diff: chrome/browser/extensions/extension_webrequest_api.cc

Issue 8340026: Use AuthCredentials throughout the network stack instead of username/password. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fix comments Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/login/login_prompt.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/login/login_prompt.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698