| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "components/web_resource/web_resource_service.h" | 5 #include "components/web_resource/web_resource_service.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 return; | 105 return; |
| 106 in_fetch_ = true; | 106 in_fetch_ = true; |
| 107 | 107 |
| 108 GURL web_resource_server = | 108 GURL web_resource_server = |
| 109 application_locale_.empty() | 109 application_locale_.empty() |
| 110 ? web_resource_server_ | 110 ? web_resource_server_ |
| 111 : google_util::AppendGoogleLocaleParam(web_resource_server_, | 111 : google_util::AppendGoogleLocaleParam(web_resource_server_, |
| 112 application_locale_); | 112 application_locale_); |
| 113 | 113 |
| 114 DVLOG(1) << "WebResourceService StartFetch " << web_resource_server; | 114 DVLOG(1) << "WebResourceService StartFetch " << web_resource_server; |
| 115 url_fetcher_.reset( | 115 url_fetcher_ = |
| 116 net::URLFetcher::Create(web_resource_server, net::URLFetcher::GET, this)); | 116 net::URLFetcher::Create(web_resource_server, net::URLFetcher::GET, this); |
| 117 // Do not let url fetcher affect existing state in system context | 117 // Do not let url fetcher affect existing state in system context |
| 118 // (by setting cookies, for example). | 118 // (by setting cookies, for example). |
| 119 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | | 119 url_fetcher_->SetLoadFlags(net::LOAD_DISABLE_CACHE | |
| 120 net::LOAD_DO_NOT_SEND_COOKIES | | 120 net::LOAD_DO_NOT_SEND_COOKIES | |
| 121 net::LOAD_DO_NOT_SAVE_COOKIES); | 121 net::LOAD_DO_NOT_SAVE_COOKIES); |
| 122 url_fetcher_->SetRequestContext(request_context_.get()); | 122 url_fetcher_->SetRequestContext(request_context_.get()); |
| 123 url_fetcher_->Start(); | 123 url_fetcher_->Start(); |
| 124 } | 124 } |
| 125 | 125 |
| 126 void WebResourceService::EndFetch() { | 126 void WebResourceService::EndFetch() { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 // Wait at least |start_fetch_delay_ms_|. | 166 // Wait at least |start_fetch_delay_ms_|. |
| 167 if (ms_until_update > start_fetch_delay_ms_) | 167 if (ms_until_update > start_fetch_delay_ms_) |
| 168 delay = ms_until_update; | 168 delay = ms_until_update; |
| 169 } | 169 } |
| 170 } | 170 } |
| 171 // Start fetch and wait for UpdateResourceCache. | 171 // Start fetch and wait for UpdateResourceCache. |
| 172 ScheduleFetch(delay); | 172 ScheduleFetch(delay); |
| 173 } | 173 } |
| 174 | 174 |
| 175 } // namespace web_resource | 175 } // namespace web_resource |
| OLD | NEW |