Chromium Code Reviews| 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/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 16 matching lines...) Expand all Loading... | |
| 27 #include "components/search_engines/search_engines_pref_names.h" | 27 #include "components/search_engines/search_engines_pref_names.h" |
| 28 #include "components/search_engines/template_url_prepopulate_data.h" | 28 #include "components/search_engines/template_url_prepopulate_data.h" |
| 29 #include "components/search_engines/template_url_service.h" | 29 #include "components/search_engines/template_url_service.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "extensions/browser/extension_system.h" | 31 #include "extensions/browser/extension_system.h" |
| 32 #include "extensions/browser/management_policy.h" | 32 #include "extensions/browser/management_policy.h" |
| 33 | 33 |
| 34 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 35 #include "base/base_paths.h" | 35 #include "base/base_paths.h" |
| 36 #include "base/path_service.h" | 36 #include "base/path_service.h" |
| 37 #include "chrome/browser/component_updater/sw_reporter_installer_win.h" | |
|
MAD
2014/08/22 18:14:51
You should also be able to remove
#include "chrom
csharp
2014/08/22 19:39:22
Done.
| |
| 38 #include "chrome/installer/util/shell_util.h" | 37 #include "chrome/installer/util/shell_util.h" |
| 39 | 38 |
| 40 namespace { | 39 namespace { |
| 41 | 40 |
| 42 void ResetShortcutsOnFileThread() { | 41 void ResetShortcutsOnFileThread() { |
| 43 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); | 42 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::FILE)); |
| 44 // Get full path of chrome. | 43 // Get full path of chrome. |
| 45 base::FilePath chrome_exe; | 44 base::FilePath chrome_exe; |
| 46 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) | 45 if (!PathService::Get(base::FILE_EXE, &chrome_exe)) |
| 47 return; | 46 return; |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 119 }; | 118 }; |
| 120 | 119 |
| 121 ResettableFlags reset_triggered_for_flags = 0; | 120 ResettableFlags reset_triggered_for_flags = 0; |
| 122 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(flagToMethod); ++i) { | 121 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(flagToMethod); ++i) { |
| 123 if (resettable_flags & flagToMethod[i].flag) { | 122 if (resettable_flags & flagToMethod[i].flag) { |
| 124 reset_triggered_for_flags |= flagToMethod[i].flag; | 123 reset_triggered_for_flags |= flagToMethod[i].flag; |
| 125 (this->*flagToMethod[i].method)(); | 124 (this->*flagToMethod[i].method)(); |
| 126 } | 125 } |
| 127 } | 126 } |
| 128 | 127 |
| 129 // When the user resets any of their settings on Windows and agreed to sending | |
| 130 // feedback, run the software reporter tool to see if it could find the reason | |
| 131 // why the user wanted a reset. | |
| 132 #if defined(OS_WIN) | |
| 133 // The browser process and / or local_state can be NULL when running tests. | |
| 134 if (accepted_send_feedback && g_browser_process && | |
| 135 g_browser_process->local_state() && | |
| 136 g_browser_process->local_state()->GetBoolean( | |
| 137 prefs::kMetricsReportingEnabled)) { | |
| 138 ExecuteSwReporter(g_browser_process->component_updater(), | |
| 139 g_browser_process->local_state()); | |
| 140 } | |
| 141 #endif | |
| 142 | |
|
waffles
2014/08/22 18:52:53
With this code now gone, how does a user initially
MAD
2014/08/22 19:02:09
ExecuteSwReporter is now called when it wasn't cal
| |
| 143 DCHECK_EQ(resettable_flags, reset_triggered_for_flags); | 128 DCHECK_EQ(resettable_flags, reset_triggered_for_flags); |
| 144 } | 129 } |
| 145 | 130 |
| 146 bool ProfileResetter::IsActive() const { | 131 bool ProfileResetter::IsActive() const { |
| 147 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 132 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
| 148 return pending_reset_flags_ != 0; | 133 return pending_reset_flags_ != 0; |
| 149 } | 134 } |
| 150 | 135 |
| 151 void ProfileResetter::MarkAsDone(Resettable resettable) { | 136 void ProfileResetter::MarkAsDone(Resettable resettable) { |
| 152 DCHECK(CalledOnValidThread()); | 137 DCHECK(CalledOnValidThread()); |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 364 chrome_exe, | 349 chrome_exe, |
| 365 false, | 350 false, |
| 366 cancel, | 351 cancel, |
| 367 &shortcuts); | 352 &shortcuts); |
| 368 } | 353 } |
| 369 return shortcuts; | 354 return shortcuts; |
| 370 #else | 355 #else |
| 371 return std::vector<ShortcutCommand>(); | 356 return std::vector<ShortcutCommand>(); |
| 372 #endif | 357 #endif |
| 373 } | 358 } |
| OLD | NEW |