forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
scoped_relaunch_chrome_browser_override.h
35 lines (26 loc) · 1.16 KB
/
scoped_relaunch_chrome_browser_override.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_BROWSER_FIRST_RUN_SCOPED_RELAUNCH_CHROME_BROWSER_OVERRIDE_H_
#define CHROME_BROWSER_FIRST_RUN_SCOPED_RELAUNCH_CHROME_BROWSER_OVERRIDE_H_
#include "base/callback.h"
#include "base/macros.h"
#include "chrome/browser/first_run/upgrade_util.h"
namespace upgrade_util {
// A test helper that overrides RelaunchChromeBrowser with a given callback for
// the lifetime of an instance. The previous callback (or none) is restored
// upon deletion.
class ScopedRelaunchChromeBrowserOverride {
public:
explicit ScopedRelaunchChromeBrowserOverride(
RelaunchChromeBrowserCallback callback);
ScopedRelaunchChromeBrowserOverride(
const ScopedRelaunchChromeBrowserOverride&) = delete;
ScopedRelaunchChromeBrowserOverride& operator=(
const ScopedRelaunchChromeBrowserOverride&) = delete;
~ScopedRelaunchChromeBrowserOverride();
private:
RelaunchChromeBrowserCallback previous_;
};
} // namespace upgrade_util
#endif // CHROME_BROWSER_FIRST_RUN_SCOPED_RELAUNCH_CHROME_BROWSER_OVERRIDE_H_