OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/webui/options/reset_profile_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/reset_profile_settings_handler.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/google/google_util.h" | 13 #include "chrome/browser/google/google_util.h" |
14 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" | 14 #include "chrome/browser/profile_resetter/brandcode_config_fetcher.h" |
15 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" | 15 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" |
16 #include "chrome/browser/profile_resetter/profile_resetter.h" | 16 #include "chrome/browser/profile_resetter/profile_resetter.h" |
17 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 17 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
18 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
19 #include "chrome/common/pref_names.h" | 19 #include "chrome/common/pref_names.h" |
20 #include "content/public/browser/user_metrics.h" | 20 #include "content/public/browser/user_metrics.h" |
21 #include "content/public/browser/web_ui.h" | 21 #include "content/public/browser/web_ui.h" |
22 #include "grit/generated_resources.h" | 22 #include "grit/generated_resources.h" |
23 #include "ui/base/l10n/l10n_util.h" | 23 #include "ui/base/l10n/l10n_util.h" |
24 | 24 |
25 namespace { | 25 namespace { |
| 26 |
26 const char kResetProfileSettingsLearnMoreUrl[] = | 27 const char kResetProfileSettingsLearnMoreUrl[] = |
27 "https://support.google.com/chrome/?p=ui_reset_settings"; | 28 "https://support.google.com/chrome/?p=ui_reset_settings"; |
| 29 |
28 } // namespace | 30 } // namespace |
29 | 31 |
30 namespace options { | 32 namespace options { |
31 | 33 |
32 ResetProfileSettingsHandler::ResetProfileSettingsHandler() { | 34 ResetProfileSettingsHandler::ResetProfileSettingsHandler() { |
33 google_util::GetBrand(&brandcode_); | 35 google_util::GetBrand(&brandcode_); |
34 } | 36 } |
35 | 37 |
36 ResetProfileSettingsHandler::~ResetProfileSettingsHandler() { | 38 ResetProfileSettingsHandler::~ResetProfileSettingsHandler() { |
37 } | 39 } |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 setting_snapshot_->Subtract(current_snapshot); | 107 setting_snapshot_->Subtract(current_snapshot); |
106 std::string report = SerializeSettingsReport(*setting_snapshot_, | 108 std::string report = SerializeSettingsReport(*setting_snapshot_, |
107 difference); | 109 difference); |
108 SendSettingsFeedback(report, profile); | 110 SendSettingsFeedback(report, profile); |
109 } | 111 } |
110 setting_snapshot_.reset(); | 112 setting_snapshot_.reset(); |
111 } | 113 } |
112 } | 114 } |
113 | 115 |
114 void ResetProfileSettingsHandler::OnShowResetProfileDialog(const ListValue*) { | 116 void ResetProfileSettingsHandler::OnShowResetProfileDialog(const ListValue*) { |
| 117 DictionaryValue flashInfo; |
| 118 flashInfo.Set("feedbackInfo", GetReadableFeedback( |
| 119 ResettableSettingsSnapshot(Profile::FromWebUI(web_ui())))); |
| 120 web_ui()->CallJavascriptFunction( |
| 121 "ResetProfileSettingsOverlay.setFeedbackInfo", |
| 122 flashInfo); |
| 123 |
115 if (brandcode_.empty()) | 124 if (brandcode_.empty()) |
116 return; | 125 return; |
117 config_fetcher_.reset(new BrandcodeConfigFetcher( | 126 config_fetcher_.reset(new BrandcodeConfigFetcher( |
118 base::Bind(&ResetProfileSettingsHandler::OnSettingsFetched, | 127 base::Bind(&ResetProfileSettingsHandler::OnSettingsFetched, |
119 Unretained(this)), | 128 Unretained(this)), |
120 GURL("https://tools.google.com/service/update2"), | 129 GURL("https://tools.google.com/service/update2"), |
121 brandcode_)); | 130 brandcode_)); |
122 } | 131 } |
123 | 132 |
124 void ResetProfileSettingsHandler::OnSettingsFetched() { | 133 void ResetProfileSettingsHandler::OnSettingsFetched() { |
(...skipping 25 matching lines...) Expand all Loading... |
150 resetter_->Reset( | 159 resetter_->Reset( |
151 ProfileResetter::ALL, | 160 ProfileResetter::ALL, |
152 default_settings.Pass(), | 161 default_settings.Pass(), |
153 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone, | 162 base::Bind(&ResetProfileSettingsHandler::OnResetProfileSettingsDone, |
154 AsWeakPtr())); | 163 AsWeakPtr())); |
155 content::RecordAction(content::UserMetricsAction("ResetProfile")); | 164 content::RecordAction(content::UserMetricsAction("ResetProfile")); |
156 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); | 165 UMA_HISTOGRAM_BOOLEAN("ProfileReset.SendFeedback", send_settings); |
157 } | 166 } |
158 | 167 |
159 } // namespace options | 168 } // namespace options |
OLD | NEW |