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

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

Issue 1107863002: [chrome/browser/profile_resetter] favor DCHECK_CURRENTLY_ON for better logs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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 (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/profile_resetter.h" 5 #include "chrome/browser/profile_resetter/profile_resetter.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/prefs/pref_service.h" 9 #include "base/prefs/pref_service.h"
10 #include "base/prefs/scoped_user_pref_update.h" 10 #include "base/prefs/scoped_user_pref_update.h"
(...skipping 19 matching lines...) Expand all
30 #include "extensions/browser/management_policy.h" 30 #include "extensions/browser/management_policy.h"
31 31
32 #if defined(OS_WIN) 32 #if defined(OS_WIN)
33 #include "base/base_paths.h" 33 #include "base/base_paths.h"
34 #include "base/path_service.h" 34 #include "base/path_service.h"
35 #include "chrome/installer/util/shell_util.h" 35 #include "chrome/installer/util/shell_util.h"
36 36
37 namespace { 37 namespace {
38 38
39 void ResetShortcutsOnFileThread() { 39 void ResetShortcutsOnFileThread() {
40 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 40 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
41 // Get full path of chrome. 41 // Get full path of chrome.
42 base::FilePath chrome_exe; 42 base::FilePath chrome_exe;
43 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) 43 if (!PathService::Get(base::FILE_EXE, &chrome_exe))
44 return; 44 return;
45 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 45 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
46 BrowserDistribution::CHROME_BROWSER); 46 BrowserDistribution::CHROME_BROWSER);
47 for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST; 47 for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST;
48 location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) { 48 location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) {
49 ShellUtil::ShortcutListMaybeRemoveUnknownArgs( 49 ShellUtil::ShortcutListMaybeRemoveUnknownArgs(
50 static_cast<ShellUtil::ShortcutLocation>(location), 50 static_cast<ShellUtil::ShortcutLocation>(location),
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 if (resettable_flags & flagToMethod[i].flag) { 120 if (resettable_flags & flagToMethod[i].flag) {
121 reset_triggered_for_flags |= flagToMethod[i].flag; 121 reset_triggered_for_flags |= flagToMethod[i].flag;
122 (this->*flagToMethod[i].method)(); 122 (this->*flagToMethod[i].method)();
123 } 123 }
124 } 124 }
125 125
126 DCHECK_EQ(resettable_flags, reset_triggered_for_flags); 126 DCHECK_EQ(resettable_flags, reset_triggered_for_flags);
127 } 127 }
128 128
129 bool ProfileResetter::IsActive() const { 129 bool ProfileResetter::IsActive() const {
130 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 130 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
131 return pending_reset_flags_ != 0; 131 return pending_reset_flags_ != 0;
132 } 132 }
133 133
134 void ProfileResetter::MarkAsDone(Resettable resettable) { 134 void ProfileResetter::MarkAsDone(Resettable resettable) {
135 DCHECK(CalledOnValidThread()); 135 DCHECK(CalledOnValidThread());
136 136
137 // Check that we are never called twice or unexpectedly. 137 // Check that we are never called twice or unexpectedly.
138 CHECK(pending_reset_flags_ & resettable); 138 CHECK(pending_reset_flags_ & resettable);
139 139
140 pending_reset_flags_ &= ~resettable; 140 pending_reset_flags_ &= ~resettable;
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 ResetDefaultSearchEngine(); 319 ResetDefaultSearchEngine();
320 } 320 }
321 321
322 void ProfileResetter::OnBrowsingDataRemoverDone() { 322 void ProfileResetter::OnBrowsingDataRemoverDone() {
323 cookies_remover_ = NULL; 323 cookies_remover_ = NULL;
324 MarkAsDone(COOKIES_AND_SITE_DATA); 324 MarkAsDone(COOKIES_AND_SITE_DATA);
325 } 325 }
326 326
327 std::vector<ShortcutCommand> GetChromeLaunchShortcuts( 327 std::vector<ShortcutCommand> GetChromeLaunchShortcuts(
328 const scoped_refptr<SharedCancellationFlag>& cancel) { 328 const scoped_refptr<SharedCancellationFlag>& cancel) {
329 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); 329 DCHECK_CURRENTLY_ON(content::BrowserThread::FILE);
330 #if defined(OS_WIN) 330 #if defined(OS_WIN)
331 // Get full path of chrome. 331 // Get full path of chrome.
332 base::FilePath chrome_exe; 332 base::FilePath chrome_exe;
333 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) 333 if (!PathService::Get(base::FILE_EXE, &chrome_exe))
334 return std::vector<ShortcutCommand>(); 334 return std::vector<ShortcutCommand>();
335 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution( 335 BrowserDistribution* dist = BrowserDistribution::GetSpecificDistribution(
336 BrowserDistribution::CHROME_BROWSER); 336 BrowserDistribution::CHROME_BROWSER);
337 std::vector<ShortcutCommand> shortcuts; 337 std::vector<ShortcutCommand> shortcuts;
338 for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST; 338 for (int location = ShellUtil::SHORTCUT_LOCATION_FIRST;
339 location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) { 339 location < ShellUtil::NUM_SHORTCUT_LOCATIONS; ++location) {
340 if (cancel.get() && cancel->data.IsSet()) 340 if (cancel.get() && cancel->data.IsSet())
341 break; 341 break;
342 ShellUtil::ShortcutListMaybeRemoveUnknownArgs( 342 ShellUtil::ShortcutListMaybeRemoveUnknownArgs(
343 static_cast<ShellUtil::ShortcutLocation>(location), 343 static_cast<ShellUtil::ShortcutLocation>(location),
344 dist, 344 dist,
345 ShellUtil::CURRENT_USER, 345 ShellUtil::CURRENT_USER,
346 chrome_exe, 346 chrome_exe,
347 false, 347 false,
348 cancel, 348 cancel,
349 &shortcuts); 349 &shortcuts);
350 } 350 }
351 return shortcuts; 351 return shortcuts;
352 #else 352 #else
353 return std::vector<ShortcutCommand>(); 353 return std::vector<ShortcutCommand>();
354 #endif 354 #endif
355 } 355 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698