OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/reading_list/reading_list_entry_loading_util.h" | 5 #include "ios/chrome/browser/reading_list/reading_list_entry_loading_util.h" |
6 | 6 |
7 #include "components/reading_list/ios/reading_list_entry.h" | 7 #include "components/reading_list/ios/reading_list_entry.h" |
8 #include "components/reading_list/ios/reading_list_model.h" | 8 #include "components/reading_list/ios/reading_list_model.h" |
9 #include "ios/chrome/browser/reading_list/offline_url_utils.h" | 9 #include "ios/chrome/browser/reading_list/offline_url_utils.h" |
10 #include "ios/chrome/browser/reading_list/reading_list_web_state_observer.h" | 10 #include "ios/chrome/browser/reading_list/reading_list_web_state_observer.h" |
11 #import "ios/web/public/navigation_manager.h" | 11 #import "ios/web/public/navigation_manager.h" |
12 #import "ios/web/public/web_state/web_state.h" | 12 #import "ios/web/public/web_state/web_state.h" |
13 #include "net/base/network_change_notifier.h" | 13 #include "net/base/network_change_notifier.h" |
14 | 14 |
| 15 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 16 #error "This file requires ARC support." |
| 17 #endif |
| 18 |
15 namespace reading_list { | 19 namespace reading_list { |
16 | 20 |
17 void LoadReadingListEntry(ReadingListEntry const& entry, | 21 void LoadReadingListEntry(ReadingListEntry const& entry, |
18 ReadingListModel* model, | 22 ReadingListModel* model, |
19 web::WebState* web_state) { | 23 web::WebState* web_state) { |
20 // TODO(crbug.com/625617): Evaluate whether NetworkChangeNotifier | 24 // TODO(crbug.com/625617): Evaluate whether NetworkChangeNotifier |
21 // correctly detects when users are offline. | 25 // correctly detects when users are offline. |
22 bool open_distilled_entry = | 26 bool open_distilled_entry = |
23 net::NetworkChangeNotifier::IsOffline() && | 27 net::NetworkChangeNotifier::IsOffline() && |
24 entry.DistilledState() == ReadingListEntry::PROCESSED; | 28 entry.DistilledState() == ReadingListEntry::PROCESSED; |
(...skipping 18 matching lines...) Expand all Loading... |
43 GURL url = | 47 GURL url = |
44 reading_list::DistilledURLForPath(entry.DistilledPath(), entry.URL()); | 48 reading_list::DistilledURLForPath(entry.DistilledPath(), entry.URL()); |
45 DCHECK(url.is_valid()); | 49 DCHECK(url.is_valid()); |
46 web::NavigationManager::WebLoadParams params(url); | 50 web::NavigationManager::WebLoadParams params(url); |
47 params.transition_type = ui::PageTransition::PAGE_TRANSITION_AUTO_BOOKMARK; | 51 params.transition_type = ui::PageTransition::PAGE_TRANSITION_AUTO_BOOKMARK; |
48 web_state->GetNavigationManager()->LoadURLWithParams(params); | 52 web_state->GetNavigationManager()->LoadURLWithParams(params); |
49 model->SetReadStatus(entry.URL(), true); | 53 model->SetReadStatus(entry.URL(), true); |
50 } | 54 } |
51 | 55 |
52 } // namespace reading_list | 56 } // namespace reading_list |
OLD | NEW |