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

Side by Side Diff: chrome/browser/profile_resetter/profile_resetter.h

Issue 2908143004: Replace deprecated base::NonThreadSafe in chrome/browser/profile_resetter in favor of SequenceCheck… (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/profile_resetter/profile_resetter.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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_PROFILE_RESETTER_PROFILE_RESETTER_H_ 5 #ifndef CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_
6 #define CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_ 6 #define CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ref_counted.h" 17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h" 18 #include "base/memory/weak_ptr.h"
19 #include "base/sequence_checker.h"
19 #include "base/strings/string16.h" 20 #include "base/strings/string16.h"
20 #include "base/threading/non_thread_safe.h"
21 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h" 21 #include "chrome/browser/profile_resetter/brandcoded_default_settings.h"
22 #include "components/search_engines/template_url_service.h" 22 #include "components/search_engines/template_url_service.h"
23 #include "content/public/browser/browsing_data_remover.h" 23 #include "content/public/browser/browsing_data_remover.h"
24 24
25 class Profile; 25 class Profile;
26 26
27 namespace base { 27 namespace base {
28 class CancellationFlag; 28 class CancellationFlag;
29 } 29 }
30 30
31 // This class allows resetting certain aspects of a profile to default values. 31 // This class allows resetting certain aspects of a profile to default values.
32 // It is used in case the profile has been damaged due to malware or bad user 32 // It is used in case the profile has been damaged due to malware or bad user
33 // settings. 33 // settings.
34 class ProfileResetter : public base::NonThreadSafe, 34 class ProfileResetter : public content::BrowsingDataRemover::Observer {
35 public content::BrowsingDataRemover::Observer {
36 public: 35 public:
37 // Flags indicating what aspects of a profile shall be reset. 36 // Flags indicating what aspects of a profile shall be reset.
38 enum Resettable { 37 enum Resettable {
39 DEFAULT_SEARCH_ENGINE = 1 << 0, 38 DEFAULT_SEARCH_ENGINE = 1 << 0,
40 HOMEPAGE = 1 << 1, 39 HOMEPAGE = 1 << 1,
41 CONTENT_SETTINGS = 1 << 2, 40 CONTENT_SETTINGS = 1 << 2,
42 COOKIES_AND_SITE_DATA = 1 << 3, 41 COOKIES_AND_SITE_DATA = 1 << 3,
43 EXTENSIONS = 1 << 4, 42 EXTENSIONS = 1 << 4,
44 STARTUP_PAGES = 1 << 5, 43 STARTUP_PAGES = 1 << 5,
45 PINNED_TABS = 1 << 6, 44 PINNED_TABS = 1 << 6,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 98
100 // Called on UI thread when reset has been completed. 99 // Called on UI thread when reset has been completed.
101 base::Closure callback_; 100 base::Closure callback_;
102 101
103 // If non-null it means removal is in progress. BrowsingDataRemover takes care 102 // If non-null it means removal is in progress. BrowsingDataRemover takes care
104 // of deleting itself when done. 103 // of deleting itself when done.
105 content::BrowsingDataRemover* cookies_remover_; 104 content::BrowsingDataRemover* cookies_remover_;
106 105
107 std::unique_ptr<TemplateURLService::Subscription> template_url_service_sub_; 106 std::unique_ptr<TemplateURLService::Subscription> template_url_service_sub_;
108 107
108 SEQUENCE_CHECKER(sequence_checker_);
109
109 base::WeakPtrFactory<ProfileResetter> weak_ptr_factory_; 110 base::WeakPtrFactory<ProfileResetter> weak_ptr_factory_;
110 111
111 DISALLOW_COPY_AND_ASSIGN(ProfileResetter); 112 DISALLOW_COPY_AND_ASSIGN(ProfileResetter);
112 }; 113 };
113 114
114 // Path to shortcut and command line arguments. 115 // Path to shortcut and command line arguments.
115 typedef std::pair<base::FilePath, base::string16> ShortcutCommand; 116 typedef std::pair<base::FilePath, base::string16> ShortcutCommand;
116 117
117 typedef base::RefCountedData<base::CancellationFlag> SharedCancellationFlag; 118 typedef base::RefCountedData<base::CancellationFlag> SharedCancellationFlag;
118 119
119 // On Windows returns all the shortcuts which launch Chrome and corresponding 120 // On Windows returns all the shortcuts which launch Chrome and corresponding
120 // arguments. |cancel| can be passed to abort the operation earlier. 121 // arguments. |cancel| can be passed to abort the operation earlier.
121 // Call on FILE thread. 122 // Call on FILE thread.
122 std::vector<ShortcutCommand> GetChromeLaunchShortcuts( 123 std::vector<ShortcutCommand> GetChromeLaunchShortcuts(
123 const scoped_refptr<SharedCancellationFlag>& cancel); 124 const scoped_refptr<SharedCancellationFlag>& cancel);
124 125
125 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_ 126 #endif // CHROME_BROWSER_PROFILE_RESETTER_PROFILE_RESETTER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/profile_resetter/profile_resetter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698