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/component_updater/component_updater_service.h" | 5 #include "chrome/browser/component_updater/component_updater_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "base/timer.h" | 21 #include "base/timer.h" |
22 #include "chrome/browser/browser_process.h" | 22 #include "chrome/browser/browser_process.h" |
23 #include "chrome/browser/component_updater/component_unpacker.h" | 23 #include "chrome/browser/component_updater/component_unpacker.h" |
24 #include "chrome/common/chrome_notification_types.h" | 24 #include "chrome/common/chrome_notification_types.h" |
25 #include "chrome/common/chrome_utility_messages.h" | 25 #include "chrome/common/chrome_utility_messages.h" |
26 #include "chrome/common/chrome_version_info.h" | 26 #include "chrome/common/chrome_version_info.h" |
27 #include "chrome/common/extensions/extension.h" | 27 #include "chrome/common/extensions/extension.h" |
28 #include "content/public/browser/notification_service.h" | 28 #include "content/public/browser/notification_service.h" |
29 #include "content/public/browser/utility_process_host.h" | 29 #include "content/public/browser/utility_process_host.h" |
30 #include "content/public/browser/utility_process_host_client.h" | 30 #include "content/public/browser/utility_process_host_client.h" |
| 31 #include "content/public/common/content_url_request_user_data.h" |
31 #include "content/public/common/url_fetcher_delegate.h" | 32 #include "content/public/common/url_fetcher_delegate.h" |
32 #include "content/public/common/url_fetcher.h" | 33 #include "content/public/common/url_fetcher.h" |
33 #include "googleurl/src/gurl.h" | 34 #include "googleurl/src/gurl.h" |
34 #include "net/base/escape.h" | 35 #include "net/base/escape.h" |
35 #include "net/base/load_flags.h" | 36 #include "net/base/load_flags.h" |
36 | 37 |
37 using content::BrowserThread; | 38 using content::BrowserThread; |
38 using content::UtilityProcessHost; | 39 using content::UtilityProcessHost; |
39 using content::UtilityProcessHostClient; | 40 using content::UtilityProcessHostClient; |
40 | 41 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 template <typename Del, typename Ctx> | 133 template <typename Del, typename Ctx> |
133 content::URLFetcherDelegate* MakeContextDelegate(Del* delegate, Ctx* context) { | 134 content::URLFetcherDelegate* MakeContextDelegate(Del* delegate, Ctx* context) { |
134 return new DelegateWithContext<Del, Ctx>(delegate, context); | 135 return new DelegateWithContext<Del, Ctx>(delegate, context); |
135 } | 136 } |
136 | 137 |
137 // Helper to start a url request using |fetcher| with the common flags. | 138 // Helper to start a url request using |fetcher| with the common flags. |
138 void StartFetch(content::URLFetcher* fetcher, | 139 void StartFetch(content::URLFetcher* fetcher, |
139 net::URLRequestContextGetter* context_getter, | 140 net::URLRequestContextGetter* context_getter, |
140 bool save_to_file) { | 141 bool save_to_file) { |
141 fetcher->SetRequestContext(context_getter); | 142 fetcher->SetRequestContext(context_getter); |
| 143 // No user data, as the request will be cookie-less. |
| 144 fetcher->SetContentURLRequestUserData( |
| 145 new content::ContentURLRequestUserData()); |
142 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | | 146 fetcher->SetLoadFlags(net::LOAD_DO_NOT_SEND_COOKIES | |
143 net::LOAD_DO_NOT_SAVE_COOKIES | | 147 net::LOAD_DO_NOT_SAVE_COOKIES | |
144 net::LOAD_DISABLE_CACHE); | 148 net::LOAD_DISABLE_CACHE); |
145 // TODO(cpu): Define our retry and backoff policy. | 149 // TODO(cpu): Define our retry and backoff policy. |
146 fetcher->SetAutomaticallyRetryOn5xx(false); | 150 fetcher->SetAutomaticallyRetryOn5xx(false); |
147 if (save_to_file) { | 151 if (save_to_file) { |
148 fetcher->SaveResponseToTemporaryFile( | 152 fetcher->SaveResponseToTemporaryFile( |
149 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 153 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
150 } | 154 } |
151 fetcher->Start(); | 155 fetcher->Start(); |
(...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
762 ScheduleNextRun(false); | 766 ScheduleNextRun(false); |
763 } | 767 } |
764 | 768 |
765 // The component update factory. Using the component updater as a singleton | 769 // The component update factory. Using the component updater as a singleton |
766 // is the job of the browser process. | 770 // is the job of the browser process. |
767 ComponentUpdateService* ComponentUpdateServiceFactory( | 771 ComponentUpdateService* ComponentUpdateServiceFactory( |
768 ComponentUpdateService::Configurator* config) { | 772 ComponentUpdateService::Configurator* config) { |
769 DCHECK(config); | 773 DCHECK(config); |
770 return new CrxUpdateService(config); | 774 return new CrxUpdateService(config); |
771 } | 775 } |
OLD | NEW |