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/search_engines/template_url_fetcher.h" | 5 #include "components/search_engines/template_url_fetcher.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // Start the model load and set-up waiting for it. | 74 // Start the model load and set-up waiting for it. |
75 template_url_subscription_ = model->RegisterOnLoadedCallback( | 75 template_url_subscription_ = model->RegisterOnLoadedCallback( |
76 base::Bind(&TemplateURLFetcher::RequestDelegate::OnLoaded, | 76 base::Bind(&TemplateURLFetcher::RequestDelegate::OnLoaded, |
77 base::Unretained(this))); | 77 base::Unretained(this))); |
78 model->Load(); | 78 model->Load(); |
79 } | 79 } |
80 | 80 |
81 if (!url_fetcher_customize_callback.is_null()) | 81 if (!url_fetcher_customize_callback.is_null()) |
82 url_fetcher_customize_callback.Run(url_fetcher_.get()); | 82 url_fetcher_customize_callback.Run(url_fetcher_.get()); |
83 | 83 |
| 84 url_fetcher_->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
| 85 net::LOAD_DO_NOT_SAVE_COOKIES | |
| 86 net::LOAD_DO_NOT_SEND_AUTH_DATA); |
84 url_fetcher_->SetRequestContext(fetcher->request_context_.get()); | 87 url_fetcher_->SetRequestContext(fetcher->request_context_.get()); |
85 url_fetcher_->Start(); | 88 url_fetcher_->Start(); |
86 } | 89 } |
87 | 90 |
88 void TemplateURLFetcher::RequestDelegate::OnLoaded() { | 91 void TemplateURLFetcher::RequestDelegate::OnLoaded() { |
89 template_url_subscription_.reset(); | 92 template_url_subscription_.reset(); |
90 if (!template_url_.get()) | 93 if (!template_url_.get()) |
91 return; | 94 return; |
92 AddSearchProvider(); | 95 AddSearchProvider(); |
93 // WARNING: AddSearchProvider deletes us. | 96 // WARNING: AddSearchProvider deletes us. |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 } | 221 } |
219 | 222 |
220 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { | 223 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { |
221 auto i = std::find_if(requests_.begin(), requests_.end(), | 224 auto i = std::find_if(requests_.begin(), requests_.end(), |
222 [request](const std::unique_ptr<RequestDelegate>& ptr) { | 225 [request](const std::unique_ptr<RequestDelegate>& ptr) { |
223 return ptr.get() == request; | 226 return ptr.get() == request; |
224 }); | 227 }); |
225 DCHECK(i != requests_.end()); | 228 DCHECK(i != requests_.end()); |
226 requests_.erase(i); | 229 requests_.erase(i); |
227 } | 230 } |
OLD | NEW |