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

Side by Side Diff: components/history/content/browser/web_contents_top_sites_observer.h

Issue 2847013003: Switch SupportsUserData uses to use unique_ptr. (Closed)
Patch Set: rev Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 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 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 COMPONENTS_HISTORY_CONTENT_BROWSER_WEB_CONTENTS_TOP_SITES_OBSERVER_H_ 5 #ifndef COMPONENTS_HISTORY_CONTENT_BROWSER_WEB_CONTENTS_TOP_SITES_OBSERVER_H_
6 #define COMPONENTS_HISTORY_CONTENT_BROWSER_WEB_CONTENTS_TOP_SITES_OBSERVER_H_ 6 #define COMPONENTS_HISTORY_CONTENT_BROWSER_WEB_CONTENTS_TOP_SITES_OBSERVER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "content/public/browser/web_contents_observer.h" 9 #include "content/public/browser/web_contents_observer.h"
10 #include "content/public/browser/web_contents_user_data.h" 10 #include "content/public/browser/web_contents_user_data.h"
11 11
12 namespace history { 12 namespace history {
13 13
14 class TopSites; 14 class TopSites;
15 15
16 // WebContentsTopSitesObserver forwards navigation events from 16 // WebContentsTopSitesObserver forwards navigation events from
17 // content::WebContents to TopSites. 17 // content::WebContents to TopSites.
18 class WebContentsTopSitesObserver 18 class WebContentsTopSitesObserver
19 : public content::WebContentsObserver, 19 : public content::WebContentsObserver,
20 public content::WebContentsUserData<WebContentsTopSitesObserver> { 20 public content::WebContentsUserData<WebContentsTopSitesObserver> {
21 public: 21 public:
22 ~WebContentsTopSitesObserver() override;
23
22 static void CreateForWebContents(content::WebContents* web_contents, 24 static void CreateForWebContents(content::WebContents* web_contents,
23 TopSites* top_sites); 25 TopSites* top_sites);
24 26
25 private: 27 private:
26 friend class content::WebContentsUserData<WebContentsTopSitesObserver>; 28 friend class content::WebContentsUserData<WebContentsTopSitesObserver>;
27 29
28 WebContentsTopSitesObserver(content::WebContents* web_contents, 30 WebContentsTopSitesObserver(content::WebContents* web_contents,
29 TopSites* top_sites); 31 TopSites* top_sites);
30 ~WebContentsTopSitesObserver() override;
31 32
32 // content::WebContentsObserver implementation. 33 // content::WebContentsObserver implementation.
33 void NavigationEntryCommitted( 34 void NavigationEntryCommitted(
34 const content::LoadCommittedDetails& load_details) override; 35 const content::LoadCommittedDetails& load_details) override;
35 36
36 // Underlying TopSites instance, may be null during testing. 37 // Underlying TopSites instance, may be null during testing.
37 TopSites* top_sites_; 38 TopSites* top_sites_;
38 39
39 DISALLOW_COPY_AND_ASSIGN(WebContentsTopSitesObserver); 40 DISALLOW_COPY_AND_ASSIGN(WebContentsTopSitesObserver);
40 }; 41 };
41 42
42 } // namespace history 43 } // namespace history
43 44
44 #endif // COMPONENTS_HISTORY_CONTENT_BROWSER_WEB_CONTENTS_TOP_SITES_OBSERVER_H_ 45 #endif // COMPONENTS_HISTORY_CONTENT_BROWSER_WEB_CONTENTS_TOP_SITES_OBSERVER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698