Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/renderer_host/chrome_resource_dispatcher_host_delegate. h" | 5 #include "chrome/browser/renderer_host/chrome_resource_dispatcher_host_delegate. h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/base64.h" | 10 #include "base/base64.h" |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 #if defined(ENABLE_EXTENSIONS) | 603 #if defined(ENABLE_EXTENSIONS) |
| 604 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); | 604 const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); |
| 605 ProfileIOData* io_data = | 605 ProfileIOData* io_data = |
| 606 ProfileIOData::FromResourceContext(info->GetContext()); | 606 ProfileIOData::FromResourceContext(info->GetContext()); |
| 607 bool profile_is_off_the_record = io_data->IsOffTheRecord(); | 607 bool profile_is_off_the_record = io_data->IsOffTheRecord(); |
| 608 const scoped_refptr<const extensions::InfoMap> extension_info_map( | 608 const scoped_refptr<const extensions::InfoMap> extension_info_map( |
| 609 io_data->GetExtensionInfoMap()); | 609 io_data->GetExtensionInfoMap()); |
| 610 std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist(); | 610 std::vector<std::string> whitelist = MimeTypesHandler::GetMIMETypeWhitelist(); |
| 611 // Go through the white-listed extensions and try to use them to intercept | 611 // Go through the white-listed extensions and try to use them to intercept |
| 612 // the URL request. | 612 // the URL request. |
| 613 for (size_t i = 0; i < whitelist.size(); ++i) { | 613 for (const std::string& extension_id : whitelist) { |
| 614 const char* extension_id = whitelist[i].c_str(); | |
|
Lei Zhang
2015/03/18 23:07:49
I don't understand why we go from std::string -> c
Zachary Kuznia
2015/03/18 23:46:09
Thanks for catching and fixing this!
| |
| 615 const Extension* extension = | 614 const Extension* extension = |
| 616 extension_info_map->extensions().GetByID(extension_id); | 615 extension_info_map->extensions().GetByID(extension_id); |
| 617 // The white-listed extension may not be installed, so we have to NULL check | 616 // The white-listed extension may not be installed, so we have to NULL check |
| 618 // |extension|. | 617 // |extension|. |
| 619 if (!extension || | 618 if (!extension || |
| 620 (profile_is_off_the_record && | 619 (profile_is_off_the_record && |
| 621 !extension_info_map->IsIncognitoEnabled(extension_id))) { | 620 !extension_info_map->IsIncognitoEnabled(extension_id))) { |
| 622 continue; | 621 continue; |
| 623 } | 622 } |
| 624 | 623 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 756 url_request->GetTotalReceivedBytes())); | 755 url_request->GetTotalReceivedBytes())); |
| 757 } | 756 } |
| 758 } | 757 } |
| 759 | 758 |
| 760 // static | 759 // static |
| 761 void ChromeResourceDispatcherHostDelegate:: | 760 void ChromeResourceDispatcherHostDelegate:: |
| 762 SetExternalProtocolHandlerDelegateForTesting( | 761 SetExternalProtocolHandlerDelegateForTesting( |
| 763 ExternalProtocolHandler::Delegate* delegate) { | 762 ExternalProtocolHandler::Delegate* delegate) { |
| 764 g_external_protocol_handler_delegate = delegate; | 763 g_external_protocol_handler_delegate = delegate; |
| 765 } | 764 } |
| OLD | NEW |