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

Side by Side Diff: chrome/browser/ui/webui/options/reset_profile_settings_handler.h

Issue 62193002: Integrate UI and reset logic into AutomaticProfileResetter. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix Win compile error introduce by rebase. Created 7 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ 5 #ifndef CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ 6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "chrome/browser/ui/webui/options/options_ui.h" 10 #include "chrome/browser/ui/webui/options/options_ui.h"
11 11
12 namespace base { 12 namespace base {
13 class DictionaryValue; 13 class DictionaryValue;
14 class ListValue; 14 class ListValue;
15 } // namespace base 15 } // namespace base
16 16
17 class AutomaticProfileResetter;
17 class BrandcodeConfigFetcher; 18 class BrandcodeConfigFetcher;
18 class ProfileResetter; 19 class ProfileResetter;
19 class ResettableSettingsSnapshot; 20 class ResettableSettingsSnapshot;
20 21
21 namespace options { 22 namespace options {
22 23
23 // Reset Profile Settings handler page UI handler. 24 // Reset Profile Settings handler page UI handler.
24 class ResetProfileSettingsHandler 25 class ResetProfileSettingsHandler
25 : public OptionsPageUIHandler, 26 : public OptionsPageUIHandler,
26 public base::SupportsWeakPtr<ResetProfileSettingsHandler> { 27 public base::SupportsWeakPtr<ResetProfileSettingsHandler> {
27 public: 28 public:
28 ResetProfileSettingsHandler(); 29 ResetProfileSettingsHandler();
29 virtual ~ResetProfileSettingsHandler(); 30 virtual ~ResetProfileSettingsHandler();
30 31
31 // OptionsPageUIHandler implementation. 32 // OptionsPageUIHandler implementation.
32 virtual void GetLocalizedValues( 33 virtual void GetLocalizedValues(
33 base::DictionaryValue* localized_strings) OVERRIDE; 34 base::DictionaryValue* localized_strings) OVERRIDE;
34 virtual void InitializeHandler() OVERRIDE; 35 virtual void InitializeHandler() OVERRIDE;
35 virtual void InitializePage() OVERRIDE; 36 virtual void InitializePage() OVERRIDE;
37 virtual void Uninitialize() OVERRIDE;
36 38
37 // WebUIMessageHandler implementation. 39 // WebUIMessageHandler implementation.
38 virtual void RegisterMessages() OVERRIDE; 40 virtual void RegisterMessages() OVERRIDE;
39 41
40 private: 42 private:
41 // Javascript callback to start clearing data. 43 // Javascript callback to start clearing data.
42 void HandleResetProfileSettings(const base::ListValue* value); 44 void HandleResetProfileSettings(const base::ListValue* value);
43 45
44 // Closes the dialog once all requested settings has been reset. 46 // Closes the dialog once all requested settings has been reset.
45 void OnResetProfileSettingsDone(); 47 void OnResetProfileSettingsDone();
46 48
47 // Called when the confirmation box appears. 49 // Called when the confirmation box appears.
48 void OnShowResetProfileDialog(const base::ListValue* value); 50 void OnShowResetProfileDialog(const base::ListValue* value);
49 51
50 // Called when BrandcodeConfigFetcher completed fetching settings. 52 // Called when BrandcodeConfigFetcher completed fetching settings.
51 void OnSettingsFetched(); 53 void OnSettingsFetched();
52 54
53 // Resets profile settings to default values. |send_settings| is true if user 55 // Resets profile settings to default values. |send_settings| is true if user
54 // gave his consent to upload broken settings to Google for analysis. 56 // gave his consent to upload broken settings to Google for analysis.
55 void ResetProfile(bool send_settings); 57 void ResetProfile(bool send_settings);
56 58
59 // Destroyed with the Profile, thus it should outlive us.
60 AutomaticProfileResetter* automatic_profile_resetter_;
61
62 // Records whether or not the Profile Reset confirmation dialog was opened at
63 // least once during the lifetime of the settings page.
64 bool has_shown_confirmation_dialog_;
65
57 scoped_ptr<ProfileResetter> resetter_; 66 scoped_ptr<ProfileResetter> resetter_;
58 67
59 scoped_ptr<BrandcodeConfigFetcher> config_fetcher_; 68 scoped_ptr<BrandcodeConfigFetcher> config_fetcher_;
60 69
61 // Snapshot of settings before profile was reseted. 70 // Snapshot of settings before profile was reseted.
62 scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_; 71 scoped_ptr<ResettableSettingsSnapshot> setting_snapshot_;
63 72
64 // Contains Chrome brand code; empty for organic Chrome. 73 // Contains Chrome brand code; empty for organic Chrome.
65 std::string brandcode_; 74 std::string brandcode_;
66 75
67 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler); 76 DISALLOW_COPY_AND_ASSIGN(ResetProfileSettingsHandler);
68 }; 77 };
69 78
70 } // namespace options 79 } // namespace options
71 80
72 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_ 81 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS_RESET_PROFILE_SETTINGS_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698