OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/autofill/core/browser/autofill_download_manager.h" | 5 #include "components/autofill/core/browser/autofill_download_manager.h" |
6 | 6 |
7 #include <list> | 7 #include <list> |
8 | 8 |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 download_manager_(&driver_, prefs_.get(), this) { | 72 download_manager_(&driver_, prefs_.get(), this) { |
73 driver_.SetURLRequestContext(request_context_.get()); | 73 driver_.SetURLRequestContext(request_context_.get()); |
74 } | 74 } |
75 | 75 |
76 void LimitCache(size_t cache_size) { | 76 void LimitCache(size_t cache_size) { |
77 download_manager_.set_max_form_cache_size(cache_size); | 77 download_manager_.set_max_form_cache_size(cache_size); |
78 } | 78 } |
79 | 79 |
80 // AutofillDownloadManager::Observer implementation. | 80 // AutofillDownloadManager::Observer implementation. |
81 virtual void OnLoadedServerPredictions( | 81 virtual void OnLoadedServerPredictions( |
82 const std::string& response_xml) OVERRIDE { | 82 const std::string& response_xml) override { |
83 ResponseData response; | 83 ResponseData response; |
84 response.response = response_xml; | 84 response.response = response_xml; |
85 response.type_of_response = QUERY_SUCCESSFULL; | 85 response.type_of_response = QUERY_SUCCESSFULL; |
86 responses_.push_back(response); | 86 responses_.push_back(response); |
87 } | 87 } |
88 | 88 |
89 virtual void OnUploadedPossibleFieldTypes() OVERRIDE { | 89 virtual void OnUploadedPossibleFieldTypes() override { |
90 ResponseData response; | 90 ResponseData response; |
91 response.type_of_response = UPLOAD_SUCCESSFULL; | 91 response.type_of_response = UPLOAD_SUCCESSFULL; |
92 responses_.push_back(response); | 92 responses_.push_back(response); |
93 } | 93 } |
94 | 94 |
95 virtual void OnServerRequestError( | 95 virtual void OnServerRequestError( |
96 const std::string& form_signature, | 96 const std::string& form_signature, |
97 AutofillDownloadManager::RequestType request_type, | 97 AutofillDownloadManager::RequestType request_type, |
98 int http_error) OVERRIDE { | 98 int http_error) override { |
99 ResponseData response; | 99 ResponseData response; |
100 response.signature = form_signature; | 100 response.signature = form_signature; |
101 response.error = http_error; | 101 response.error = http_error; |
102 response.type_of_response = | 102 response.type_of_response = |
103 request_type == AutofillDownloadManager::REQUEST_QUERY ? | 103 request_type == AutofillDownloadManager::REQUEST_QUERY ? |
104 REQUEST_QUERY_FAILED : REQUEST_UPLOAD_FAILED; | 104 REQUEST_QUERY_FAILED : REQUEST_UPLOAD_FAILED; |
105 responses_.push_back(response); | 105 responses_.push_back(response); |
106 } | 106 } |
107 | 107 |
108 enum ResponseType { | 108 enum ResponseType { |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
488 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); | 488 EXPECT_EQ(static_cast<size_t>(0), responses_.size()); |
489 | 489 |
490 fetcher = factory.GetFetcherByID(3); | 490 fetcher = factory.GetFetcherByID(3); |
491 ASSERT_TRUE(fetcher); | 491 ASSERT_TRUE(fetcher); |
492 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); | 492 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); |
493 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); | 493 ASSERT_EQ(static_cast<size_t>(1), responses_.size()); |
494 EXPECT_EQ(responses[0], responses_.front().response); | 494 EXPECT_EQ(responses[0], responses_.front().response); |
495 } | 495 } |
496 | 496 |
497 } // namespace autofill | 497 } // namespace autofill |
OLD | NEW |