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

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: Naming, includes 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
« no previous file with comments | « chrome/browser/banners/app_banner_manager_emulation.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 void AppBannerSettingsHelper::RecordBannerInstallEvent( 214 void AppBannerSettingsHelper::RecordBannerInstallEvent(
215 content::WebContents* web_contents, 215 content::WebContents* web_contents,
216 const std::string& package_name_or_start_url, 216 const std::string& package_name_or_start_url,
217 AppBannerRapporMetric rappor_metric) { 217 AppBannerRapporMetric rappor_metric) {
218 banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED); 218 banners::TrackInstallEvent(banners::INSTALL_EVENT_WEB_APP_INSTALLED);
219 219
220 AppBannerSettingsHelper::RecordBannerEvent( 220 AppBannerSettingsHelper::RecordBannerEvent(
221 web_contents, web_contents->GetURL(), package_name_or_start_url, 221 web_contents, web_contents->GetURL(), package_name_or_start_url,
222 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN, 222 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_ADD_TO_HOMESCREEN,
223 banners::AppBannerDataFetcher::GetCurrentTime()); 223 banners::AppBannerManager::GetCurrentTime());
224 224
225 rappor::SampleDomainAndRegistryFromGURL( 225 rappor::SampleDomainAndRegistryFromGURL(
226 g_browser_process->rappor_service(), 226 g_browser_process->rappor_service(),
227 (rappor_metric == WEB ? "AppBanner.WebApp.Installed" 227 (rappor_metric == WEB ? "AppBanner.WebApp.Installed"
228 : "AppBanner.NativeApp.Installed"), 228 : "AppBanner.NativeApp.Installed"),
229 web_contents->GetURL()); 229 web_contents->GetURL());
230 } 230 }
231 231
232 void AppBannerSettingsHelper::RecordBannerDismissEvent( 232 void AppBannerSettingsHelper::RecordBannerDismissEvent(
233 content::WebContents* web_contents, 233 content::WebContents* web_contents,
234 const std::string& package_name_or_start_url, 234 const std::string& package_name_or_start_url,
235 AppBannerRapporMetric rappor_metric) { 235 AppBannerRapporMetric rappor_metric) {
236 banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON); 236 banners::TrackDismissEvent(banners::DISMISS_EVENT_CLOSE_BUTTON);
237 237
238 AppBannerSettingsHelper::RecordBannerEvent( 238 AppBannerSettingsHelper::RecordBannerEvent(
239 web_contents, web_contents->GetURL(), package_name_or_start_url, 239 web_contents, web_contents->GetURL(), package_name_or_start_url,
240 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_BLOCK, 240 AppBannerSettingsHelper::APP_BANNER_EVENT_DID_BLOCK,
241 banners::AppBannerDataFetcher::GetCurrentTime()); 241 banners::AppBannerManager::GetCurrentTime());
242 242
243 rappor::SampleDomainAndRegistryFromGURL( 243 rappor::SampleDomainAndRegistryFromGURL(
244 g_browser_process->rappor_service(), 244 g_browser_process->rappor_service(),
245 (rappor_metric == WEB ? "AppBanner.WebApp.Dismissed" 245 (rappor_metric == WEB ? "AppBanner.WebApp.Dismissed"
246 : "AppBanner.NativeApp.Dismissed"), 246 : "AppBanner.NativeApp.Dismissed"),
247 web_contents->GetURL()); 247 web_contents->GetURL());
248 } 248 }
249 249
250 void AppBannerSettingsHelper::RecordBannerEvent( 250 void AppBannerSettingsHelper::RecordBannerEvent(
251 content::WebContents* web_contents, 251 content::WebContents* web_contents,
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 return true; 648 return true;
649 } 649 }
650 650
651 // Assume any value which is not "0" or "false" indicates that we should use 651 // Assume any value which is not "0" or "false" indicates that we should use
652 // site engagement. 652 // site engagement.
653 std::string param = variations::GetVariationParamValue( 653 std::string param = variations::GetVariationParamValue(
654 kBannerParamsKey, kBannerSiteEngagementParamsKey); 654 kBannerParamsKey, kBannerSiteEngagementParamsKey);
655 655
656 return (!param.empty() && param != "0" && param != "false"); 656 return (!param.empty() && param != "0" && param != "false");
657 } 657 }
OLDNEW
« no previous file with comments | « chrome/browser/banners/app_banner_manager_emulation.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698