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

Unified Diff: ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.mm

Issue 2775943002: Revert of [ios] Switches ToolbarModelDelegateIOS to use WebStateList. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.mm
diff --git a/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.mm b/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.mm
index 9632f92826c7bc79330d17d2d2c420314c28ac89..26929d36416d077055d1dc984f4ca1c003bcb27a 100644
--- a/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.mm
+++ b/ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.mm
@@ -14,23 +14,27 @@
#include "ios/chrome/browser/chrome_url_constants.h"
#include "ios/chrome/browser/pref_names.h"
#include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h"
-#include "ios/shared/chrome/browser/tabs/web_state_list.h"
+#import "ios/chrome/browser/tabs/tab.h"
+#import "ios/chrome/browser/tabs/tab_model.h"
#import "ios/web/public/navigation_item.h"
-#import "ios/web/public/navigation_manager.h"
-#import "ios/web/public/ssl_status.h"
#import "ios/web/public/web_state/web_state.h"
-ToolbarModelDelegateIOS::ToolbarModelDelegateIOS(WebStateList* web_state_list)
- : web_state_list_(web_state_list) {}
+ToolbarModelDelegateIOS::ToolbarModelDelegateIOS(TabModel* tab_model)
+ : tab_model_([tab_model retain]) {}
ToolbarModelDelegateIOS::~ToolbarModelDelegateIOS() {}
-web::WebState* ToolbarModelDelegateIOS::GetActiveWebState() const {
- return web_state_list_->GetActiveWebState();
+void ToolbarModelDelegateIOS::SetTabModel(TabModel* tab_model) {
+ DCHECK(tab_model);
+ tab_model_.reset([tab_model retain]);
+}
+
+Tab* ToolbarModelDelegateIOS::GetCurrentTab() const {
+ return [tab_model_ currentTab];
}
web::NavigationItem* ToolbarModelDelegateIOS::GetNavigationItem() const {
- web::WebState* web_state = GetActiveWebState();
+ web::WebState* web_state = [GetCurrentTab() webState];
web::NavigationManager* navigation_manager =
web_state ? web_state->GetNavigationManager() : nullptr;
return navigation_manager ? navigation_manager->GetVisibleItem() : nullptr;
@@ -70,7 +74,7 @@
security_state::SecurityLevel ToolbarModelDelegateIOS::GetSecurityLevel()
const {
- web::WebState* web_state = GetActiveWebState();
+ web::WebState* web_state = [GetCurrentTab() webState];
// If there is no active WebState (which can happen during toolbar
// initialization), assume no security style.
if (!web_state)
@@ -90,7 +94,7 @@
}
bool ToolbarModelDelegateIOS::FailsMalwareCheck() const {
- web::WebState* web_state = GetActiveWebState();
+ web::WebState* web_state = [GetCurrentTab() webState];
// If there is no active WebState (which can happen during toolbar
// initialization), so nothing can fail.
if (!web_state)
« no previous file with comments | « ios/chrome/browser/ui/toolbar/toolbar_model_delegate_ios.h ('k') | ios/chrome/browser/ui/toolbar/toolbar_model_impl_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698