Commit 390f99c0 authored by mrefaat's avatar mrefaat Committed by Commit Bot

Rename iTunesLinksHandlerTabHelper to ITunesUrlsHandlerTabHelper

It's more appropriate as the tabhelper handle urls not links.

Bug: 841615
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I7f852766712545574a1d07eeaa21e871f064a97a
Reviewed-on: https://chromium-review.googlesource.com/1053359
Commit-Queue: Mohammad Refaat <mrefaat@chromium.org>
Reviewed-by: default avatarEugene But <eugenebut@chromium.org>
Cr-Commit-Position: refs/heads/master@{#557630}
parent 36d9cd71
......@@ -116,7 +116,7 @@ source_set("browser") {
"//ios/chrome/browser/browsing_data:features",
"//ios/chrome/browser/download",
"//ios/chrome/browser/drag_and_drop",
"//ios/chrome/browser/itunes_links",
"//ios/chrome/browser/itunes_urls",
"//ios/chrome/browser/mailto:features",
"//ios/chrome/browser/payments:constants",
"//ios/chrome/browser/ssl:features",
......
......@@ -42,7 +42,7 @@
#include "ios/chrome/browser/chrome_switches.h"
#include "ios/chrome/browser/drag_and_drop/drag_and_drop_flag.h"
#include "ios/chrome/browser/ios_chrome_flag_descriptions.h"
#include "ios/chrome/browser/itunes_links/itunes_links_flag.h"
#include "ios/chrome/browser/itunes_urls/itunes_urls_flag.h"
#include "ios/chrome/browser/mailto/features.h"
#include "ios/chrome/browser/ssl/captive_portal_features.h"
#include "ios/chrome/browser/ui/external_search/features.h"
......@@ -264,10 +264,10 @@ const flags_ui::FeatureEntry kFeatureEntries[] = {
{"new-tools_menu", flag_descriptions::kNewToolsMenuName,
flag_descriptions::kNewToolsMenuDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(kNewToolsMenu)},
{"itunes-links-store-kit-handling",
flag_descriptions::kITunesLinksStoreKitHandlingName,
flag_descriptions::kITunesLinksStoreKitHandlingDescription,
flags_ui::kOsIos, FEATURE_VALUE_TYPE(kITunesLinksStoreKitHandling)},
{"itunes-urls-store-kit-handling",
flag_descriptions::kITunesUrlsStoreKitHandlingName,
flag_descriptions::kITunesUrlsStoreKitHandlingDescription,
flags_ui::kOsIos, FEATURE_VALUE_TYPE(kITunesUrlsStoreKitHandling)},
{"unified-consent", flag_descriptions::kUnifiedConsentName,
flag_descriptions::kUnifiedConsentDescription, flags_ui::kOsIos,
FEATURE_VALUE_TYPE(signin::kUnifiedConsent)},
......
......@@ -114,10 +114,11 @@ const char kInProductHelpDemoModeDescription[] =
"an individual promotion causes that promotion but no other promotions to "
"occur.";
const char kITunesLinksStoreKitHandlingName[] = "Store kit for ITunes links";
const char kITunesLinksStoreKitHandlingDescription[] =
"When enabled, opening itunes product links will be handled using the "
"store kit.";
const char kITunesUrlsStoreKitHandlingName[] =
"Store kit handling for ITunes links";
const char kITunesUrlsStoreKitHandlingDescription[] =
"When enabled, opening itunes product URLs will be handled using the store "
"kit.";
const char kMailtoHandlingWithGoogleUIName[] = "Mailto Handling with Google UI";
const char kMailtoHandlingWithGoogleUIDescription[] =
......
......@@ -92,8 +92,8 @@ extern const char kInProductHelpDemoModeName[];
extern const char kInProductHelpDemoModeDescription[];
// Title and description for the flag to enable ITunes links store kit handling.
extern const char kITunesLinksStoreKitHandlingName[];
extern const char kITunesLinksStoreKitHandlingDescription[];
extern const char kITunesUrlsStoreKitHandlingName[];
extern const char kITunesUrlsStoreKitHandlingDescription[];
// Title, description, and options for Google UI menu for handling mailto links.
extern const char kMailtoHandlingWithGoogleUIName[];
......
......@@ -2,13 +2,13 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
source_set("itunes_links") {
source_set("itunes_urls") {
configs += [ "//build/config/compiler:enable_arc" ]
sources = [
"itunes_links_flag.h",
"itunes_links_flag.mm",
"itunes_links_handler_tab_helper.h",
"itunes_links_handler_tab_helper.mm",
"itunes_urls_flag.h",
"itunes_urls_flag.mm",
"itunes_urls_handler_tab_helper.h",
"itunes_urls_handler_tab_helper.mm",
]
deps = [
"//base",
......@@ -22,10 +22,10 @@ source_set("unit_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"itunes_links_handler_tab_helper_unittest.mm",
"itunes_urls_handler_tab_helper_unittest.mm",
]
deps = [
":itunes_links",
":itunes_urls",
"//base",
"//base/test:test_support",
"//ios/chrome/browser/browser_state:test_support",
......
jif@chromium.org
eugenebut@chromium.org
mrefaat@chromium.org
# TEAM: ios-directory-owners@chromium.org
# OS: iOS
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_ITUNES_LINKS_ITUNES_LINKS_FLAG_H_
#define IOS_CHROME_BROWSER_ITUNES_LINKS_ITUNES_LINKS_FLAG_H_
#ifndef IOS_CHROME_BROWSER_ITUNES_URLS_ITUNES_URLS_FLAG_H_
#define IOS_CHROME_BROWSER_ITUNES_URLS_ITUNES_URLS_FLAG_H_
#include "base/feature_list.h"
extern const base::Feature kITunesLinksStoreKitHandling;
extern const base::Feature kITunesUrlsStoreKitHandling;
#endif // IOS_CHROME_BROWSER_ITUNES_LINKS_ITUNES_LINKS_FLAG_H
#endif // IOS_CHROME_BROWSER_ITUNES_URLS_ITUNES_URLS_FLAG_H
......@@ -2,11 +2,11 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ios/chrome/browser/itunes_links/itunes_links_flag.h"
#include "ios/chrome/browser/itunes_urls/itunes_urls_flag.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
const base::Feature kITunesLinksStoreKitHandling{
"ITunesLinksStoreKitHandling", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kITunesUrlsStoreKitHandling{
"ITunesUrlsStoreKitHandling", base::FEATURE_ENABLED_BY_DEFAULT};
......@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef IOS_CHROME_BROWSER_ITUNES_LINKS_ITUNES_LINKS_HANDLER_TAB_HELPER_H_
#define IOS_CHROME_BROWSER_ITUNES_LINKS_ITUNES_LINKS_HANDLER_TAB_HELPER_H_
#ifndef IOS_CHROME_BROWSER_ITUNES_URLS_ITUNES_URLS_HANDLER_TAB_HELPER_H_
#define IOS_CHROME_BROWSER_ITUNES_URLS_ITUNES_URLS_HANDLER_TAB_HELPER_H_
#include "base/macros.h"
#import "ios/web/public/web_state/web_state_policy_decider.h"
......@@ -33,12 +33,12 @@ enum class ITunesUrlsStoreKitHandlingResult {
// StoreKitTabHelper to present the information of that product. The goal of
// this class is to workaround a bug where appstore website serves the wrong
// content for itunes.apple.com pages, see http://crbug.com/623016.
class ITunesLinksHandlerTabHelper
class ITunesUrlsHandlerTabHelper
: public web::WebStatePolicyDecider,
public web::WebStateUserData<ITunesLinksHandlerTabHelper> {
public web::WebStateUserData<ITunesUrlsHandlerTabHelper> {
public:
~ITunesLinksHandlerTabHelper() override;
explicit ITunesLinksHandlerTabHelper(web::WebState* web_state);
~ITunesUrlsHandlerTabHelper() override;
explicit ITunesUrlsHandlerTabHelper(web::WebState* web_state);
// web::WebStatePolicyDecider implementation
bool ShouldAllowRequest(NSURLRequest* request,
ui::PageTransition transition,
......@@ -48,7 +48,7 @@ class ITunesLinksHandlerTabHelper
// Opens the StoreKit for the given iTunes app |url|.
void HandleITunesUrl(const GURL& url);
DISALLOW_COPY_AND_ASSIGN(ITunesLinksHandlerTabHelper);
DISALLOW_COPY_AND_ASSIGN(ITunesUrlsHandlerTabHelper);
};
#endif // IOS_CHROME_BROWSER_ITUNES_LINKS_ITUNES_LINKS_HANDLER_TAB_HELPER_H_
#endif // IOS_CHROME_BROWSER_ITUNES_URLS_ITUNES_URLS_HANDLER_TAB_HELPER_H_
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/itunes_links/itunes_links_handler_tab_helper.h"
#import "ios/chrome/browser/itunes_urls/itunes_urls_handler_tab_helper.h"
#import <Foundation/Foundation.h>
#import <StoreKit/StoreKit.h>
......@@ -28,11 +28,11 @@
#error "This file requires ARC support."
#endif
DEFINE_WEB_STATE_USER_DATA_KEY(ITunesLinksHandlerTabHelper);
DEFINE_WEB_STATE_USER_DATA_KEY(ITunesUrlsHandlerTabHelper);
namespace {
// The domain for iTunes appstore links.
// The domain for iTunes appstore URLs.
const char kITunesUrlDomain[] = "itunes.apple.com";
const char kITunesProductIdPrefix[] = "id";
const char kITunesAppPathIdentifier[] = "app";
......@@ -77,7 +77,7 @@ NSDictionary* ExtractITunesProductParameters(const GURL& url) {
return params_dictionary;
}
// Returns true, if ITunesLinksHandlerTabHelper can handle the given |url|.
// Returns true, if ITunesUrlsHandlerTabHelper can handle the given |url|.
bool CanHandleUrl(const GURL& url) {
if (!IsITunesProductUrl(url))
return false;
......@@ -103,13 +103,12 @@ bool CanHandleUrl(const GURL& url) {
} // namespace
ITunesLinksHandlerTabHelper::~ITunesLinksHandlerTabHelper() = default;
ITunesUrlsHandlerTabHelper::~ITunesUrlsHandlerTabHelper() = default;
ITunesLinksHandlerTabHelper::ITunesLinksHandlerTabHelper(
web::WebState* web_state)
ITunesUrlsHandlerTabHelper::ITunesUrlsHandlerTabHelper(web::WebState* web_state)
: web::WebStatePolicyDecider(web_state) {}
bool ITunesLinksHandlerTabHelper::ShouldAllowRequest(
bool ITunesUrlsHandlerTabHelper::ShouldAllowRequest(
NSURLRequest* request,
ui::PageTransition transition,
bool from_main_frame) {
......@@ -128,7 +127,7 @@ bool ITunesLinksHandlerTabHelper::ShouldAllowRequest(
}
// private
void ITunesLinksHandlerTabHelper::HandleITunesUrl(const GURL& url) {
void ITunesUrlsHandlerTabHelper::HandleITunesUrl(const GURL& url) {
ITunesUrlsStoreKitHandlingResult handling_result =
ITunesUrlsStoreKitHandlingResult::kSingleAppUrlHandled;
StoreKitTabHelper* tab_helper = StoreKitTabHelper::FromWebState(web_state());
......
......@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#import "ios/chrome/browser/itunes_links/itunes_links_handler_tab_helper.h"
#import "ios/chrome/browser/itunes_urls/itunes_urls_handler_tab_helper.h"
#import <Foundation/Foundation.h>
......@@ -25,15 +25,15 @@ const char kITunesURLsHandlingResultHistogram[] =
"IOS.StoreKit.ITunesURLsHandlingResult";
} // namespace
class ITunesLinksHandlerTabHelperTest : public PlatformTest {
class ITunesUrlsHandlerTabHelperTest : public PlatformTest {
protected:
ITunesLinksHandlerTabHelperTest()
ITunesUrlsHandlerTabHelperTest()
: fake_launcher_([[FakeStoreKitLauncher alloc] init]),
chrome_browser_state_(TestChromeBrowserState::Builder().Build()) {
web_state_.SetBrowserState(
chrome_browser_state_->GetOriginalChromeBrowserState());
StoreKitTabHelper::CreateForWebState(&web_state_);
ITunesLinksHandlerTabHelper::CreateForWebState(&web_state_);
ITunesUrlsHandlerTabHelper::CreateForWebState(&web_state_);
StoreKitTabHelper::FromWebState(&web_state_)->SetLauncher(fake_launcher_);
}
......@@ -57,7 +57,7 @@ class ITunesLinksHandlerTabHelperTest : public PlatformTest {
};
// Verifies that iTunes URLs are not handled when in off the record mode.
TEST_F(ITunesLinksHandlerTabHelperTest, NoHandlingInOffTheRecordMode) {
TEST_F(ITunesUrlsHandlerTabHelperTest, NoHandlingInOffTheRecordMode) {
NSString* url = @"http://itunes.apple.com/us/app/app_name/id123";
EXPECT_TRUE(VerifyStoreKitLaunched(url, /*main_frame=*/true));
web_state_.SetBrowserState(
......@@ -66,7 +66,7 @@ TEST_F(ITunesLinksHandlerTabHelperTest, NoHandlingInOffTheRecordMode) {
}
// Verifies that iTunes URLs are not handled when the request is from iframe.
TEST_F(ITunesLinksHandlerTabHelperTest, NoHandlingInIframes) {
TEST_F(ITunesUrlsHandlerTabHelperTest, NoHandlingInIframes) {
EXPECT_TRUE(VerifyStoreKitLaunched(
@"http://itunes.apple.com/us/app/app_name/id123", /*main_frame=*/true));
EXPECT_FALSE(VerifyStoreKitLaunched(
......@@ -79,7 +79,7 @@ TEST_F(ITunesLinksHandlerTabHelperTest, NoHandlingInIframes) {
// Verifies that navigating to non iTunes product URLs, or not supported iTunes
// product type URLs does not launch storekit.
TEST_F(ITunesLinksHandlerTabHelperTest, NonMatchingUrlsDoesntLaunchStoreKit) {
TEST_F(ITunesUrlsHandlerTabHelperTest, NonMatchingUrlsDoesntLaunchStoreKit) {
EXPECT_FALSE(VerifyStoreKitLaunched(@"", /*main_frame=*/true));
EXPECT_FALSE(VerifyStoreKitLaunched(@"foobar", /*main_frame=*/true));
EXPECT_FALSE(VerifyStoreKitLaunched(@"foo://bar", /*main_frame=*/true));
......@@ -108,7 +108,7 @@ TEST_F(ITunesLinksHandlerTabHelperTest, NonMatchingUrlsDoesntLaunchStoreKit) {
// Verifies that navigating to URLs for a product hosted on iTunes AppStore
// with supported media type launches storekit.
TEST_F(ITunesLinksHandlerTabHelperTest, MatchingUrlsLaunchesStoreKit) {
TEST_F(ITunesUrlsHandlerTabHelperTest, MatchingUrlsLaunchesStoreKit) {
EXPECT_TRUE(VerifyStoreKitLaunched(
@"http://itunes.apple.com/us/app/app_name/id123", /*main_frame=*/true));
NSString* product_id = @"id";
......
......@@ -97,7 +97,7 @@ source_set("tabs_internal") {
"//ios/chrome/browser/history",
"//ios/chrome/browser/history:tab_helper",
"//ios/chrome/browser/infobars",
"//ios/chrome/browser/itunes_links",
"//ios/chrome/browser/itunes_urls",
"//ios/chrome/browser/language",
"//ios/chrome/browser/metrics",
"//ios/chrome/browser/metrics:metrics_internal",
......
......@@ -24,8 +24,8 @@
#include "ios/chrome/browser/history/history_tab_helper.h"
#include "ios/chrome/browser/history/top_sites_factory.h"
#import "ios/chrome/browser/infobars/infobar_manager_impl.h"
#include "ios/chrome/browser/itunes_links/itunes_links_flag.h"
#import "ios/chrome/browser/itunes_links/itunes_links_handler_tab_helper.h"
#include "ios/chrome/browser/itunes_urls/itunes_urls_flag.h"
#import "ios/chrome/browser/itunes_urls/itunes_urls_handler_tab_helper.h"
#import "ios/chrome/browser/metrics/ukm_url_recorder.h"
#import "ios/chrome/browser/passwords/password_tab_helper.h"
#include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
......@@ -80,8 +80,8 @@ void AttachTabHelpers(web::WebState* web_state, bool for_prerender) {
BlockedPopupTabHelper::CreateForWebState(web_state);
FindTabHelper::CreateForWebState(web_state);
StoreKitTabHelper::CreateForWebState(web_state);
if (base::FeatureList::IsEnabled(kITunesLinksStoreKitHandling)) {
ITunesLinksHandlerTabHelper::CreateForWebState(web_state);
if (base::FeatureList::IsEnabled(kITunesUrlsStoreKitHandling)) {
ITunesUrlsHandlerTabHelper::CreateForWebState(web_state);
}
HistoryTabHelper::CreateForWebState(web_state);
LoadTimingTabHelper::CreateForWebState(web_state);
......
......@@ -147,7 +147,7 @@ test("ios_chrome_unittests") {
"//ios/chrome/browser/find_in_page:unit_tests",
"//ios/chrome/browser/geolocation:unit_tests",
"//ios/chrome/browser/history:unit_tests",
"//ios/chrome/browser/itunes_links:unit_tests",
"//ios/chrome/browser/itunes_urls:unit_tests",
"//ios/chrome/browser/language:unit_tests",
"//ios/chrome/browser/metrics:unit_tests",
"//ios/chrome/browser/metrics:unit_tests_internal",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment