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_web_state_observer.h" | 5 #include "ios/chrome/browser/reading_list/reading_list_web_state_observer.h" |
6 | 6 |
7 #import <Foundation/Foundation.h> | 7 #import <Foundation/Foundation.h> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "components/reading_list/ios/reading_list_model.h" | 10 #include "components/reading_list/ios/reading_list_model.h" |
11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 11 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
12 #include "ios/chrome/browser/reading_list/reading_list_entry_loading_util.h" | 12 #include "ios/chrome/browser/reading_list/reading_list_entry_loading_util.h" |
13 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 13 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
14 #include "ios/web/public/navigation_item.h" | 14 #include "ios/web/public/navigation_item.h" |
15 #include "ios/web/public/navigation_manager.h" | 15 #include "ios/web/public/navigation_manager.h" |
16 #include "ios/web/public/web_state/web_state_user_data.h" | 16 #include "ios/web/public/web_state/web_state_user_data.h" |
17 | 17 |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 19 #error "This file requires ARC support." |
| 20 #endif |
| 21 |
18 #pragma mark - ReadingListWebStateObserverUserDataWrapper | 22 #pragma mark - ReadingListWebStateObserverUserDataWrapper |
19 | 23 |
20 namespace { | 24 namespace { |
21 // The key under which ReadingListWebStateObserverUserDataWrapper are stored in | 25 // The key under which ReadingListWebStateObserverUserDataWrapper are stored in |
22 // a WebState's user data. | 26 // a WebState's user data. |
23 const void* const kObserverKey = &kObserverKey; | 27 const void* const kObserverKey = &kObserverKey; |
24 } // namespace | 28 } // namespace |
25 | 29 |
26 // Wrapper class used to associated ReadingListWebStateObserver with their | 30 // Wrapper class used to associated ReadingListWebStateObserver with their |
27 // WebStates. | 31 // WebStates. |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 double progress = web_state()->GetLoadingProgress(); | 119 double progress = web_state()->GetLoadingProgress(); |
116 const double kMinimumExpectedProgress = 0.15; | 120 const double kMinimumExpectedProgress = 0.15; |
117 if (progress < kMinimumExpectedProgress) { | 121 if (progress < kMinimumExpectedProgress) { |
118 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url); | 122 const ReadingListEntry* entry = reading_list_model_->GetEntryByURL(url); |
119 if (!entry) | 123 if (!entry) |
120 return; | 124 return; |
121 reading_list::LoadReadingListDistilled(*entry, reading_list_model_, | 125 reading_list::LoadReadingListDistilled(*entry, reading_list_model_, |
122 web_state()); | 126 web_state()); |
123 } | 127 } |
124 } | 128 } |
OLD | NEW |