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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 ~URLRequestFakerForPostRequestsInterceptor() override {} | 91 ~URLRequestFakerForPostRequestsInterceptor() override {} |
92 | 92 |
93 // URLRequestInterceptor implementation: | 93 // URLRequestInterceptor implementation: |
94 net::URLRequestJob* MaybeInterceptRequest( | 94 net::URLRequestJob* MaybeInterceptRequest( |
95 net::URLRequest* request, | 95 net::URLRequest* request, |
96 net::NetworkDelegate* network_delegate) const override { | 96 net::NetworkDelegate* network_delegate) const override { |
97 // Read the uploaded data and store it to last_upload_bytes. | 97 // Read the uploaded data and store it to last_upload_bytes. |
98 const net::UploadDataStream* upload_data = request->get_upload(); | 98 const net::UploadDataStream* upload_data = request->get_upload(); |
99 last_upload_bytes_.clear(); | 99 last_upload_bytes_.clear(); |
100 if (upload_data) { | 100 if (upload_data) { |
101 const ScopedVector<net::UploadElementReader>* readers = | 101 const std::vector<scoped_ptr<net::UploadElementReader>>* readers = |
102 upload_data->GetElementReaders(); | 102 upload_data->GetElementReaders(); |
103 if (readers) { | 103 if (readers) { |
104 for (size_t i = 0; i < readers->size(); ++i) { | 104 for (size_t i = 0; i < readers->size(); ++i) { |
105 const net::UploadBytesElementReader* bytes_reader = | 105 const net::UploadBytesElementReader* bytes_reader = |
106 (*readers)[i]->AsBytesReader(); | 106 (*readers)[i]->AsBytesReader(); |
107 if (bytes_reader) { | 107 if (bytes_reader) { |
108 last_upload_bytes_ += | 108 last_upload_bytes_ += |
109 std::string(bytes_reader->bytes(), bytes_reader->length()); | 109 std::string(bytes_reader->bytes(), bytes_reader->length()); |
110 } | 110 } |
111 } | 111 } |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
840 CookieSettingsFactory::GetForProfile(new_browser->profile()) | 840 CookieSettingsFactory::GetForProfile(new_browser->profile()) |
841 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); | 841 ->SetDefaultCookieSetting(CONTENT_SETTING_SESSION_ONLY); |
842 // ... even if background mode is active. | 842 // ... even if background mode is active. |
843 EnableBackgroundMode(); | 843 EnableBackgroundMode(); |
844 new_browser = QuitBrowserAndRestore(new_browser, true); | 844 new_browser = QuitBrowserAndRestore(new_browser, true); |
845 StoreDataWithPage(new_browser, "cookies.html"); | 845 StoreDataWithPage(new_browser, "cookies.html"); |
846 DisableBackgroundMode(); | 846 DisableBackgroundMode(); |
847 new_browser = QuitBrowserAndRestore(new_browser, true); | 847 new_browser = QuitBrowserAndRestore(new_browser, true); |
848 StoreDataWithPage(new_browser, "cookies.html"); | 848 StoreDataWithPage(new_browser, "cookies.html"); |
849 } | 849 } |
OLD | NEW |