OLD | NEW |
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 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" | 5 #include "chrome/browser/profile_resetter/resettable_settings_snapshot.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 for (extensions::ExtensionSet::const_iterator it = enabled_ext.begin(); | 83 for (extensions::ExtensionSet::const_iterator it = enabled_ext.begin(); |
84 it != enabled_ext.end(); ++it) | 84 it != enabled_ext.end(); ++it) |
85 enabled_extensions_.push_back(std::make_pair((*it)->id(), (*it)->name())); | 85 enabled_extensions_.push_back(std::make_pair((*it)->id(), (*it)->name())); |
86 | 86 |
87 // ExtensionSet is sorted but it seems to be an implementation detail. | 87 // ExtensionSet is sorted but it seems to be an implementation detail. |
88 std::sort(enabled_extensions_.begin(), enabled_extensions_.end()); | 88 std::sort(enabled_extensions_.begin(), enabled_extensions_.end()); |
89 } | 89 } |
90 | 90 |
91 ResettableSettingsSnapshot::~ResettableSettingsSnapshot() { | 91 ResettableSettingsSnapshot::~ResettableSettingsSnapshot() { |
92 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 92 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
93 if (cancellation_flag_) | 93 if (cancellation_flag_.get()) |
94 cancellation_flag_->data.Set(); | 94 cancellation_flag_->data.Set(); |
95 } | 95 } |
96 | 96 |
97 void ResettableSettingsSnapshot::Subtract( | 97 void ResettableSettingsSnapshot::Subtract( |
98 const ResettableSettingsSnapshot& snapshot) { | 98 const ResettableSettingsSnapshot& snapshot) { |
99 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 99 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
100 ExtensionList extensions = base::STLSetDifference<ExtensionList>( | 100 ExtensionList extensions = base::STLSetDifference<ExtensionList>( |
101 enabled_extensions_, snapshot.enabled_extensions_); | 101 enabled_extensions_, snapshot.enabled_extensions_); |
102 enabled_extensions_.swap(extensions); | 102 enabled_extensions_.swap(extensions); |
103 } | 103 } |
(...skipping 23 matching lines...) Expand all Loading... |
127 | 127 |
128 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, | 128 COMPILE_ASSERT(ResettableSettingsSnapshot::ALL_FIELDS == 31, |
129 add_new_field_here); | 129 add_new_field_here); |
130 | 130 |
131 return bit_mask; | 131 return bit_mask; |
132 } | 132 } |
133 | 133 |
134 void ResettableSettingsSnapshot::RequestShortcuts( | 134 void ResettableSettingsSnapshot::RequestShortcuts( |
135 const base::Closure& callback) { | 135 const base::Closure& callback) { |
136 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 136 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
137 DCHECK(!cancellation_flag_ && !shortcuts_determined()); | 137 DCHECK(!cancellation_flag_.get() && !shortcuts_determined()); |
138 | 138 |
139 cancellation_flag_ = new SharedCancellationFlag; | 139 cancellation_flag_ = new SharedCancellationFlag; |
140 content::BrowserThread::PostTaskAndReplyWithResult( | 140 content::BrowserThread::PostTaskAndReplyWithResult( |
141 content::BrowserThread::FILE, | 141 content::BrowserThread::FILE, |
142 FROM_HERE, | 142 FROM_HERE, |
143 base::Bind(&GetChromeLaunchShortcuts, cancellation_flag_), | 143 base::Bind(&GetChromeLaunchShortcuts, cancellation_flag_), |
144 base::Bind(&ResettableSettingsSnapshot::SetShortcutsAndReport, | 144 base::Bind(&ResettableSettingsSnapshot::SetShortcutsAndReport, |
145 weak_ptr_factory_.GetWeakPtr(), | 145 weak_ptr_factory_.GetWeakPtr(), |
146 callback)); | 146 callback)); |
147 } | 147 } |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 extension_names += '\n'; | 348 extension_names += '\n'; |
349 extension_names += i->second; | 349 extension_names += i->second; |
350 } | 350 } |
351 if (!extension_names.empty()) { | 351 if (!extension_names.empty()) { |
352 AddPair(list.get(), | 352 AddPair(list.get(), |
353 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), | 353 l10n_util::GetStringUTF16(IDS_RESET_PROFILE_SETTINGS_EXTENSIONS), |
354 extension_names); | 354 extension_names); |
355 } | 355 } |
356 return list.Pass(); | 356 return list.Pass(); |
357 } | 357 } |
OLD | NEW |