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 #include "components/history/ios/browser/web_state_top_sites_observer.h" | 5 #include "components/history/ios/browser/web_state_top_sites_observer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/history/core/browser/top_sites.h" | 8 #include "components/history/core/browser/top_sites.h" |
9 #include "ios/web/public/load_committed_details.h" | 9 #include "ios/web/public/load_committed_details.h" |
10 #include "ios/web/public/navigation_item.h" | 10 #include "ios/web/public/navigation_item.h" |
11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
12 DEFINE_WEB_STATE_USER_DATA_KEY(history::WebStateTopSitesObserver); | 16 DEFINE_WEB_STATE_USER_DATA_KEY(history::WebStateTopSitesObserver); |
13 | 17 |
14 namespace history { | 18 namespace history { |
15 | 19 |
16 // static | 20 // static |
17 void WebStateTopSitesObserver::CreateForWebState(web::WebState* web_state, | 21 void WebStateTopSitesObserver::CreateForWebState(web::WebState* web_state, |
18 TopSites* top_sites) { | 22 TopSites* top_sites) { |
19 DCHECK(web_state); | 23 DCHECK(web_state); |
20 if (!FromWebState(web_state)) { | 24 if (!FromWebState(web_state)) { |
21 web_state->SetUserData(UserDataKey(), | 25 web_state->SetUserData(UserDataKey(), |
(...skipping 10 matching lines...) Expand all Loading... |
32 } | 36 } |
33 | 37 |
34 void WebStateTopSitesObserver::NavigationItemCommitted( | 38 void WebStateTopSitesObserver::NavigationItemCommitted( |
35 const web::LoadCommittedDetails& load_details) { | 39 const web::LoadCommittedDetails& load_details) { |
36 DCHECK(load_details.item); | 40 DCHECK(load_details.item); |
37 if (top_sites_) | 41 if (top_sites_) |
38 top_sites_->OnNavigationCommitted(load_details.item->GetURL()); | 42 top_sites_->OnNavigationCommitted(load_details.item->GetURL()); |
39 } | 43 } |
40 | 44 |
41 } // namespace history | 45 } // namespace history |
OLD | NEW |