| OLD | NEW |
| 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 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 // in order of priority. | 330 // in order of priority. |
| 331 - (NSArray*)suggestionProviders; | 331 - (NSArray*)suggestionProviders; |
| 332 | 332 |
| 333 // Returns a list of FormInputAccessoryViewProviders to be queried for an input | 333 // Returns a list of FormInputAccessoryViewProviders to be queried for an input |
| 334 // accessory view in order of priority. | 334 // accessory view in order of priority. |
| 335 - (NSArray*)accessoryViewProviders; | 335 - (NSArray*)accessoryViewProviders; |
| 336 | 336 |
| 337 // Sets the favicon on the current NavigationItem. | 337 // Sets the favicon on the current NavigationItem. |
| 338 - (void)setFavicon:(const gfx::Image*)image; | 338 - (void)setFavicon:(const gfx::Image*)image; |
| 339 | 339 |
| 340 // Updates the title field of the current session entry. Also updates the | |
| 341 // history database. | |
| 342 - (void)updateTitle:(NSString*)title; | |
| 343 | |
| 344 // Saves the current title to the history database. | 340 // Saves the current title to the history database. |
| 345 - (void)saveTitleToHistoryDB; | 341 - (void)saveTitleToHistoryDB; |
| 346 | 342 |
| 347 // Adds the current session entry to this history database. | 343 // Adds the current session entry to this history database. |
| 348 - (void)addCurrentEntryToHistoryDB; | 344 - (void)addCurrentEntryToHistoryDB; |
| 349 | 345 |
| 350 // Adds any cached entries from |addPageVector_| to the history DB. | 346 // Adds any cached entries from |addPageVector_| to the history DB. |
| 351 - (void)commitCachedEntriesToHistoryDB; | 347 - (void)commitCachedEntriesToHistoryDB; |
| 352 | 348 |
| 353 // Returns the OpenInController for this tab. | 349 // Returns the OpenInController for this tab. |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 986 if (browserState_->IsOffTheRecord()) { | 982 if (browserState_->IsOffTheRecord()) { |
| 987 style = OverscrollStyle::REGULAR_PAGE_INCOGNITO; | 983 style = OverscrollStyle::REGULAR_PAGE_INCOGNITO; |
| 988 } | 984 } |
| 989 [overscrollActionsController_ setStyle:style]; | 985 [overscrollActionsController_ setStyle:style]; |
| 990 [overscrollActionsController_ | 986 [overscrollActionsController_ |
| 991 setDelegate:overscrollActionsControllerDelegate]; | 987 setDelegate:overscrollActionsControllerDelegate]; |
| 992 overscrollActionsControllerDelegate_.reset( | 988 overscrollActionsControllerDelegate_.reset( |
| 993 overscrollActionsControllerDelegate); | 989 overscrollActionsControllerDelegate); |
| 994 } | 990 } |
| 995 | 991 |
| 996 - (void)updateTitle:(NSString*)title { | |
| 997 web::NavigationItem* item = [self navigationManager]->GetVisibleItem(); | |
| 998 if (!item) | |
| 999 return; | |
| 1000 item->SetTitle(base::SysNSStringToUTF16(title)); | |
| 1001 // TODO(crbug.com/546218): See if this can be removed; it's not clear that | |
| 1002 // other platforms send this (tab sync triggers need to be compared against | |
| 1003 // upstream). | |
| 1004 if (webStateImpl_) | |
| 1005 webStateImpl_->GetNavigationManagerImpl().OnNavigationItemChanged(); | |
| 1006 | |
| 1007 [self saveTitleToHistoryDB]; | |
| 1008 } | |
| 1009 | |
| 1010 - (void)saveTitleToHistoryDB { | 992 - (void)saveTitleToHistoryDB { |
| 1011 // If incognito, don't update history. | 993 // If incognito, don't update history. |
| 1012 if (browserState_->IsOffTheRecord()) | 994 if (browserState_->IsOffTheRecord()) |
| 1013 return; | 995 return; |
| 1014 // Don't update the history if current entry has no title. | 996 // Don't update the history if current entry has no title. |
| 1015 NSString* title = [self title]; | 997 NSString* title = [self title]; |
| 1016 if (![title length] || | 998 if (![title length] || |
| 1017 [title isEqualToString:l10n_util::GetNSString(IDS_DEFAULT_TAB_TITLE)]) | 999 [title isEqualToString:l10n_util::GetNSString(IDS_DEFAULT_TAB_TITLE)]) |
| 1018 return; | 1000 return; |
| 1019 | 1001 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1824 shouldOpenExternalURL:(const GURL&)URL { | 1806 shouldOpenExternalURL:(const GURL&)URL { |
| 1825 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { | 1807 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { |
| 1826 [delegate_ discardPrerender]; | 1808 [delegate_ discardPrerender]; |
| 1827 return NO; | 1809 return NO; |
| 1828 } | 1810 } |
| 1829 return YES; | 1811 return YES; |
| 1830 } | 1812 } |
| 1831 | 1813 |
| 1832 - (void)webController:(CRWWebController*)webController | 1814 - (void)webController:(CRWWebController*)webController |
| 1833 titleDidChange:(NSString*)title { | 1815 titleDidChange:(NSString*)title { |
| 1834 NSString* oldTitle = [self title]; | 1816 [self saveTitleToHistoryDB]; |
| 1835 BOOL isTitleChanged = (!oldTitle && title) || (oldTitle && !title) || | 1817 [parentTabModel_ notifyTabChanged:self]; |
| 1836 (![oldTitle isEqualToString:title]); | |
| 1837 if (isTitleChanged) { | |
| 1838 [self updateTitle:title]; | |
| 1839 [parentTabModel_ notifyTabChanged:self]; | |
| 1840 } | |
| 1841 } | 1818 } |
| 1842 | 1819 |
| 1843 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url | 1820 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url |
| 1844 sourceURL:(const GURL&)sourceURL | 1821 sourceURL:(const GURL&)sourceURL |
| 1845 linkClicked:(BOOL)linkClicked { | 1822 linkClicked:(BOOL)linkClicked { |
| 1846 // Don't open any native app directly when prerendering or from Incognito. | 1823 // Don't open any native app directly when prerendering or from Incognito. |
| 1847 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) | 1824 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) |
| 1848 return NO; | 1825 return NO; |
| 1849 | 1826 |
| 1850 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata( | 1827 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata( |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2233 | 2210 |
| 2234 - (TabModel*)parentTabModel { | 2211 - (TabModel*)parentTabModel { |
| 2235 return parentTabModel_; | 2212 return parentTabModel_; |
| 2236 } | 2213 } |
| 2237 | 2214 |
| 2238 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2215 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2239 return inputAccessoryViewController_.get(); | 2216 return inputAccessoryViewController_.get(); |
| 2240 } | 2217 } |
| 2241 | 2218 |
| 2242 @end | 2219 @end |
| OLD | NEW |