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

Side by Side Diff: chrome/browser/dom_ui/app_launcher_handler.cc

Issue 6544023: Fix crashes in ExtensionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comment/TODO Created 9 years, 10 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 | chrome/browser/sessions/session_restore.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/dom_ui/app_launcher_handler.h" 5 #include "chrome/browser/dom_ui/app_launcher_handler.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 } 463 }
464 464
465 // static 465 // static
466 void AppLauncherHandler::RecordAppLaunchByURL( 466 void AppLauncherHandler::RecordAppLaunchByURL(
467 Profile* profile, 467 Profile* profile,
468 std::string escaped_url, 468 std::string escaped_url,
469 extension_misc::AppLaunchBucket bucket) { 469 extension_misc::AppLaunchBucket bucket) {
470 CHECK(bucket != extension_misc::APP_LAUNCH_BUCKET_INVALID); 470 CHECK(bucket != extension_misc::APP_LAUNCH_BUCKET_INVALID);
471 471
472 GURL url(UnescapeURLComponent(escaped_url, kUnescapeRules)); 472 GURL url(UnescapeURLComponent(escaped_url, kUnescapeRules));
473 if (!profile->GetExtensionService()->IsInstalledApp(url)) 473 // TODO: the ExtensionService should never be NULL, but in some cases it is,
474 // see bug 73768. After it is resolved, the explicit test can go away.
475 ExtensionService* service = profile->GetExtensionService();
476 if (!service || !service->IsInstalledApp(url))
474 return; 477 return;
475 478
476 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, bucket, 479 UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, bucket,
477 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); 480 extension_misc::APP_LAUNCH_BUCKET_BOUNDARY);
478 } 481 }
479 482
480 void AppLauncherHandler::InstallUIProceed() { 483 void AppLauncherHandler::InstallUIProceed() {
481 DCHECK(!extension_id_prompting_.empty()); 484 DCHECK(!extension_id_prompting_.empty());
482 485
483 // The extension can be uninstalled in another window while the UI was 486 // The extension can be uninstalled in another window while the UI was
(...skipping 20 matching lines...) Expand all
504 507
505 void AppLauncherHandler::UninstallDefaultApps() { 508 void AppLauncherHandler::UninstallDefaultApps() {
506 DefaultApps* default_apps = extensions_service_->default_apps(); 509 DefaultApps* default_apps = extensions_service_->default_apps();
507 const ExtensionIdSet& app_ids = default_apps->default_apps(); 510 const ExtensionIdSet& app_ids = default_apps->default_apps();
508 for (ExtensionIdSet::const_iterator iter = app_ids.begin(); 511 for (ExtensionIdSet::const_iterator iter = app_ids.begin();
509 iter != app_ids.end(); ++iter) { 512 iter != app_ids.end(); ++iter) {
510 if (extensions_service_->GetExtensionById(*iter, true)) 513 if (extensions_service_->GetExtensionById(*iter, true))
511 extensions_service_->UninstallExtension(*iter, false); 514 extensions_service_->UninstallExtension(*iter, false);
512 } 515 }
513 } 516 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/sessions/session_restore.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698