-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- This is a first CL for adding client side config of ScalableIph. More config will be added with following CLs. Bug: b:308010596 Test: na Change-Id: I45b627063a39777122fd56543ad3b41d0d532966 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4982366 Reviewed-by: Tommy Nyquist <nyquist@chromium.org> Commit-Queue: Yuki Awano <yawano@google.com> Reviewed-by: Angela Xiao <angelaxiao@chromium.org> Cr-Commit-Position: refs/heads/main@{#1216476}
- Loading branch information
Yuki Awano
authored and
Chromium LUCI CQ
committed
Oct 28, 2023
1 parent
9e2f74e
commit 27dc06c
Showing
12 changed files
with
239 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "chromeos/ash/components/scalable_iph/config.h" | ||
|
||
#include "ash/constants/ash_features.h" | ||
#include "components/feature_engagement/public/feature_constants.h" | ||
|
||
namespace scalable_iph { | ||
|
||
Config::Config() = default; | ||
Config::~Config() = default; | ||
|
||
std::unique_ptr<Config> GetConfig(const base::Feature& feature) { | ||
if (!ash::features::IsScalableIphClientConfigEnabled()) { | ||
return nullptr; | ||
} | ||
|
||
if (&feature == &feature_engagement::kIPHScalableIphHelpAppBasedOneFeature) { | ||
std::unique_ptr<Config> config = std::make_unique<Config>(); | ||
config->version_number = kCurrentVersionNumber; | ||
config->ui_type = UiType::kNone; | ||
return config; | ||
} | ||
|
||
// TODO(b/308010596): Move other config. | ||
|
||
return nullptr; | ||
} | ||
|
||
} // namespace scalable_iph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_CONFIG_H_ | ||
#define CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_CONFIG_H_ | ||
|
||
#include "chromeos/ash/components/scalable_iph/scalable_iph_delegate.h" | ||
|
||
namespace scalable_iph { | ||
|
||
struct Config { | ||
Config(); | ||
~Config(); | ||
int version_number; | ||
UiType ui_type; | ||
std::unique_ptr<ScalableIphDelegate::NotificationParams> notification_params; | ||
std::unique_ptr<ScalableIphDelegate::BubbleParams> bubble_params; | ||
}; | ||
|
||
std::unique_ptr<Config> GetConfig(const base::Feature& feature); | ||
|
||
} // namespace scalable_iph | ||
|
||
#endif // CHROMEOS_ASH_COMPONENTS_SCALABLE_IPH_CONFIG_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
include_rules = [ | ||
"+components/feature_engagement/features.h", | ||
] | ||
|
||
specific_include_rules = { | ||
"scalable_iph_feature_configurations.*": [ | ||
"+ash/constants/ash_features.h", | ||
"+chromeos/ash/components/scalable_iph/scalable_iph_constants.h", | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
per-file ios_promo_feature_configuration*=file://ios/chrome/browser/promos_manager/OWNERS | ||
per-file scalable_iph_feature_configurations*=file://chromeos/ash/components/scalable_iph/OWNERS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
components/feature_engagement/public/scalable_iph_feature_configurations.cc
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "components/feature_engagement/public/scalable_iph_feature_configurations.h" | ||
|
||
#include "ash/constants/ash_features.h" | ||
#include "chromeos/ash/components/scalable_iph/scalable_iph_constants.h" | ||
#include "components/feature_engagement/public/configuration.h" | ||
#include "components/feature_engagement/public/feature_constants.h" | ||
|
||
namespace feature_engagement { | ||
namespace { | ||
absl::optional<FeatureConfig> GetBaseConfig() { | ||
absl::optional<FeatureConfig> config = FeatureConfig(); | ||
config->valid = true; | ||
config->availability = Comparator(ANY, 0); | ||
config->session_rate = Comparator(ANY, 0); | ||
config->session_rate_impact.type = SessionRateImpact::Type::NONE; | ||
config->blocked_by.type = BlockedBy::Type::NONE; | ||
config->blocking.type = Blocking::Type::NONE; | ||
return config; | ||
} | ||
|
||
bool IsTrackingOnly() { | ||
return ash::features::IsScalableIphTrackingOnlyEnabled(); | ||
} | ||
} // namespace | ||
|
||
absl::optional<FeatureConfig> GetScalableIphFeatureConfig( | ||
const base::Feature* feature) { | ||
if (!ash::features::IsScalableIphClientConfigEnabled()) { | ||
return absl::nullopt; | ||
} | ||
|
||
if (kIPHScalableIphHelpAppBasedOneFeature.name == feature->name) { | ||
absl::optional<FeatureConfig> config = GetBaseConfig(); | ||
config->used = | ||
EventConfig(scalable_iph::kEventNameHelpAppActionTypeOpenChrome, | ||
Comparator(ANY, 0), 7, 8); | ||
config->trigger = EventConfig("ScalableIphHelpAppBasedOneTriggerNotUsed", | ||
Comparator(EQUAL, 0), 7, 8); | ||
|
||
config->tracking_only = IsTrackingOnly(); | ||
return config; | ||
} | ||
|
||
// TODO(b/308010596): Move other config. | ||
|
||
return absl::nullopt; | ||
} | ||
|
||
} // namespace feature_engagement |
20 changes: 20 additions & 0 deletions
20
components/feature_engagement/public/scalable_iph_feature_configurations.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef COMPONENTS_FEATURE_ENGAGEMENT_PUBLIC_SCALABLE_IPH_FEATURE_CONFIGURATIONS_H_ | ||
#define COMPONENTS_FEATURE_ENGAGEMENT_PUBLIC_SCALABLE_IPH_FEATURE_CONFIGURATIONS_H_ | ||
|
||
#include "base/feature_list.h" | ||
#include "third_party/abseil-cpp/absl/types/optional.h" | ||
|
||
namespace feature_engagement { | ||
|
||
struct FeatureConfig; | ||
|
||
absl::optional<FeatureConfig> GetScalableIphFeatureConfig( | ||
const base::Feature* feature); | ||
|
||
} // namespace feature_engagement | ||
|
||
#endif // COMPONENTS_FEATURE_ENGAGEMENT_PUBLIC_SCALABLE_IPH_FEATURE_CONFIGURATIONS_H_ |