Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(209)

Side by Side Diff: chrome/browser/component_updater/component_updater_configurator.cc

Issue 8348026: Add a component installer for Portable NaCl. Registration of installer is (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixes to rebase Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 virtual size_t UrlSizeLimit() OVERRIDE; 103 virtual size_t UrlSizeLimit() OVERRIDE;
104 virtual net::URLRequestContextGetter* RequestContext() OVERRIDE; 104 virtual net::URLRequestContextGetter* RequestContext() OVERRIDE;
105 virtual bool InProcess() OVERRIDE; 105 virtual bool InProcess() OVERRIDE;
106 virtual void OnEvent(Events event, int val) OVERRIDE; 106 virtual void OnEvent(Events event, int val) OVERRIDE;
107 107
108 private: 108 private:
109 net::URLRequestContextGetter* url_request_getter_; 109 net::URLRequestContextGetter* url_request_getter_;
110 std::string extra_info_; 110 std::string extra_info_;
111 bool fast_update_; 111 bool fast_update_;
112 bool out_of_process_; 112 bool out_of_process_;
113 std::string app_update_url_;
113 }; 114 };
114 115
115 ChromeConfigurator::ChromeConfigurator(const CommandLine* cmdline, 116 ChromeConfigurator::ChromeConfigurator(const CommandLine* cmdline,
116 net::URLRequestContextGetter* url_request_getter) 117 net::URLRequestContextGetter* url_request_getter)
117 : url_request_getter_(url_request_getter), 118 : url_request_getter_(url_request_getter),
118 extra_info_(kExtraInfo) { 119 extra_info_(kExtraInfo) {
119 // Parse comma-delimited debug flags. 120 // Parse comma-delimited debug flags.
120 std::vector<std::string> debug_values; 121 std::vector<std::string> debug_values;
121 Tokenize(cmdline->GetSwitchValueASCII(switches::kComponentUpdaterDebug), 122 Tokenize(cmdline->GetSwitchValueASCII(switches::kComponentUpdaterDebug),
122 ",", &debug_values); 123 ",", &debug_values);
123 fast_update_ = HasDebugValue(debug_values, kDebugFastUpdate); 124 fast_update_ = HasDebugValue(debug_values, kDebugFastUpdate);
124 out_of_process_ = HasDebugValue(debug_values, kDebugOutOfProcess); 125 out_of_process_ = HasDebugValue(debug_values, kDebugOutOfProcess);
126
127 // Allow switch to override update URL (piggyback on AppsGalleryUpdateURL).
jvoung - send to chromium... 2011/11/11 22:57:34 Is it okay to override the update URL using this c
128 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) {
129 app_update_url_ =
130 cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL);
131 } else {
132 app_update_url_ = "";
133 }
134
125 // Make the extra request params, they are necessary so omaha does 135 // Make the extra request params, they are necessary so omaha does
126 // not deliver components that are going to be rejected at install time. 136 // not deliver components that are going to be rejected at install time.
127 extra_info_ += chrome::VersionInfo().Version(); 137 extra_info_ += chrome::VersionInfo().Version();
128 if (HasDebugValue(debug_values, kDebugRequestParam)) 138 if (HasDebugValue(debug_values, kDebugRequestParam))
129 extra_info_ += "&testrequest=1"; 139 extra_info_ += "&testrequest=1";
130 } 140 }
131 141
132 int ChromeConfigurator::InitialDelay() { 142 int ChromeConfigurator::InitialDelay() {
133 return fast_update_ ? 1 : (6 * kDelayOneMinute); 143 return fast_update_ ? 1 : (6 * kDelayOneMinute);
134 } 144 }
135 145
136 int ChromeConfigurator::NextCheckDelay() { 146 int ChromeConfigurator::NextCheckDelay() {
137 return fast_update_ ? 3 : (4 * kDelayOneHour); 147 return fast_update_ ? 3 : (4 * kDelayOneHour);
138 } 148 }
139 149
140 int ChromeConfigurator::StepDelay() { 150 int ChromeConfigurator::StepDelay() {
141 return fast_update_ ? 1 : 4; 151 return fast_update_ ? 1 : 4;
142 } 152 }
143 153
144 int ChromeConfigurator::MinimumReCheckWait() { 154 int ChromeConfigurator::MinimumReCheckWait() {
145 return fast_update_ ? 30 : (6 * kDelayOneHour); 155 return fast_update_ ? 30 : (6 * kDelayOneHour);
146 } 156 }
147 157
148 GURL ChromeConfigurator::UpdateUrl() { 158 GURL ChromeConfigurator::UpdateUrl() {
149 return GURL("http://clients2.google.com/service/update2/crx"); 159 if (app_update_url_.empty()) {
160 return GURL("http://clients2.google.com/service/update2/crx");
161 } else {
162 return GURL(app_update_url_);
163 }
150 } 164 }
151 165
152 const char* ChromeConfigurator::ExtraRequestParams() { 166 const char* ChromeConfigurator::ExtraRequestParams() {
153 return extra_info_.c_str(); 167 return extra_info_.c_str();
154 } 168 }
155 169
156 size_t ChromeConfigurator::UrlSizeLimit() { 170 size_t ChromeConfigurator::UrlSizeLimit() {
157 return 1024ul; 171 return 1024ul;
158 } 172 }
159 173
(...skipping 28 matching lines...) Expand all
188 default: 202 default:
189 NOTREACHED(); 203 NOTREACHED();
190 break; 204 break;
191 } 205 }
192 } 206 }
193 207
194 ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator( 208 ComponentUpdateService::Configurator* MakeChromeComponentUpdaterConfigurator(
195 const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) { 209 const CommandLine* cmdline, net::URLRequestContextGetter* context_getter) {
196 return new ChromeConfigurator(cmdline, context_getter); 210 return new ChromeConfigurator(cmdline, context_getter);
197 } 211 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_init.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698