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

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

Issue 2731553005: Introduced StoreKitTabHelper class (Closed)
Patch Set: rebase 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 2ba5b8ccdf82b2b7cf0a995426df689aac758a69..763695268744551d669478fa349ba17e63e8c46d 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_;
@@ -565,6 +562,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 =
@@ -880,14 +878,6 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
return webStateImpl_ ? &(webStateImpl_->GetNavigationManagerImpl()) : nullptr;
}
-- (id<StoreKitLauncher>)storeKitLauncher {
- return storeKitLauncher_.get();
-}
-
-- (void)setStoreKitLauncher:(id<StoreKitLauncher>)storeKitLauncher {
- storeKitLauncher_.reset(storeKitLauncher);
-}
-
// Swap out the existing session history with a new list of navigations. Forces
// the tab to reload to update the UI accordingly. This is ok because none of
// the session history is stored in the tab; it's always fetched through the
@@ -1216,7 +1206,6 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
self.overscrollActionsControllerDelegate = nil;
self.passKitDialogProvider = nil;
self.snapshotOverlayProvider = nil;
- self.storeKitLauncher = nil;
[[NSNotificationCenter defaultCenter] removeObserver:self];
@@ -1455,11 +1444,17 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
}
- (id<CRWNativeContent>)controllerForUnhandledContentAtURL:(const GURL&)url {
+ StoreKitTabHelper* helper = StoreKitTabHelper::FromWebState(self.webState);
+ if (!helper)
+ return nil;
+ id<StoreKitLauncher> storeKitLauncher = helper->GetLauncher();
+ if (!storeKitLauncher)
+ return nil;
DownloadManagerController* downloadController =
[[[DownloadManagerController alloc]
initWithURL:url
requestContextGetter:browserState_->GetRequestContext()
- storeKitLauncher:self.storeKitLauncher] autorelease];
+ storeKitLauncher:storeKitLauncher] autorelease];
[downloadController start];
return downloadController;
}
@@ -1560,10 +1555,6 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
#pragma mark -
-- (void)openAppStore:(NSString*)appId {
- [storeKitLauncher_ openAppStore:appId];
-}
-
- (BOOL)usesDesktopUserAgent {
if (!self.navigationManager)
return NO;
@@ -2194,10 +2185,8 @@ void TabInfoBarObserver::OnInfoBarReplaced(infobars::InfoBar* old_infobar,
if (browserState_->IsOffTheRecord())
return;
DCHECK(!nativeAppNavigationController_);
- nativeAppNavigationController_.reset([[NativeAppNavigationController alloc]
- initWithWebState:self.webState
- requestContextGetter:browserState_->GetRequestContext()
- tab:self]);
+ nativeAppNavigationController_.reset(
+ [[NativeAppNavigationController alloc] initWithWebState:self.webState]);
DCHECK(nativeAppNavigationController_);
}

Powered by Google App Engine
This is Rietveld 408576698