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

Side by Side Diff: chrome/browser/installable/installable_manager.cc

Issue 2791923005: Fails InstallableManager if a selected badge icon cannot be fetched. (Closed)
Patch Set: Addressing comments Created 3 years, 8 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/installable/installable_manager.h" 5 #include "chrome/browser/installable/installable_manager.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "chrome/browser/manifest/manifest_icon_downloader.h" 10 #include "chrome/browser/manifest/manifest_icon_downloader.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 170
171 if (params.check_installable && installable_->error != NO_ERROR_DETECTED) 171 if (params.check_installable && installable_->error != NO_ERROR_DETECTED)
172 return installable_->error; 172 return installable_->error;
173 173
174 if (params.fetch_valid_primary_icon) { 174 if (params.fetch_valid_primary_icon) {
175 IconProperty& icon = icons_[ParamsForPrimaryIcon(params)]; 175 IconProperty& icon = icons_[ParamsForPrimaryIcon(params)];
176 if (icon.error != NO_ERROR_DETECTED) 176 if (icon.error != NO_ERROR_DETECTED)
177 return icon.error; 177 return icon.error;
178 } 178 }
179 179
180 // Do not report badge icon's error because badge icon is optional. 180 if (params.fetch_valid_badge_icon) {
181 IconProperty& icon = icons_[ParamsForBadgeIcon(params)];
182
183 // If the error is NO_ACCEPTABLE_ICON, there is no icon suitable as a badge
184 // in the manifest. Ignore this case since we only want to fail the check if
185 // there was a suitable badge icon specified and we couldn't fetch it.
186 if (icon.error != NO_ERROR_DETECTED && icon.error != NO_ACCEPTABLE_ICON)
187 return icon.error;
188 }
189
181 return NO_ERROR_DETECTED; 190 return NO_ERROR_DETECTED;
182 } 191 }
183 192
184 InstallableStatusCode InstallableManager::manifest_error() const { 193 InstallableStatusCode InstallableManager::manifest_error() const {
185 return manifest_->error; 194 return manifest_->error;
186 } 195 }
187 196
188 InstallableStatusCode InstallableManager::installable_error() const { 197 InstallableStatusCode InstallableManager::installable_error() const {
189 return installable_->error; 198 return installable_->error;
190 } 199 }
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 return manifest_->url; 508 return manifest_->url;
500 } 509 }
501 510
502 const content::Manifest& InstallableManager::manifest() const { 511 const content::Manifest& InstallableManager::manifest() const {
503 return manifest_->manifest; 512 return manifest_->manifest;
504 } 513 }
505 514
506 bool InstallableManager::is_installable() const { 515 bool InstallableManager::is_installable() const {
507 return installable_->installable; 516 return installable_->installable;
508 } 517 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698