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

Side by Side Diff: chrome/browser/banners/app_banner_settings_helper.cc

Issue 2156113002: Replace AppBannerDataFetcher with InstallableManager. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@banner-refactor
Patch Set: Rebase Created 4 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_settings_helper.h" 5 #include "chrome/browser/banners/app_banner_settings_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/command_line.h" 13 #include "base/command_line.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "base/metrics/field_trial.h" 15 #include "base/metrics/field_trial.h"
16 #include "base/strings/string_number_conversions.h" 16 #include "base/strings/string_number_conversions.h"
17 #include "base/strings/string_util.h" 17 #include "base/strings/string_util.h"
18 #include "chrome/browser/banners/app_banner_data_fetcher.h" 18 #include "chrome/browser/banners/app_banner_manager.h"
19 #include "chrome/browser/banners/app_banner_metrics.h" 19 #include "chrome/browser/banners/app_banner_metrics.h"
20 #include "chrome/browser/browser_process.h" 20 #include "chrome/browser/browser_process.h"
21 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" 21 #include "chrome/browser/content_settings/host_content_settings_map_factory.h"
22 #include "chrome/browser/profiles/profile.h" 22 #include "chrome/browser/profiles/profile.h"
23 #include "chrome/common/chrome_switches.h" 23 #include "chrome/common/chrome_switches.h"
24 #include "components/content_settings/core/browser/host_content_settings_map.h" 24 #include "components/content_settings/core/browser/host_content_settings_map.h"
25 #include "components/content_settings/core/common/content_settings_pattern.h" 25 #include "components/content_settings/core/common/content_settings_pattern.h"
26 #include "components/rappor/rappor_utils.h" 26 #include "components/rappor/rappor_utils.h"
27 #include "components/variations/variations_associated_data.h" 27 #include "components/variations/variations_associated_data.h"
28 #include "content/public/browser/web_contents.h" 28 #include "content/public/browser/web_contents.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 void AppBannerSettingsHelper::RecordBannerInstallEvent( 207 void AppBannerSettingsHelper::RecordBannerInstallEvent(
208 content::WebContents* web_contents, 208 content::WebContents* web_contents,
209 const std::string& package_name_or_start_url, 209 const std::string& package_name_or_start_url,
210 AppBannerRapporMetric rappor_metric) { 210 AppBannerRapporMetric rappor_metric) {
211 banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED); 211 banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED);
212 212
213 AppBannerSettingsHelper::RecordBannerEvent( 213 AppBannerSettingsHelper::RecordBannerEvent(
214 web_contents, web_contents->GetURL(), 214 web_contents, web_contents->GetURL(),
215 package_name_or_start_url, 215 package_name_or_start_url,
216 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 216 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
217 banners::AppBannerDataFetcher::GetCurrentTime()); 217 banners::AppBannerManager::GetCurrentTime());
218 218
219 rappor::SampleDomainAndRegistryFromGURL( 219 rappor::SampleDomainAndRegistryFromGURL(
220 g_browser_process->rappor_service(), 220 g_browser_process->rappor_service(),
221 (rappor_metric == WEB ? "AppBanner.WebApp.Installed" 221 (rappor_metric == WEB ? "AppBanner.WebApp.Installed"
222 : "AppBanner.NativeApp.Installed"), 222 : "AppBanner.NativeApp.Installed"),
223 web_contents->GetURL()); 223 web_contents->GetURL());
224 } 224 }
225 225
226 void AppBannerSettingsHelper::RecordBannerDismissEvent( 226 void AppBannerSettingsHelper::RecordBannerDismissEvent(
227 content::WebContents* web_contents, 227 content::WebContents* web_contents,
228 const std::string& package_name_or_start_url, 228 const std::string& package_name_or_start_url,
229 AppBannerRapporMetric rappor_metric) { 229 AppBannerRapporMetric rappor_metric) {
230 banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON); 230 banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON);
231 231
232 AppBannerSettingsHelper::RecordBannerEvent( 232 AppBannerSettingsHelper::RecordBannerEvent(
233 web_contents, web_contents->GetURL(), 233 web_contents, web_contents->GetURL(),
234 package_name_or_start_url, 234 package_name_or_start_url,
235 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_BLOCK, 235 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_BLOCK,
236 banners::AppBannerDataFetcher::GetCurrentTime()); 236 banners::AppBannerManager::GetCurrentTime());
237 237
238 rappor::SampleDomainAndRegistryFromGURL( 238 rappor::SampleDomainAndRegistryFromGURL(
239 g_browser_process->rappor_service(), 239 g_browser_process->rappor_service(),
240 (rappor_metric == WEB ? "AppBanner.WebApp.Dismissed" 240 (rappor_metric == WEB ? "AppBanner.WebApp.Dismissed"
241 : "AppBanner.NativeApp.Dismissed"), 241 : "AppBanner.NativeApp.Dismissed"),
242 web_contents->GetURL()); 242 web_contents->GetURL());
243 } 243 }
244 244
245 void AppBannerSettingsHelper::RecordBannerEvent( 245 void AppBannerSettingsHelper::RecordBannerEvent(
246 content::WebContents* web_contents, 246 content::WebContents* web_contents,
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 return true; 602 return true;
603 } 603 }
604 604
605 // Assume any value which is not "0" or "false" indicates that we should use 605 // Assume any value which is not "0" or "false" indicates that we should use
606 // site engagement. 606 // site engagement.
607 std::string param = variations::GetVariationParamValue( 607 std::string param = variations::GetVariationParamValue(
608 kBannerParamsKey, kBannerSiteEngagementParamsKey); 608 kBannerParamsKey, kBannerSiteEngagementParamsKey);
609 609
610 return (!param.empty() && param != "0" && param != "false"); 610 return (!param.empty() && param != "0" && param != "false");
611 } 611 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698