Index: chrome/browser/data_use_measurement/data_use_web_contents_observer.h |
diff --git a/chrome/browser/data_use_measurement/data_use_web_contents_observer.h b/chrome/browser/data_use_measurement/data_use_web_contents_observer.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..0ad1c5c49ed17e1ebf17d52a2d1cb71d5d855f46 |
--- /dev/null |
+++ b/chrome/browser/data_use_measurement/data_use_web_contents_observer.h |
@@ -0,0 +1,57 @@ |
+// Copyright 2016 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_DATA_USE_MEASUREMENT_DATA_USE_WEB_CONTENTS_OBSERVER_H_ |
+#define CHROME_BROWSER_DATA_USE_MEASUREMENT_DATA_USE_WEB_CONTENTS_OBSERVER_H_ |
+ |
+#include "base/macros.h" |
+#include "content/public/browser/web_contents_observer.h" |
+#include "content/public/browser/web_contents_user_data.h" |
+ |
+namespace content { |
+class NavigationHandle; |
+class RenderFrameHost; |
+} |
+ |
+namespace data_use_measurement { |
+ |
+class ChromeDataUseAscriberService; |
+ |
+// Forwards navigation and frame events to |ChromeDataUseAscriberService|. |
+class DataUseWebContentsObserver |
+ : public content::WebContentsObserver, |
+ public content::WebContentsUserData<DataUseWebContentsObserver> { |
+ public: |
+ // Creates a |DataUseWebContentsObserver| for the given |WebContents| and |
+ // |ChromeDataUseAscriberService|. |
+ static void CreateForWebContents(content::WebContents* web_contents, |
+ ChromeDataUseAscriberService* service); |
+ |
+ ~DataUseWebContentsObserver() override; |
+ |
+ void RenderFrameCreated(content::RenderFrameHost* render_frame_host) override; |
bengr
2016/09/01 00:16:55
Comments needed here and below.
Not at Google. Contact bengr
2016/09/07 23:38:38
Done.
|
+ |
+ void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override; |
+ |
+ void DidStartNavigation( |
+ content::NavigationHandle* navigation_handle) override; |
+ |
+ void DidFinishNavigation( |
+ content::NavigationHandle* navigation_handle) override; |
+ |
+ void DidRedirectNavigation( |
+ content::NavigationHandle* navigation_handle) override; |
+ |
+ private: |
+ explicit DataUseWebContentsObserver(content::WebContents* web_contents, |
+ ChromeDataUseAscriberService* service); |
+ friend class content::WebContentsUserData<DataUseWebContentsObserver>; |
+ ChromeDataUseAscriberService* service_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(DataUseWebContentsObserver); |
+}; |
+ |
+} // namespace data_use_measurement |
+ |
+#endif // CHROME_BROWSER_DATA_USE_MEASUREMENT_DATA_USE_WEB_CONTENTS_OBSERVER_H_ |