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

Side by Side Diff: chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prompt_config.cc

Issue 2701313002: Adds a modal dialog implementation of the settings reset prompt. (Closed)
Patch Set: Fix constness in mock test class Created 3 years, 10 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/safe_browsing/settings_reset_prompt/settings_reset_prom pt_config.h" 5 #include "chrome/browser/safe_browsing/settings_reset_prompt/settings_reset_prom pt_config.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
11 #include "base/metrics/field_trial_params.h" 11 #include "base/metrics/field_trial_params.h"
12 #include "base/metrics/histogram_macros.h" 12 #include "base/metrics/histogram_macros.h"
13 #include "base/strings/string_number_conversions.h" 13 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_piece.h" 14 #include "base/strings/string_piece.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/values.h" 16 #include "base/values.h"
17 #include "components/url_formatter/url_fixer.h" 17 #include "components/url_formatter/url_fixer.h"
18 #include "crypto/sha2.h" 18 #include "crypto/sha2.h"
19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" 19 #include "net/base/registry_controlled_domains/registry_controlled_domain.h"
20 #include "url/gurl.h" 20 #include "url/gurl.h"
21 21
22 namespace safe_browsing { 22 namespace safe_browsing {
23 23
24 namespace { 24 namespace {
25 25
26 constexpr char kSettingsResetPromptFeatureName[] = "SettingsResetPrompt"; 26 constexpr char kSettingsResetPromptFeatureName[] = "SettingsResetPrompt";
27 27
28 bool IsPromptEnabled() {
29 return base::FeatureList::IsEnabled(kSettingsResetPrompt);
30 }
31
28 } // namespace. 32 } // namespace.
29 33
30 const base::Feature kSettingsResetPrompt{kSettingsResetPromptFeatureName, 34 const base::Feature kSettingsResetPrompt{kSettingsResetPromptFeatureName,
31 base::FEATURE_DISABLED_BY_DEFAULT}; 35 base::FEATURE_DISABLED_BY_DEFAULT};
32 36
33 // static 37 // static
34 bool SettingsResetPromptConfig::IsPromptEnabled() {
35 // TODO(alito): Add prefs to local state to track when the user was
36 // last prompted and ensure that we only prompt once per reset prompt
37 // wave.
38 return base::FeatureList::IsEnabled(kSettingsResetPrompt);
39 }
40
41 // static
42 std::unique_ptr<SettingsResetPromptConfig> SettingsResetPromptConfig::Create() { 38 std::unique_ptr<SettingsResetPromptConfig> SettingsResetPromptConfig::Create() {
43 if (!IsPromptEnabled()) 39 if (!IsPromptEnabled())
44 return nullptr; 40 return nullptr;
45 41
46 auto prompt_config = base::WrapUnique(new SettingsResetPromptConfig()); 42 auto prompt_config = base::WrapUnique(new SettingsResetPromptConfig());
47 if (!prompt_config->Init()) 43 if (!prompt_config->Init())
48 return nullptr; 44 return nullptr;
49 45
50 return prompt_config; 46 return prompt_config;
51 } 47 }
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 221
226 if (!domain_hashes_.insert(std::make_pair(std::move(hash), domain_id)) 222 if (!domain_hashes_.insert(std::make_pair(std::move(hash), domain_id))
227 .second) 223 .second)
228 return CONFIG_ERROR_DUPLICATE_DOMAIN_HASH; 224 return CONFIG_ERROR_DUPLICATE_DOMAIN_HASH;
229 } 225 }
230 226
231 return CONFIG_ERROR_OK; 227 return CONFIG_ERROR_OK;
232 } 228 }
233 229
234 } // namespace safe_browsing. 230 } // namespace safe_browsing.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698