| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 #ifndef CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_ |
| 6 #define CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "chrome/browser/ui/browser_list_observer.h" |
| 10 |
| 11 class Browser; |
| 12 |
| 13 namespace metrics { |
| 14 |
| 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; |
| 21 |
| 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_; |
| 26 } |
| 27 |
| 28 protected: |
| 29 // For testing. |
| 30 void set_incognito_launched(bool value) { |
| 31 incognito_launched_ = value; |
| 32 } |
| 33 |
| 34 private: |
| 35 // chrome::BrowserListObserver implementation. |
| 36 void OnBrowserAdded(Browser* browser) override; |
| 37 |
| 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_; |
| 41 |
| 42 DISALLOW_COPY_AND_ASSIGN(WindowedIncognitoObserver); |
| 43 }; |
| 44 |
| 45 } // namespace metrics |
| 46 |
| 47 #endif // CHROME_BROWSER_METRICS_WINDOWED_INCOGNITO_OBSERVER_H_ |
| OLD | NEW |