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

Unified Diff: ios/chrome/browser/tabs/tab.mm

Issue 2731553005: Introduced StoreKitTabHelper class (Closed)
Patch Set: line break for 80 columns 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/tabs/tab.mm
diff --git a/ios/chrome/browser/tabs/tab.mm b/ios/chrome/browser/tabs/tab.mm
index 5b589354d00f43ddc78e40eb691844cddb3d69dd..8d780b4cee50994335bda5adb2598c2514921a15 100644
--- a/ios/chrome/browser/tabs/tab.mm
+++ b/ios/chrome/browser/tabs/tab.mm
@@ -85,7 +85,7 @@
#import "ios/chrome/browser/snapshots/snapshot_overlay_provider.h"
#import "ios/chrome/browser/snapshots/web_controller_snapshot_helper.h"
#include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h"
-#import "ios/chrome/browser/storekit_launcher.h"
+#import "ios/chrome/browser/store_kit/store_kit_tab_helper.h"
#include "ios/chrome/browser/sync/ios_chrome_synced_tab_delegate.h"
#import "ios/chrome/browser/tabs/legacy_tab_helper.h"
#import "ios/chrome/browser/tabs/tab_delegate.h"
@@ -222,9 +222,6 @@ enum class RendererTerminationTabState {
base::scoped_nsobject<OpenInController> openInController_;
base::WeakNSProtocol<id<PassKitDialogProvider>> passKitDialogProvider_;
- // TODO(crbug.com/546213): Move this out of Tab, probably to native app
- // launcher since that's the only thing that uses it.
- base::WeakNSProtocol<id<StoreKitLauncher>> storeKitLauncher_;
// Whether or not this tab is currently being displayed.
BOOL visible_;
@@ -571,6 +568,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
RepostFormTabHelper::CreateForWebState(self.webState);
BlockedPopupTabHelper::CreateForWebState(self.webState);
FindTabHelper::CreateForWebState(self.webState, self);
+ StoreKitTabHelper::CreateForWebState(self.webState);
if (reading_list::switches::IsReadingListEnabled()) {
ReadingListModel* model =
@@ -886,11 +884,16 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
}
- (id<StoreKitLauncher>)storeKitLauncher {
- return storeKitLauncher_.get();
+ StoreKitTabHelper* tab_helper =
+ StoreKitTabHelper::FromWebState(self.webState);
+ return tab_helper ? tab_helper->GetLauncher() : nil;
}
- (void)setStoreKitLauncher:(id<StoreKitLauncher>)storeKitLauncher {
- storeKitLauncher_.reset(storeKitLauncher);
+ StoreKitTabHelper* tab_helper =
+ StoreKitTabHelper::FromWebState(self.webState);
+ if (tab_helper)
+ tab_helper->SetLauncher(storeKitLauncher);
}
// Swap out the existing session history with a new list of navigations. Forces
@@ -1212,7 +1215,6 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
self.overscrollActionsControllerDelegate = nil;
self.passKitDialogProvider = nil;
self.snapshotOverlayProvider = nil;
- self.storeKitLauncher = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -1451,11 +1453,13 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
}
- (id<CRWNativeContent>)controllerForUnhandledContentAtURL:(const GURL&)url {
+ id<StoreKitLauncher> storeKitLauncher =
sdefresne 2017/03/06 19:44:03 The tab helper may be null during tests, can you c
pkl (ping after 24h if needed) 2017/03/07 01:17:54 Done.
+ StoreKitTabHelper::FromWebState(self.webState)->GetLauncher();
DownloadManagerController* downloadController =
[[[DownloadManagerController alloc]
initWithURL:url
requestContextGetter:browserState_->GetRequestContext()
- storeKitLauncher:self.storeKitLauncher] autorelease];
+ storeKitLauncher:storeKitLauncher] autorelease];
[downloadController start];
return downloadController;
}
@@ -1557,7 +1561,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
#pragma mark -
- (void)openAppStore:(NSString*)appId {
- [storeKitLauncher_ openAppStore:appId];
+ StoreKitTabHelper::FromWebState(self.webState)->OpenAppStore(appId);
sdefresne 2017/03/06 19:44:03 The tab helper may be null during tests, can you c
pkl (ping after 24h if needed) 2017/03/07 01:17:54 Done.
}
- (BOOL)usesDesktopUserAgent {
@@ -2197,8 +2201,7 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
DCHECK(!nativeAppNavigationController_);
nativeAppNavigationController_.reset([[NativeAppNavigationController alloc]
initWithWebState:self.webState
- requestContextGetter:browserState_->GetRequestContext()
- tab:self]);
+ requestContextGetter:browserState_->GetRequestContext()]);
[self.webController addObserver:nativeAppNavigationController_];
DCHECK(nativeAppNavigationController_);
}

Powered by Google App Engine
This is Rietveld 408576698