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

Side by Side Diff: chrome/browser/resource_coordinator/resource_coordinator_web_contents_observer.h

Issue 2938443002: [GRC] UKM Support (Closed)
Patch Set: Address reviewer feedback Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB SERVER_H_ 5 #ifndef CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB SERVER_H_
6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB SERVER_H_ 6 #define CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS_OB SERVER_H_
7 7
8 #include <memory>
9
8 #include "base/macros.h" 10 #include "base/macros.h"
9 #include "content/public/browser/web_contents_observer.h" 11 #include "content/public/browser/web_contents_observer.h"
10 #include "content/public/browser/web_contents_user_data.h" 12 #include "content/public/browser/web_contents_user_data.h"
11 #include "services/resource_coordinator/public/cpp/resource_coordinator_interfac e.h" 13 #include "services/resource_coordinator/public/cpp/resource_coordinator_interfac e.h"
14 #include "services/resource_coordinator/public/interfaces/service_callbacks.mojo m.h"
12 15
13 class ResourceCoordinatorWebContentsObserver 16 class ResourceCoordinatorWebContentsObserver
14 : public content::WebContentsObserver, 17 : public content::WebContentsObserver,
15 public content::WebContentsUserData< 18 public content::WebContentsUserData<
16 ResourceCoordinatorWebContentsObserver> { 19 ResourceCoordinatorWebContentsObserver> {
17 public: 20 public:
18 ~ResourceCoordinatorWebContentsObserver() override; 21 ~ResourceCoordinatorWebContentsObserver() override;
19 22
23 static bool ukm_recorder_initialized;
20 static bool IsEnabled(); 24 static bool IsEnabled();
21 25
22 resource_coordinator::ResourceCoordinatorInterface* 26 resource_coordinator::ResourceCoordinatorInterface*
23 tab_resource_coordinator() { 27 tab_resource_coordinator() {
24 return tab_resource_coordinator_.get(); 28 return tab_resource_coordinator_.get();
25 } 29 }
26 30
27 // WebContentsObserver implementation. 31 // WebContentsObserver implementation.
28 void WasShown() override; 32 void WasShown() override;
29 void WasHidden() override; 33 void WasHidden() override;
30 void DidFinishNavigation( 34 void DidFinishNavigation(
31 content::NavigationHandle* navigation_handle) override; 35 content::NavigationHandle* navigation_handle) override;
32 36
37 void EnsureUkmRecorderInterface();
38 void MaybeSetUkmRecorderInterface(bool ukm_recorder_already_initialized);
39
33 private: 40 private:
34 explicit ResourceCoordinatorWebContentsObserver( 41 explicit ResourceCoordinatorWebContentsObserver(
35 content::WebContents* web_contents); 42 content::WebContents* web_contents);
36 43
37 friend class content::WebContentsUserData< 44 friend class content::WebContentsUserData<
38 ResourceCoordinatorWebContentsObserver>; 45 ResourceCoordinatorWebContentsObserver>;
39 46
40 std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface> 47 std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface>
41 tab_resource_coordinator_; 48 tab_resource_coordinator_;
42 49
50 resource_coordinator::mojom::ServiceCallbacksPtr service_callbacks_;
51
43 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorWebContentsObserver); 52 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorWebContentsObserver);
44 }; 53 };
45 54
46 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS _OBSERVER_H_ 55 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS _OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698