| Index: chrome/browser/metrics/windowed_incognito_observer.h
|
| diff --git a/chrome/browser/metrics/windowed_incognito_observer.h b/chrome/browser/metrics/windowed_incognito_observer.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..30dd43133d471db8925f70e56f8d3ba211220778
|
| --- /dev/null
|
| +++ b/chrome/browser/metrics/windowed_incognito_observer.h
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2015 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_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_
|
| +#define CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "chrome/browser/ui/browser_list_observer.h"
|
| +
|
| +class Browser;
|
| +
|
| +namespace metrics {
|
| +
|
| +// This class watches for any incognito window being opened from the time it is
|
| +// instantiated to the time it is destroyed.
|
| +class WindowedIncognitoObserver : public chrome::BrowserListObserver {
|
| + public:
|
| + WindowedIncognitoObserver();
|
| + ~WindowedIncognitoObserver() override;
|
| +
|
| + // This method can be checked to see whether any incognito window has been
|
| + // opened since the time this object was created.
|
| + bool incognito_launched() const {
|
| + return incognito_launched_;
|
| + }
|
| +
|
| + protected:
|
| + // For testing.
|
| + void set_incognito_launched(bool value) {
|
| + incognito_launched_ = value;
|
| + }
|
| +
|
| + private:
|
| + // chrome::BrowserListObserver implementation.
|
| + void OnBrowserAdded(Browser* browser) override;
|
| +
|
| + // Gets set if an incognito window was opened during the lifetime of the
|
| + // object. Closing the window does not clear the flag.
|
| + bool incognito_launched_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WindowedIncognitoObserver);
|
| +};
|
| +
|
| +} // namespace metrics
|
| +
|
| +#endif // CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_
|
|
|