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

Unified Diff: chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc

Issue 994283003: Fix crash opening App Info dialog on certain apps in Guest Mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rewrite comments. Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc
diff --git a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc
index 95df36ec36109977da507d60dd1d45b79a83302c..47ca5ea07dc8a00315d5f09cfd04dffc33457370 100644
--- a/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc
+++ b/chrome/browser/ui/views/apps/app_info_dialog/app_info_permissions_panel.cc
@@ -284,9 +284,11 @@ AppInfoPermissionsPanel::GetActivePermissionMessages() const {
int AppInfoPermissionsPanel::GetRetainedFileCount() const {
if (app_->permissions_data()->HasAPIPermission(
extensions::APIPermission::kFileSystem)) {
- return apps::SavedFilesService::Get(profile_)
- ->GetAllFileEntries(app_->id())
- .size();
+ apps::SavedFilesService* service = apps::SavedFilesService::Get(profile_);
+ // The SavedFilesService can be null for incognito profiles. See
+ // http://crbug.com/467795.
+ if (service)
+ return service->GetAllFileEntries(app_->id()).size();
}
return 0;
}
@@ -312,20 +314,26 @@ AppInfoPermissionsPanel::GetRetainedFilePaths() const {
std::vector<base::string16> retained_file_paths;
if (app_->permissions_data()->HasAPIPermission(
extensions::APIPermission::kFileSystem)) {
- std::vector<apps::SavedFileEntry> retained_file_entries =
- apps::SavedFilesService::Get(profile_)->GetAllFileEntries(app_->id());
- for (std::vector<apps::SavedFileEntry>::const_iterator it =
- retained_file_entries.begin();
- it != retained_file_entries.end();
- ++it) {
- retained_file_paths.push_back(it->path.LossyDisplayName());
+ apps::SavedFilesService* service = apps::SavedFilesService::Get(profile_);
+ // The SavedFilesService can be null for incognito profiles.
+ if (service) {
+ std::vector<apps::SavedFileEntry> retained_file_entries =
+ service->GetAllFileEntries(app_->id());
+ for (std::vector<apps::SavedFileEntry>::const_iterator it =
+ retained_file_entries.begin();
+ it != retained_file_entries.end(); ++it) {
+ retained_file_paths.push_back(it->path.LossyDisplayName());
+ }
}
}
return retained_file_paths;
}
void AppInfoPermissionsPanel::RevokeFilePermissions() {
- apps::SavedFilesService::Get(profile_)->ClearQueue(app_);
+ apps::SavedFilesService* service = apps::SavedFilesService::Get(profile_);
+ // The SavedFilesService can be null for incognito profiles.
+ if (service)
+ service->ClearQueue(app_);
apps::AppLoadService::Get(profile_)->RestartApplicationIfRunning(app_->id());
Close();
« 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