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

Side by Side Diff: chrome/browser/safe_browsing/srt_fetcher_win.cc

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix more errors Created 5 years, 4 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/safe_browsing/srt_fetcher_win.h" 5 #include "chrome/browser/safe_browsing/srt_fetcher_win.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 148
149 DISALLOW_COPY_AND_ASSIGN(SRTFetcher); 149 DISALLOW_COPY_AND_ASSIGN(SRTFetcher);
150 }; 150 };
151 151
152 // This class tries to run the reporter and reacts to its exit code. It 152 // This class tries to run the reporter and reacts to its exit code. It
153 // schedules subsequent runs as needed, or retries as soon as a browser is 153 // schedules subsequent runs as needed, or retries as soon as a browser is
154 // available when none is on first try. 154 // available when none is on first try.
155 class ReporterRunner : public chrome::BrowserListObserver { 155 class ReporterRunner : public chrome::BrowserListObserver {
156 public: 156 public:
157 static ReporterRunner* GetInstance() { 157 static ReporterRunner* GetInstance() {
158 return Singleton<ReporterRunner, 158 return base::Singleton<ReporterRunner,
159 LeakySingletonTraits<ReporterRunner>>::get(); 159 base::LeakySingletonTraits<ReporterRunner>>::get();
160 } 160 }
161 161
162 // Starts the sequence of attempts to run the reporter. 162 // Starts the sequence of attempts to run the reporter.
163 void Run(const base::FilePath& exe_path, const std::string& version) { 163 void Run(const base::FilePath& exe_path, const std::string& version) {
164 DCHECK_CURRENTLY_ON(BrowserThread::UI); 164 DCHECK_CURRENTLY_ON(BrowserThread::UI);
165 exe_path_ = exe_path; 165 exe_path_ = exe_path;
166 version_ = version; 166 version_ = version;
167 TryToRun(); 167 TryToRun();
168 } 168 }
169 169
170 private: 170 private:
171 friend struct DefaultSingletonTraits<ReporterRunner>; 171 friend struct base::DefaultSingletonTraits<ReporterRunner>;
172 ReporterRunner() {} 172 ReporterRunner() {}
173 ~ReporterRunner() override {} 173 ~ReporterRunner() override {}
174 174
175 // BrowserListObserver. 175 // BrowserListObserver.
176 void OnBrowserSetLastActive(Browser* browser) override {} 176 void OnBrowserSetLastActive(Browser* browser) override {}
177 void OnBrowserRemoved(Browser* browser) override {} 177 void OnBrowserRemoved(Browser* browser) override {}
178 void OnBrowserAdded(Browser* browser) override { 178 void OnBrowserAdded(Browser* browser) override {
179 DCHECK(browser); 179 DCHECK(browser);
180 if (browser->host_desktop_type() == chrome::GetActiveDesktop()) { 180 if (browser->host_desktop_type() == chrome::GetActiveDesktop()) {
181 MaybeFetchSRT(browser); 181 MaybeFetchSRT(browser);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 }; 345 };
346 346
347 } // namespace 347 } // namespace
348 348
349 void RunSwReporter(const base::FilePath& exe_path, const std::string& version) { 349 void RunSwReporter(const base::FilePath& exe_path, const std::string& version) {
350 DCHECK_CURRENTLY_ON(BrowserThread::UI); 350 DCHECK_CURRENTLY_ON(BrowserThread::UI);
351 ReporterRunner::GetInstance()->Run(exe_path, version); 351 ReporterRunner::GetInstance()->Run(exe_path, version);
352 } 352 }
353 353
354 } // namespace safe_browsing 354 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698