Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / chrome / browser / metrics / windowed_incognito_observer.h
blob30dd43133d471db8925f70e56f8d3ba211220778
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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_
6 #define CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_
8 #include "base/macros.h"
9 #include "chrome/browser/ui/browser_list_observer.h"
11 class Browser;
13 namespace metrics {
15 // This class watches for any incognito window being opened from the time it is
16 // instantiated to the time it is destroyed.
17 class WindowedIncognitoObserver : public chrome::BrowserListObserver {
18 public:
19 WindowedIncognitoObserver();
20 ~WindowedIncognitoObserver() override;
22 // This method can be checked to see whether any incognito window has been
23 // opened since the time this object was created.
24 bool incognito_launched() const {
25 return incognito_launched_;
28 protected:
29 // For testing.
30 void set_incognito_launched(bool value) {
31 incognito_launched_ = value;
34 private:
35 // chrome::BrowserListObserver implementation.
36 void OnBrowserAdded(Browser* browser) override;
38 // Gets set if an incognito window was opened during the lifetime of the
39 // object. Closing the window does not clear the flag.
40 bool incognito_launched_;
42 DISALLOW_COPY_AND_ASSIGN(WindowedIncognitoObserver);
45 } // namespace metrics
47 #endif // CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_