| 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 |
| 340 // Saves the current title to the history database. | 344 // Saves the current title to the history database. |
| 341 - (void)saveTitleToHistoryDB; | 345 - (void)saveTitleToHistoryDB; |
| 342 | 346 |
| 343 // Adds the current session entry to this history database. | 347 // Adds the current session entry to this history database. |
| 344 - (void)addCurrentEntryToHistoryDB; | 348 - (void)addCurrentEntryToHistoryDB; |
| 345 | 349 |
| 346 // Adds any cached entries from |addPageVector_| to the history DB. | 350 // Adds any cached entries from |addPageVector_| to the history DB. |
| 347 - (void)commitCachedEntriesToHistoryDB; | 351 - (void)commitCachedEntriesToHistoryDB; |
| 348 | 352 |
| 349 // Returns the OpenInController for this tab. | 353 // Returns the OpenInController for this tab. |
| (...skipping 632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 982 if (browserState_->IsOffTheRecord()) { | 986 if (browserState_->IsOffTheRecord()) { |
| 983 style = OverscrollStyle::REGULAR_PAGE_INCOGNITO; | 987 style = OverscrollStyle::REGULAR_PAGE_INCOGNITO; |
| 984 } | 988 } |
| 985 [overscrollActionsController_ setStyle:style]; | 989 [overscrollActionsController_ setStyle:style]; |
| 986 [overscrollActionsController_ | 990 [overscrollActionsController_ |
| 987 setDelegate:overscrollActionsControllerDelegate]; | 991 setDelegate:overscrollActionsControllerDelegate]; |
| 988 overscrollActionsControllerDelegate_.reset( | 992 overscrollActionsControllerDelegate_.reset( |
| 989 overscrollActionsControllerDelegate); | 993 overscrollActionsControllerDelegate); |
| 990 } | 994 } |
| 991 | 995 |
| 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 |
| 992 - (void)saveTitleToHistoryDB { | 1010 - (void)saveTitleToHistoryDB { |
| 993 // If incognito, don't update history. | 1011 // If incognito, don't update history. |
| 994 if (browserState_->IsOffTheRecord()) | 1012 if (browserState_->IsOffTheRecord()) |
| 995 return; | 1013 return; |
| 996 // Don't update the history if current entry has no title. | 1014 // Don't update the history if current entry has no title. |
| 997 NSString* title = [self title]; | 1015 NSString* title = [self title]; |
| 998 if (![title length] || | 1016 if (![title length] || |
| 999 [title isEqualToString:l10n_util::GetNSString(IDS_DEFAULT_TAB_TITLE)]) | 1017 [title isEqualToString:l10n_util::GetNSString(IDS_DEFAULT_TAB_TITLE)]) |
| 1000 return; | 1018 return; |
| 1001 | 1019 |
| (...skipping 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1806 shouldOpenExternalURL:(const GURL&)URL { | 1824 shouldOpenExternalURL:(const GURL&)URL { |
| 1807 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { | 1825 if (isPrerenderTab_ && !isLinkLoadingPrerenderTab_) { |
| 1808 [delegate_ discardPrerender]; | 1826 [delegate_ discardPrerender]; |
| 1809 return NO; | 1827 return NO; |
| 1810 } | 1828 } |
| 1811 return YES; | 1829 return YES; |
| 1812 } | 1830 } |
| 1813 | 1831 |
| 1814 - (void)webController:(CRWWebController*)webController | 1832 - (void)webController:(CRWWebController*)webController |
| 1815 titleDidChange:(NSString*)title { | 1833 titleDidChange:(NSString*)title { |
| 1816 [self saveTitleToHistoryDB]; | 1834 NSString* oldTitle = [self title]; |
| 1817 [parentTabModel_ notifyTabChanged:self]; | 1835 BOOL isTitleChanged = (!oldTitle && title) || (oldTitle && !title) || |
| 1836 (![oldTitle isEqualToString:title]); |
| 1837 if (isTitleChanged) { |
| 1838 [self updateTitle:title]; |
| 1839 [parentTabModel_ notifyTabChanged:self]; |
| 1840 } |
| 1818 } | 1841 } |
| 1819 | 1842 |
| 1820 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url | 1843 - (BOOL)urlTriggersNativeAppLaunch:(const GURL&)url |
| 1821 sourceURL:(const GURL&)sourceURL | 1844 sourceURL:(const GURL&)sourceURL |
| 1822 linkClicked:(BOOL)linkClicked { | 1845 linkClicked:(BOOL)linkClicked { |
| 1823 // Don't open any native app directly when prerendering or from Incognito. | 1846 // Don't open any native app directly when prerendering or from Incognito. |
| 1824 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) | 1847 if (isPrerenderTab_ || self.browserState->IsOffTheRecord()) |
| 1825 return NO; | 1848 return NO; |
| 1826 | 1849 |
| 1827 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata( | 1850 base::scoped_nsprotocol<id<NativeAppMetadata>> metadata( |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2210 | 2233 |
| 2211 - (TabModel*)parentTabModel { | 2234 - (TabModel*)parentTabModel { |
| 2212 return parentTabModel_; | 2235 return parentTabModel_; |
| 2213 } | 2236 } |
| 2214 | 2237 |
| 2215 - (FormInputAccessoryViewController*)inputAccessoryViewController { | 2238 - (FormInputAccessoryViewController*)inputAccessoryViewController { |
| 2216 return inputAccessoryViewController_.get(); | 2239 return inputAccessoryViewController_.get(); |
| 2217 } | 2240 } |
| 2218 | 2241 |
| 2219 @end | 2242 @end |
| OLD | NEW |