| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 | 213 |
| 214 if (!is_active()) | 214 if (!is_active()) |
| 215 return; | 215 return; |
| 216 | 216 |
| 217 DCHECK(!data.manifest_url.is_empty()); | 217 DCHECK(!data.manifest_url.is_empty()); |
| 218 DCHECK(!data.manifest.IsEmpty()); | 218 DCHECK(!data.manifest.IsEmpty()); |
| 219 | 219 |
| 220 manifest_url_ = data.manifest_url; | 220 manifest_url_ = data.manifest_url; |
| 221 manifest_ = data.manifest; | 221 manifest_ = data.manifest; |
| 222 | 222 |
| 223 // One of manifest_.name or manifest_.short_name must be non-null and | |
| 224 // non-empty if the error code was NO_ERROR_DETECTED. | |
| 225 if (manifest_.name.is_null() || manifest_.name.string().empty()) | |
| 226 app_title_ = manifest_.short_name.string(); | |
| 227 else | |
| 228 app_title_ = manifest_.name.string(); | |
| 229 | |
| 230 PerformInstallableCheck(); | 223 PerformInstallableCheck(); |
| 231 } | 224 } |
| 232 | 225 |
| 233 InstallableParams AppBannerManager::ParamsToPerformInstallableCheck() { | 226 InstallableParams AppBannerManager::ParamsToPerformInstallableCheck() { |
| 234 InstallableParams params; | 227 InstallableParams params; |
| 235 params.ideal_primary_icon_size_in_px = GetIdealPrimaryIconSizeInPx(); | 228 params.ideal_primary_icon_size_in_px = GetIdealPrimaryIconSizeInPx(); |
| 236 params.minimum_primary_icon_size_in_px = GetMinimumPrimaryIconSizeInPx(); | 229 params.minimum_primary_icon_size_in_px = GetMinimumPrimaryIconSizeInPx(); |
| 237 params.check_installable = true; | 230 params.check_installable = true; |
| 238 params.fetch_valid_primary_icon = true; | 231 params.fetch_valid_primary_icon = true; |
| 239 | 232 |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 560 if (is_pending_event()) { | 553 if (is_pending_event()) { |
| 561 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. | 554 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. |
| 562 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); | 555 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); |
| 563 } else { | 556 } else { |
| 564 // Log that the prompt request was made for when we get the prompt reply. | 557 // Log that the prompt request was made for when we get the prompt reply. |
| 565 page_requested_prompt_ = true; | 558 page_requested_prompt_ = true; |
| 566 } | 559 } |
| 567 } | 560 } |
| 568 | 561 |
| 569 } // namespace banners | 562 } // namespace banners |
| OLD | NEW |