| 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 #include "ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h" | 5 #include "ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.h" |
| 6 | 6 |
| 7 #include "components/bookmarks/browser/bookmark_model.h" | 7 #include "components/bookmarks/browser/bookmark_model.h" |
| 8 #include "components/toolbar/toolbar_model_impl.h" | 8 #include "components/toolbar/toolbar_model_impl.h" |
| 9 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" | 9 #include "ios/chrome/browser/bookmarks/bookmark_model_factory.h" |
| 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 10 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
| 11 #include "ios/chrome/browser/chrome_url_constants.h" | 11 #include "ios/chrome/browser/chrome_url_constants.h" |
| 12 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" | 12 #import "ios/chrome/browser/tabs/legacy_tab_helper.h" |
| 13 #include "ios/chrome/browser/tabs/tab.h" | 13 #include "ios/chrome/browser/tabs/tab.h" |
| 14 #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" | 14 #include "ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h" |
| 15 #import "ios/web/public/web_state/web_state.h" | 15 #import "ios/web/public/web_state/web_state.h" |
| 16 #import "ios/web/web_state/ui/crw_web_controller.h" | |
| 17 | |
| 18 #if !defined(__has_feature) || !__has_feature(objc_arc) | |
| 19 #error "This file requires ARC support." | |
| 20 #endif | |
| 21 | 16 |
| 22 namespace { | 17 namespace { |
| 23 const size_t kMaxURLDisplayChars = 32 * 1024; | 18 const size_t kMaxURLDisplayChars = 32 * 1024; |
| 24 | 19 |
| 25 bookmarks::BookmarkModel* GetBookmarkModelForWebState( | 20 bookmarks::BookmarkModel* GetBookmarkModelForWebState( |
| 26 web::WebState* web_state) { | 21 web::WebState* web_state) { |
| 27 if (!web_state) | 22 if (!web_state) |
| 28 return nullptr; | 23 return nullptr; |
| 29 web::BrowserState* browser_state = web_state->GetBrowserState(); | 24 web::BrowserState* browser_state = web_state->GetBrowserState(); |
| 30 if (!browser_state) | 25 if (!browser_state) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 } | 90 } |
| 96 | 91 |
| 97 bool ToolbarModelImplIOS::ShouldDisplayHintText() { | 92 bool ToolbarModelImplIOS::ShouldDisplayHintText() { |
| 98 web::WebState* web_state = delegate_->GetActiveWebState(); | 93 web::WebState* web_state = delegate_->GetActiveWebState(); |
| 99 if (!web_state) | 94 if (!web_state) |
| 100 return false; | 95 return false; |
| 101 | 96 |
| 102 Tab* tab = LegacyTabHelper::GetTabForWebState(web_state); | 97 Tab* tab = LegacyTabHelper::GetTabForWebState(web_state); |
| 103 return tab && [tab.webController wantsLocationBarHintText]; | 98 return tab && [tab.webController wantsLocationBarHintText]; |
| 104 } | 99 } |
| OLD | NEW |