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

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, 4 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 212
213 void AppBannerSettingsHelper::RecordBannerInstallEvent( 213 void AppBannerSettingsHelper::RecordBannerInstallEvent(
214 content::WebContents* web_contents, 214 content::WebContents* web_contents,
215 const std::string& package_name_or_start_url, 215 const std::string& package_name_or_start_url,
216 AppBannerRapporMetric rappor_metric) { 216 AppBannerRapporMetric rappor_metric) {
217 banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED); 217 banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED);
218 218
219 AppBannerSettingsHelper::RecordBannerEvent( 219 AppBannerSettingsHelper::RecordBannerEvent(
220 web_contents, web_contents->GetURL(), package_name_or_start_url, 220 web_contents, web_contents->GetURL(), package_name_or_start_url,
221 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 221 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
222 banners::AppBannerDataFetcher::GetCurrentTime()); 222 banners::AppBannerManager::GetCurrentTime());
223 223
224 rappor::SampleDomainAndRegistryFromGURL( 224 rappor::SampleDomainAndRegistryFromGURL(
225 g_browser_process->rappor_service(), 225 g_browser_process->rappor_service(),
226 (rappor_metric == WEB ? "AppBanner.WebApp.Installed" 226 (rappor_metric == WEB ? "AppBanner.WebApp.Installed"
227 : "AppBanner.NativeApp.Installed"), 227 : "AppBanner.NativeApp.Installed"),
228 web_contents->GetURL()); 228 web_contents->GetURL());
229 } 229 }
230 230
231 void AppBannerSettingsHelper::RecordBannerDismissEvent( 231 void AppBannerSettingsHelper::RecordBannerDismissEvent(
232 content::WebContents* web_contents, 232 content::WebContents* web_contents,
233 const std::string& package_name_or_start_url, 233 const std::string& package_name_or_start_url,
234 AppBannerRapporMetric rappor_metric) { 234 AppBannerRapporMetric rappor_metric) {
235 banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON); 235 banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON);
236 236
237 AppBannerSettingsHelper::RecordBannerEvent( 237 AppBannerSettingsHelper::RecordBannerEvent(
238 web_contents, web_contents->GetURL(), package_name_or_start_url, 238 web_contents, web_contents->GetURL(), package_name_or_start_url,
239 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_BLOCK, 239 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_BLOCK,
240 banners::AppBannerDataFetcher::GetCurrentTime()); 240 banners::AppBannerManager::GetCurrentTime());
241 241
242 rappor::SampleDomainAndRegistryFromGURL( 242 rappor::SampleDomainAndRegistryFromGURL(
243 g_browser_process->rappor_service(), 243 g_browser_process->rappor_service(),
244 (rappor_metric == WEB ? "AppBanner.WebApp.Dismissed" 244 (rappor_metric == WEB ? "AppBanner.WebApp.Dismissed"
245 : "AppBanner.NativeApp.Dismissed"), 245 : "AppBanner.NativeApp.Dismissed"),
246 web_contents->GetURL()); 246 web_contents->GetURL());
247 } 247 }
248 248
249 void AppBannerSettingsHelper::RecordBannerEvent( 249 void AppBannerSettingsHelper::RecordBannerEvent(
250 content::WebContents* web_contents, 250 content::WebContents* web_contents,
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 return true; 647 return true;
648 } 648 }
649 649
650 // Assume any value which is not "0" or "false" indicates that we should use 650 // Assume any value which is not "0" or "false" indicates that we should use
651 // site engagement. 651 // site engagement.
652 std::string param = variations::GetVariationParamValue( 652 std::string param = variations::GetVariationParamValue(
653 kBannerParamsKey, kBannerSiteEngagementParamsKey); 653 kBannerParamsKey, kBannerSiteEngagementParamsKey);
654 654
655 return (!param.empty() && param != "0" && param != "false"); 655 return (!param.empty() && param != "0" && param != "false");
656 } 656 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698