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

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

Issue 2938443002: [GRC] UKM Support (Closed)
Patch Set: Refactor 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
20 static bool IsEnabled(); 23 static bool IsEnabled();
21 24
22 resource_coordinator::ResourceCoordinatorInterface* 25 resource_coordinator::ResourceCoordinatorInterface*
23 tab_resource_coordinator() { 26 tab_resource_coordinator() {
24 return tab_resource_coordinator_.get(); 27 return tab_resource_coordinator_.get();
25 } 28 }
26 29
27 // WebContentsObserver implementation. 30 // WebContentsObserver implementation.
28 void WasShown() override; 31 void WasShown() override;
29 void WasHidden() override; 32 void WasHidden() override;
30 void DidFinishNavigation( 33 void DidFinishNavigation(
31 content::NavigationHandle* navigation_handle) override; 34 content::NavigationHandle* navigation_handle) override;
32 35
36 void EnsureUkmRecorderInterface();
37 void MaybeSetUkmRecorderInterface(bool ukm_recorder_already_initialized);
38
33 private: 39 private:
34 explicit ResourceCoordinatorWebContentsObserver( 40 explicit ResourceCoordinatorWebContentsObserver(
35 content::WebContents* web_contents); 41 content::WebContents* web_contents);
36 42
37 friend class content::WebContentsUserData< 43 friend class content::WebContentsUserData<
38 ResourceCoordinatorWebContentsObserver>; 44 ResourceCoordinatorWebContentsObserver>;
39 45
40 std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface> 46 std::unique_ptr<resource_coordinator::ResourceCoordinatorInterface>
41 tab_resource_coordinator_; 47 tab_resource_coordinator_;
42 48
49 resource_coordinator::mojom::ServiceCallbacksPtr service_callbacks_;
50
43 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorWebContentsObserver); 51 DISALLOW_COPY_AND_ASSIGN(ResourceCoordinatorWebContentsObserver);
44 }; 52 };
45 53
46 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS _OBSERVER_H_ 54 #endif // CHROME_BROWSER_RESOURCE_COORDINATOR_RESOURCE_COORDINATOR_WEB_CONTENTS _OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698