| OLD | NEW |
| 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_IOS_BROWSER_WEB_STATE_TOP_SITES_OBSERVER_H_ | 5 #ifndef COMPONENTS_HISTORY_IOS_BROWSER_WEB_STATE_TOP_SITES_OBSERVER_H_ |
| 6 #define COMPONENTS_HISTORY_IOS_BROWSER_WEB_STATE_TOP_SITES_OBSERVER_H_ | 6 #define COMPONENTS_HISTORY_IOS_BROWSER_WEB_STATE_TOP_SITES_OBSERVER_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ios/web/public/web_state/web_state_observer.h" | 9 #include "ios/web/public/web_state/web_state_observer.h" |
| 10 #include "ios/web/public/web_state/web_state_user_data.h" | 10 #include "ios/web/public/web_state/web_state_user_data.h" |
| 11 | 11 |
| 12 namespace history { | 12 namespace history { |
| 13 | 13 |
| 14 class TopSites; | 14 class TopSites; |
| 15 | 15 |
| 16 // WebStateTopSitesObserver forwards navigation events from web::WebState to | 16 // WebStateTopSitesObserver forwards navigation events from web::WebState to |
| 17 // TopSites. | 17 // TopSites. |
| 18 class WebStateTopSitesObserver | 18 class WebStateTopSitesObserver |
| 19 : public web::WebStateObserver, | 19 : public web::WebStateObserver, |
| 20 public web::WebStateUserData<WebStateTopSitesObserver> { | 20 public web::WebStateUserData<WebStateTopSitesObserver> { |
| 21 public: | 21 public: |
| 22 ~WebStateTopSitesObserver() override; |
| 23 |
| 22 static void CreateForWebState(web::WebState* web_state, TopSites* top_sites); | 24 static void CreateForWebState(web::WebState* web_state, TopSites* top_sites); |
| 23 | 25 |
| 24 private: | 26 private: |
| 25 friend class web::WebStateUserData<WebStateTopSitesObserver>; | 27 friend class web::WebStateUserData<WebStateTopSitesObserver>; |
| 26 | 28 |
| 27 WebStateTopSitesObserver(web::WebState* web_state, TopSites* top_sites); | 29 WebStateTopSitesObserver(web::WebState* web_state, TopSites* top_sites); |
| 28 ~WebStateTopSitesObserver() override; | |
| 29 | 30 |
| 30 // web::WebStateObserver implementation. | 31 // web::WebStateObserver implementation. |
| 31 void NavigationItemCommitted( | 32 void NavigationItemCommitted( |
| 32 const web::LoadCommittedDetails& load_details) override; | 33 const web::LoadCommittedDetails& load_details) override; |
| 33 | 34 |
| 34 // Underlying TopSites instance, may be null during testing. | 35 // Underlying TopSites instance, may be null during testing. |
| 35 TopSites* top_sites_; | 36 TopSites* top_sites_; |
| 36 | 37 |
| 37 DISALLOW_COPY_AND_ASSIGN(WebStateTopSitesObserver); | 38 DISALLOW_COPY_AND_ASSIGN(WebStateTopSitesObserver); |
| 38 }; | 39 }; |
| 39 | 40 |
| 40 } // namespace history | 41 } // namespace history |
| 41 | 42 |
| 42 #endif // COMPONENTS_HISTORY_IOS_BROWSER_WEB_STATE_TOP_SITES_OBSERVER_H_ | 43 #endif // COMPONENTS_HISTORY_IOS_BROWSER_WEB_STATE_TOP_SITES_OBSERVER_H_ |
| OLD | NEW |