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

Side by Side Diff: chrome/browser/ui/passwords/password_manager_url_collection_experiment.cc

Issue 777423004: Skeleton code for experiment setup, which will determine should "Allow to collect URL?" bubble be s… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/passwords/password_manager_url_collection_experiment .h"
6
7 #include "base/metrics/field_trial.h"
8 #include "base/prefs/pref_service.h"
9 #include "chrome/common/pref_names.h"
10 #include "components/pref_registry/pref_registry_syncable.h"
11
12 namespace password_manager {
13 namespace urls_collection_experiment {
14
15 namespace {
16
17 bool MaybeShowBubbleExperiment(PrefService* prefs) {
18 // TODO(melandory): Make decision based on Finch experiment parameters.
19 return false;
20 }
21
22 } // namespace
23
24 void RegisterPrefs(user_prefs::PrefRegistrySyncable* registry) {
25 registry->RegisterBooleanPref(
26 ::prefs::kWasAllowToCollectURLBubbleShown,
27 false, // bubble hasn't been shown yet
28 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF);
29 }
30
31 const char kExperimentName[] = "AksToSubmitURLBubble";
32 const char kGroupMaybeShowBubble[] = "ShowBubble";
33 const char kGroupNeverShowBubble[] = "NeverShowBubble";
34
35 bool ShouldShowBubble(PrefService* prefs) {
36 if (prefs->GetBoolean(::prefs::kWasAllowToCollectURLBubbleShown)) {
37 if (!base::FieldTrialList::TrialExists(kExperimentName))
38 return false;
39 std::string group_name =
40 base::FieldTrialList::FindFullName(kExperimentName);
41 if (group_name == kGroupMaybeShowBubble)
42 return MaybeShowBubbleExperiment(prefs);
43 }
44 // "Do not show" is the default case.
45 return false;
46 }
47
48 void RecordBubbleClosed(PrefService* prefs) {
49 prefs->SetBoolean(::prefs::kWasAllowToCollectURLBubbleShown, true);
50 }
51
52 } // namespace urls_collection_experiment
53 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698