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

Side by Side Diff: ios/chrome/browser/tabs/tab.mm

Issue 2606873002: Move the offline URL trimming to GetFormattedURL. (Closed)
Patch Set: clean Created 3 years, 11 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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 #import "ios/chrome/browser/tabs/tab.h" 5 #import "ios/chrome/browser/tabs/tab.h"
6 6
7 #import <CoreLocation/CoreLocation.h> 7 #import <CoreLocation/CoreLocation.h>
8 #import <UIKit/UIKit.h> 8 #import <UIKit/UIKit.h>
9 9
10 #include <utility> 10 #include <utility>
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 #include "ios/chrome/browser/infobars/infobar_manager_impl.h" 69 #include "ios/chrome/browser/infobars/infobar_manager_impl.h"
70 #include "ios/chrome/browser/metrics/ios_chrome_origins_seen_service_factory.h" 70 #include "ios/chrome/browser/metrics/ios_chrome_origins_seen_service_factory.h"
71 #import "ios/chrome/browser/metrics/tab_usage_recorder.h" 71 #import "ios/chrome/browser/metrics/tab_usage_recorder.h"
72 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h" 72 #import "ios/chrome/browser/native_app_launcher/native_app_navigation_controller .h"
73 #import "ios/chrome/browser/net/metrics_network_client_manager.h" 73 #import "ios/chrome/browser/net/metrics_network_client_manager.h"
74 #import "ios/chrome/browser/passwords/credential_manager.h" 74 #import "ios/chrome/browser/passwords/credential_manager.h"
75 #import "ios/chrome/browser/passwords/js_credential_manager.h" 75 #import "ios/chrome/browser/passwords/js_credential_manager.h"
76 #import "ios/chrome/browser/passwords/password_controller.h" 76 #import "ios/chrome/browser/passwords/password_controller.h"
77 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h" 77 #import "ios/chrome/browser/passwords/passwords_ui_delegate_impl.h"
78 #include "ios/chrome/browser/pref_names.h" 78 #include "ios/chrome/browser/pref_names.h"
79 #include "ios/chrome/browser/reading_list/offline_url_utils.h"
79 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" 80 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
80 #include "ios/chrome/browser/reading_list/reading_list_web_state_observer.h" 81 #include "ios/chrome/browser/reading_list/reading_list_web_state_observer.h"
81 #include "ios/chrome/browser/search_engines/template_url_service_factory.h" 82 #include "ios/chrome/browser/search_engines/template_url_service_factory.h"
82 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h" 83 #include "ios/chrome/browser/sessions/ios_chrome_session_tab_helper.h"
83 #include "ios/chrome/browser/signin/account_consistency_service_factory.h" 84 #include "ios/chrome/browser/signin/account_consistency_service_factory.h"
84 #include "ios/chrome/browser/signin/account_reconcilor_factory.h" 85 #include "ios/chrome/browser/signin/account_reconcilor_factory.h"
85 #include "ios/chrome/browser/signin/authentication_service.h" 86 #include "ios/chrome/browser/signin/authentication_service.h"
86 #include "ios/chrome/browser/signin/authentication_service_factory.h" 87 #include "ios/chrome/browser/signin/authentication_service_factory.h"
87 #include "ios/chrome/browser/signin/signin_capability.h" 88 #include "ios/chrome/browser/signin/signin_capability.h"
88 #import "ios/chrome/browser/snapshots/snapshot_manager.h" 89 #import "ios/chrome/browser/snapshots/snapshot_manager.h"
(...skipping 2325 matching lines...) Expand 10 before | Expand all | Expand 10 after
2414 - (BOOL)navigationIsBackwards:(const CRWSessionEntry*)fromEntry 2415 - (BOOL)navigationIsBackwards:(const CRWSessionEntry*)fromEntry
2415 toEntry:(const CRWSessionEntry*)toEntry { 2416 toEntry:(const CRWSessionEntry*)toEntry {
2416 DCHECK([self navigationManager]); 2417 DCHECK([self navigationManager]);
2417 NSArray* entries = [self navigationManager]->GetSessionController().entries; 2418 NSArray* entries = [self navigationManager]->GetSessionController().entries;
2418 NSInteger fromIndex = [entries indexOfObject:fromEntry]; 2419 NSInteger fromIndex = [entries indexOfObject:fromEntry];
2419 NSInteger toIndex = [entries indexOfObject:toEntry]; 2420 NSInteger toIndex = [entries indexOfObject:toEntry];
2420 return (fromIndex != NSNotFound && toIndex != NSNotFound && 2421 return (fromIndex != NSNotFound && toIndex != NSNotFound &&
2421 fromIndex > toIndex); 2422 fromIndex > toIndex);
2422 } 2423 }
2423 2424
2425 - (BOOL)isOffline {
2426 return reading_list::IsOfflineURL(
2427 [self navigationManager]->GetVisibleItem()->GetURL());
2428 }
2429
2424 @end 2430 @end
2425 2431
2426 #pragma mark - TestingSupport 2432 #pragma mark - TestingSupport
2427 2433
2428 @implementation Tab (TestingSupport) 2434 @implementation Tab (TestingSupport)
2429 2435
2430 - (void)replaceWebStateImpl:(std::unique_ptr<web::WebStateImpl>)webState { 2436 - (void)replaceWebStateImpl:(std::unique_ptr<web::WebStateImpl>)webState {
2431 // Stop observing the old InfoBarManager and FaviconDriver since they will 2437 // Stop observing the old InfoBarManager and FaviconDriver since they will
2432 // be deleted with the old web controller. 2438 // be deleted with the old web controller.
2433 [self setShouldObserveInfoBarManager:NO]; 2439 [self setShouldObserveInfoBarManager:NO];
(...skipping 18 matching lines...) Expand all
2452 2458
2453 - (TabModel*)parentTabModel { 2459 - (TabModel*)parentTabModel {
2454 return parentTabModel_; 2460 return parentTabModel_;
2455 } 2461 }
2456 2462
2457 - (FormInputAccessoryViewController*)inputAccessoryViewController { 2463 - (FormInputAccessoryViewController*)inputAccessoryViewController {
2458 return inputAccessoryViewController_.get(); 2464 return inputAccessoryViewController_.get();
2459 } 2465 }
2460 2466
2461 @end 2467 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698