Chromium Code Reviews| 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..d12ebc6efa39bfe64ed3ed28a6029060242d5975 | 
| --- /dev/null | 
| +++ b/chrome/browser/metrics/windowed_incognito_observer.h | 
| @@ -0,0 +1,40 @@ | 
| +// 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 "chrome/browser/ui/browser_list_observer.h" | 
| + | 
| +class Browser; | 
| + | 
| +namespace metrics { | 
| + | 
| +// This class must be created and used on the UI thread. It watches for any | 
| 
 
Ilya Sherman
2015/07/02 00:40:16
nit: I'd omit the sentence about being used on the
 
Simon Que
2015/07/02 18:53:02
Done.
 
 | 
| +// incognito window being opened from the time it is instantiated to the time it | 
| +// is destroyed. | 
| +class WindowedIncognitoObserver : public chrome::BrowserListObserver { | 
| + public: | 
| + WindowedIncognitoObserver(); | 
| + virtual ~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: | 
| + // 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_; | 
| 
 
Ilya Sherman
2015/07/02 00:40:16
Class members should always be private (outside of
 
Simon Que
2015/07/02 18:53:02
Done.
 
 | 
| + | 
| + private: | 
| + // chrome::BrowserListObserver implementation. | 
| + void OnBrowserAdded(Browser* browser) override; | 
| +}; | 
| 
 
Ilya Sherman
2015/07/02 00:40:16
nit: DISALLOW_COPY_AND_ASSIGN
 
Simon Que
2015/07/02 18:53:02
Done.
 
 | 
| + | 
| +} // namespace metrics | 
| + | 
| +#endif // CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_ |