| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 return base::IntToString(InstallableManager::GetMinimumIconSizeInPx()); | 177 return base::IntToString(InstallableManager::GetMinimumIconSizeInPx()); |
| 178 } | 178 } |
| 179 | 179 |
| 180 return std::string(); | 180 return std::string(); |
| 181 } | 181 } |
| 182 | 182 |
| 183 int AppBannerManager::GetIdealPrimaryIconSizeInPx() { | 183 int AppBannerManager::GetIdealPrimaryIconSizeInPx() { |
| 184 return InstallableManager::GetMinimumIconSizeInPx(); | 184 return InstallableManager::GetMinimumIconSizeInPx(); |
| 185 } | 185 } |
| 186 | 186 |
| 187 int AppBannerManager::GetMinimumPrimaryIconSizeInPx() { | |
| 188 return InstallableManager::GetMinimumIconSizeInPx(); | |
| 189 } | |
| 190 | |
| 191 base::WeakPtr<AppBannerManager> AppBannerManager::GetWeakPtr() { | 187 base::WeakPtr<AppBannerManager> AppBannerManager::GetWeakPtr() { |
| 192 return weak_factory_.GetWeakPtr(); | 188 return weak_factory_.GetWeakPtr(); |
| 193 } | 189 } |
| 194 | 190 |
| 195 bool AppBannerManager::IsDebugMode() const { | 191 bool AppBannerManager::IsDebugMode() const { |
| 196 return is_debug_mode_ || | 192 return is_debug_mode_ || |
| 197 base::CommandLine::ForCurrentProcess()->HasSwitch( | 193 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 198 switches::kBypassAppBannerEngagementChecks); | 194 switches::kBypassAppBannerEngagementChecks); |
| 199 } | 195 } |
| 200 | 196 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 221 manifest_ = data.manifest; | 217 manifest_ = data.manifest; |
| 222 app_title_ = (manifest_.name.is_null()) ? manifest_.short_name.string() | 218 app_title_ = (manifest_.name.is_null()) ? manifest_.short_name.string() |
| 223 : manifest_.name.string(); | 219 : manifest_.name.string(); |
| 224 | 220 |
| 225 PerformInstallableCheck(); | 221 PerformInstallableCheck(); |
| 226 } | 222 } |
| 227 | 223 |
| 228 InstallableParams AppBannerManager::ParamsToPerformInstallableCheck() { | 224 InstallableParams AppBannerManager::ParamsToPerformInstallableCheck() { |
| 229 InstallableParams params; | 225 InstallableParams params; |
| 230 params.ideal_primary_icon_size_in_px = GetIdealPrimaryIconSizeInPx(); | 226 params.ideal_primary_icon_size_in_px = GetIdealPrimaryIconSizeInPx(); |
| 231 params.minimum_primary_icon_size_in_px = GetMinimumPrimaryIconSizeInPx(); | |
| 232 params.check_installable = true; | 227 params.check_installable = true; |
| 233 params.fetch_valid_primary_icon = true; | 228 params.fetch_valid_primary_icon = true; |
| 234 | 229 |
| 235 return params; | 230 return params; |
| 236 } | 231 } |
| 237 | 232 |
| 238 void AppBannerManager::PerformInstallableCheck() { | 233 void AppBannerManager::PerformInstallableCheck() { |
| 239 if (!CheckIfShouldShowBanner()) | 234 if (!CheckIfShouldShowBanner()) |
| 240 return; | 235 return; |
| 241 | 236 |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. | 522 // Simulate a non-canceled OnBannerPromptReply to show the delayed banner. |
| 528 // Don't reset |was_canceled_by_page_| yet for metrics purposes. | 523 // Don't reset |was_canceled_by_page_| yet for metrics purposes. |
| 529 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); | 524 OnBannerPromptReply(blink::mojom::AppBannerPromptReply::NONE, referrer_); |
| 530 } else { | 525 } else { |
| 531 // Log that the prompt request was made for when we get the prompt reply. | 526 // Log that the prompt request was made for when we get the prompt reply. |
| 532 page_requested_prompt_ = true; | 527 page_requested_prompt_ = true; |
| 533 } | 528 } |
| 534 } | 529 } |
| 535 | 530 |
| 536 } // namespace banners | 531 } // namespace banners |
| OLD | NEW |