Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3725)

Unified Diff: chrome/browser/metrics/windowed_incognito_observer.h

Issue 1218583002: metrics: Add dbus interface for GetRandomPerfOutput (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check has_ms_after_login() instead of ms_after_login() value Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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_
« no previous file with comments | « chrome/browser/metrics/perf_provider_chromeos_unittest.cc ('k') | chrome/browser/metrics/windowed_incognito_observer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698