| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/banners/app_banner_manager.h" | 5 #include "chrome/browser/banners/app_banner_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 if (!is_active()) | 216 if (!is_active()) |
| 217 return; | 217 return; |
| 218 | 218 |
| 219 DCHECK(!data.manifest_url.is_empty()); | 219 DCHECK(!data.manifest_url.is_empty()); |
| 220 DCHECK(!data.manifest.IsEmpty()); | 220 DCHECK(!data.manifest.IsEmpty()); |
| 221 | 221 |
| 222 manifest_url_ = data.manifest_url; | 222 manifest_url_ = data.manifest_url; |
| 223 manifest_ = data.manifest; | 223 manifest_ = data.manifest; |
| 224 | 224 |
| 225 // One of manifest_.name or manifest_.short_name must be non-null and | |
| 226 // non-empty if the error code was NO_ERROR_DETECTED. | |
| 227 if (manifest_.name.is_null() || manifest_.name.string().empty()) | |
| 228 app_title_ = manifest_.short_name.string(); | |
| 229 else | |
| 230 app_title_ = manifest_.name.string(); | |
| 231 | |
| 232 PerformInstallableCheck(); | 225 PerformInstallableCheck(); |
| 233 } | 226 } |
| 234 | 227 |
| 235 InstallableParams AppBannerManager::ParamsToPerformInstallableCheck() { | 228 InstallableParams AppBannerManager::ParamsToPerformInstallableCheck() { |
| 236 InstallableParams params; | 229 InstallableParams params; |
| 237 params.ideal_primary_icon_size_in_px = GetIdealPrimaryIconSizeInPx(); | 230 params.ideal_primary_icon_size_in_px = GetIdealPrimaryIconSizeInPx(); |
| 238 params.minimum_primary_icon_size_in_px = GetMinimumPrimaryIconSizeInPx(); | 231 params.minimum_primary_icon_size_in_px = GetMinimumPrimaryIconSizeInPx(); |
| 239 params.check_installable = true; | 232 params.check_installable = true; |
| 240 params.fetch_valid_primary_icon = true; | 233 params.fetch_valid_primary_icon = true; |
| 241 | 234 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 if (is_pending_event()) { | 580 if (is_pending_event()) { |
| 588 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. | 581 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. |
| 589 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); | 582 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); |
| 590 } else { | 583 } else { |
| 591 // Log that the prompt request was made for when we get the prompt reply. | 584 // Log that the prompt request was made for when we get the prompt reply. |
| 592 page_requested_prompt_ = true; | 585 page_requested_prompt_ = true; |
| 593 } | 586 } |
| 594 } | 587 } |
| 595 | 588 |
| 596 } // namespace banners | 589 } // namespace banners |
| OLD | NEW |