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

Side by Side Diff: chrome/browser/google/google_update.cc

Issue 10537039: Upgrade process: Add an error message for when CoCreateInstance fails. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 months 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 | no next file » | 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) 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/google/google_update.h" 5 #include "chrome/browser/google/google_update.h"
6 6
7 #include <atlbase.h> 7 #include <atlbase.h>
8 #include <atlcom.h> 8 #include <atlcom.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 UPGRADE_ERROR, error_code, string16())); 263 UPGRADE_ERROR, error_code, string16()));
264 return; 264 return;
265 } 265 }
266 266
267 CComObject<GoogleUpdateJobObserver>* job_observer; 267 CComObject<GoogleUpdateJobObserver>* job_observer;
268 HRESULT hr = 268 HRESULT hr =
269 CComObject<GoogleUpdateJobObserver>::CreateInstance(&job_observer); 269 CComObject<GoogleUpdateJobObserver>::CreateInstance(&job_observer);
270 if (hr != S_OK) { 270 if (hr != S_OK) {
271 // Most of the error messages come straight from Google Update. This one is 271 // Most of the error messages come straight from Google Update. This one is
272 // deemed worthy enough to also warrant its own error. 272 // deemed worthy enough to also warrant its own error.
273 string16 error_code = base::StringPrintf(L"0x%x", hr); 273 string16 error_code = base::StringPrintf(
274 L"%d: 0x%x", GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED, hr);
274 ReportFailure( 275 ReportFailure(
275 hr, GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED, 276 hr, GOOGLE_UPDATE_JOB_SERVER_CREATION_FAILED,
276 l10n_util::GetStringFUTF16(IDS_ABOUT_BOX_ERROR_COCREATE_FAILED, 277 l10n_util::GetStringFUTF16(IDS_ABOUT_BOX_ERROR_COCREATE_FAILED,
277 error_code), 278 error_code),
278 main_loop); 279 main_loop);
279 return; 280 return;
280 } 281 }
281 282
282 base::win::ScopedComPtr<IJobObserver> job_holder(job_observer); 283 base::win::ScopedComPtr<IJobObserver> job_holder(job_observer);
283 284
(...skipping 16 matching lines...) Expand all
300 } 301 }
301 302
302 hr = CoCreateInstanceAsAdmin(CLSID_OnDemandMachineAppsClass, 303 hr = CoCreateInstanceAsAdmin(CLSID_OnDemandMachineAppsClass,
303 IID_IGoogleUpdate, foreground_hwnd, 304 IID_IGoogleUpdate, foreground_hwnd,
304 reinterpret_cast<void**>(on_demand.Receive())); 305 reinterpret_cast<void**>(on_demand.Receive()));
305 } 306 }
306 system_level = true; 307 system_level = true;
307 } 308 }
308 309
309 if (hr != S_OK) { 310 if (hr != S_OK) {
311 string16 error_code = base::StringPrintf(
312 L"%d: 0x%x", GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, hr);
S. Ganesh 2012/06/07 21:23:02 Since the value is repeated and needs to be in syn
313 if (system_level)
314 error_code += L" -- system level";
310 ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND, 315 ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_NOT_FOUND,
311 string16(), main_loop); 316 l10n_util::GetStringFUTF16(
317 IDS_ABOUT_BOX_ERROR_COCREATE_FAILED,
318 error_code),
319 main_loop);
312 return; 320 return;
313 } 321 }
314 322
315 string16 app_guid = installer::GetAppGuidForUpdates(system_level); 323 string16 app_guid = installer::GetAppGuidForUpdates(system_level);
316 DCHECK(!app_guid.empty()); 324 DCHECK(!app_guid.empty());
317 325
318 if (!install_if_newer) 326 if (!install_if_newer)
319 hr = on_demand->CheckForUpdate(app_guid.c_str(), job_observer); 327 hr = on_demand->CheckForUpdate(app_guid.c_str(), job_observer);
320 else 328 else
321 hr = on_demand->Update(app_guid.c_str(), job_observer); 329 hr = on_demand->Update(app_guid.c_str(), job_observer);
322 330
323 if (hr != S_OK) { 331 if (hr != S_OK) {
332 string16 error_code = base::StringPrintf(
333 L"%d: 0x%x", GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR, hr);
324 ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR, 334 ReportFailure(hr, GOOGLE_UPDATE_ONDEMAND_CLASS_REPORTED_ERROR,
325 string16(), main_loop); 335 l10n_util::GetStringFUTF16(
336 IDS_ABOUT_BOX_ERROR_COCREATE_FAILED,
S. Ganesh 2012/06/07 21:23:02 Technically this is not a CoCreate failure. I pres
337 error_code),
338 main_loop);
326 return; 339 return;
327 } 340 }
328 341
329 // We need to spin the message loop while Google Update is running so that it 342 // We need to spin the message loop while Google Update is running so that it
330 // can report back to us through GoogleUpdateJobObserver. This message loop 343 // can report back to us through GoogleUpdateJobObserver. This message loop
331 // will terminate once Google Update sends us the completion status 344 // will terminate once Google Update sends us the completion status
332 // (success/error). See OnComplete(). 345 // (success/error). See OnComplete().
333 MessageLoop::current()->Run(); 346 MessageLoop::current()->Run();
334 347
335 GoogleUpdateUpgradeResult results; 348 GoogleUpdateUpgradeResult results;
336 hr = job_observer->GetResult(&results); 349 hr = job_observer->GetResult(&results);
350
337 if (hr != S_OK) { 351 if (hr != S_OK) {
352 string16 error_code = base::StringPrintf(
353 L"%d: 0x%x", GOOGLE_UPDATE_GET_RESULT_CALL_FAILED, hr);
338 ReportFailure(hr, GOOGLE_UPDATE_GET_RESULT_CALL_FAILED, 354 ReportFailure(hr, GOOGLE_UPDATE_GET_RESULT_CALL_FAILED,
339 string16(), main_loop); 355 l10n_util::GetStringFUTF16(
356 IDS_ABOUT_BOX_ERROR_COCREATE_FAILED,
S. Ganesh 2012/06/07 21:23:02 Technically this is not a CoCreate failure. I pres
357 error_code),
358 main_loop);
340 return; 359 return;
341 } 360 }
342 361
343 if (results == UPGRADE_ERROR) { 362 if (results == UPGRADE_ERROR) {
344 string16 error_message; 363 string16 error_message;
345 job_observer->GetErrorMessage(&error_message); 364 job_observer->GetErrorMessage(&error_message);
346 ReportFailure(hr, GOOGLE_UPDATE_ERROR_UPDATING, error_message, main_loop); 365 ReportFailure(hr, GOOGLE_UPDATE_ERROR_UPDATING, error_message, main_loop);
347 return; 366 return;
348 } 367 }
349 368
350 hr = job_observer->GetVersionInfo(&version_available_); 369 hr = job_observer->GetVersionInfo(&version_available_);
351 if (hr != S_OK) { 370 if (hr != S_OK) {
371 string16 error_code = base::StringPrintf(
372 L"%d: 0x%x", GOOGLE_UPDATE_GET_VERSION_INFO_FAILED, hr);
352 ReportFailure(hr, GOOGLE_UPDATE_GET_VERSION_INFO_FAILED, 373 ReportFailure(hr, GOOGLE_UPDATE_GET_VERSION_INFO_FAILED,
353 string16(), main_loop); 374 l10n_util::GetStringFUTF16(
375 IDS_ABOUT_BOX_ERROR_COCREATE_FAILED,
S. Ganesh 2012/06/07 21:23:02 Technically this is not a CoCreate failure. I pres
Finnur 2012/06/08 13:52:36 The variable name is a bit misleading but the erro
376 error_code),
377 main_loop);
354 return; 378 return;
355 } 379 }
356 380
357 main_loop->PostTask( 381 main_loop->PostTask(
358 FROM_HERE, 382 FROM_HERE,
359 base::Bind(&GoogleUpdate::ReportResults, this, 383 base::Bind(&GoogleUpdate::ReportResults, this,
360 results, GOOGLE_UPDATE_NO_ERROR, string16())); 384 results, GOOGLE_UPDATE_NO_ERROR, string16()));
361 job_holder = NULL; 385 job_holder = NULL;
362 on_demand = NULL; 386 on_demand = NULL;
363 } 387 }
(...skipping 16 matching lines...) Expand all
380 MessageLoop* main_loop) { 404 MessageLoop* main_loop) {
381 NOTREACHED() << "Communication with Google Update failed: " << hr 405 NOTREACHED() << "Communication with Google Update failed: " << hr
382 << " error: " << error_code 406 << " error: " << error_code
383 << ", message: " << error_message.c_str(); 407 << ", message: " << error_message.c_str();
384 main_loop->PostTask( 408 main_loop->PostTask(
385 FROM_HERE, 409 FROM_HERE,
386 base::Bind(&GoogleUpdate::ReportResults, this, 410 base::Bind(&GoogleUpdate::ReportResults, this,
387 UPGRADE_ERROR, error_code, error_message)); 411 UPGRADE_ERROR, error_code, error_message));
388 return false; 412 return false;
389 } 413 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698