Rename widget to search widget and use new bundleid to always build.
Using the newly created bundleid and mobileprovision, the search widget can be integrated in the application alongside the current today widget. When running on device after this check-in, it is necessary to install the SearchTodayExtension mobileprovision. BUG=622743, 682230 Review-Url: https://codereview.chromium.org/2814783003 Cr-Commit-Position: refs/heads/master@{#465606}
This commit is contained in:
docs/ios
ios
BUILD.gn
build
chrome
app
search_widget_extension
BUILD.gnDEPSInfo.plistOWNERS
entitlements
search_widget_view.hsearch_widget_view.mmsearch_widget_view_controller.hsearch_widget_view_controller.mmwidget_extension
@ -142,6 +142,7 @@ application extensions:
|
||||
- `${prefix}.chrome.ios.herebedragons`
|
||||
- `${prefix}.chrome.ios.herebedragons.ShareExtension`
|
||||
- `${prefix}.chrome.ios.herebedragons.TodayExtension`
|
||||
- `${prefix}.chrome.ios.herebedragons.SearchTodayExtension`
|
||||
|
||||
All these certificates need to have the "App Groups"
|
||||
(`com.apple.security.application-groups`) capability enabled for
|
||||
|
@ -40,9 +40,9 @@ group("all") {
|
||||
deps = [
|
||||
# List all the targets that need to be build on iOS by default.
|
||||
"//ios/chrome/app:chrome",
|
||||
"//ios/chrome/search_widget_extension",
|
||||
"//ios/chrome/share_extension",
|
||||
"//ios/chrome/today_extension",
|
||||
"//ios/chrome/widget_extension",
|
||||
"//ios/clean/chrome/app:chrome_clean_skeleton",
|
||||
"//ios/showcase",
|
||||
"//ios/web/shell:ios_web_shell",
|
||||
|
@ -9,7 +9,7 @@ import("//build/config/mac/symbols.gni")
|
||||
declare_args() {
|
||||
# Enable today extension.
|
||||
ios_enable_today_extension = true
|
||||
ios_enable_widget_extension = false
|
||||
ios_enable_search_widget_extension = true
|
||||
|
||||
# Enable share extension.
|
||||
ios_enable_share_extension = true
|
||||
@ -29,8 +29,6 @@ declare_args() {
|
||||
# entitlements.
|
||||
ios_egtests_entitlements_additions = []
|
||||
}
|
||||
assert(!(ios_enable_today_extension && ios_enable_widget_extension),
|
||||
"Both today extensions cannot be enabled simultaneously.")
|
||||
|
||||
# Configure whether breakpad support is enabled.
|
||||
breakpad_enabled = is_official_build && is_chrome_branded
|
||||
|
@ -274,8 +274,8 @@ ios_app_bundle("chrome") {
|
||||
if (ios_enable_today_extension) {
|
||||
deps += [ ":today_extension_bundle" ]
|
||||
}
|
||||
if (ios_enable_widget_extension) {
|
||||
deps += [ ":widget_extension_bundle" ]
|
||||
if (ios_enable_search_widget_extension) {
|
||||
deps += [ ":search_widget_extension_bundle" ]
|
||||
}
|
||||
if (ios_enable_share_extension) {
|
||||
deps += [ ":share_extension_bundle" ]
|
||||
@ -314,22 +314,16 @@ if (current_toolchain == default_toolchain) {
|
||||
}
|
||||
}
|
||||
|
||||
if (ios_enable_widget_extension) {
|
||||
bundle_data("widget_extension_bundle") {
|
||||
if (ios_enable_search_widget_extension) {
|
||||
bundle_data("search_widget_extension_bundle") {
|
||||
public_deps = [
|
||||
"//ios/chrome/widget_extension",
|
||||
"//ios/chrome/search_widget_extension",
|
||||
]
|
||||
sources = [
|
||||
"$root_out_dir/widget_extension.appex",
|
||||
"$root_out_dir/search_widget_extension.appex",
|
||||
]
|
||||
|
||||
# The output is renamed today_extension.appex so that signing in canary
|
||||
# works and clobbering is not necessary when switching between this
|
||||
# extension and the today extension.
|
||||
# TODO(crbug.com/682230) : Rename this when widget gets its own
|
||||
# mobileprovision.
|
||||
outputs = [
|
||||
"{{bundle_plugins_dir}}/today_extension.appex",
|
||||
"{{bundle_plugins_dir}}/{{source_file_part}}",
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -14,17 +14,17 @@ tweak_info_plist("tweak_info_plist") {
|
||||
compile_plist("entitlements") {
|
||||
format = "xml1"
|
||||
substitutions = [ "IOS_BUNDLE_ID_PREFIX=$ios_app_bundle_id_prefix" ]
|
||||
output_name = "$target_gen_dir/today_extension.appex.entitlements"
|
||||
output_name = "$target_gen_dir/search_widget_extension.appex.entitlements"
|
||||
plist_templates =
|
||||
[ "entitlements/external/widget_extension.appex.entitlements" ]
|
||||
[ "entitlements/external/search_widget_extension.appex.entitlements" ]
|
||||
}
|
||||
|
||||
ios_appex_bundle("widget_extension") {
|
||||
ios_appex_bundle("search_widget_extension") {
|
||||
sources = [
|
||||
"widget_view.h",
|
||||
"widget_view.mm",
|
||||
"widget_view_controller.h",
|
||||
"widget_view_controller.mm",
|
||||
"search_widget_view.h",
|
||||
"search_widget_view.mm",
|
||||
"search_widget_view_controller.h",
|
||||
"search_widget_view_controller.mm",
|
||||
]
|
||||
|
||||
deps = [
|
||||
@ -52,11 +52,7 @@ ios_appex_bundle("widget_extension") {
|
||||
extra_substitutions = [
|
||||
"CHROME_CHANNEL_SCHEME=$url_channel_scheme",
|
||||
"CHROMIUM_SHORT_NAME=$chromium_short_name",
|
||||
|
||||
# The widget_extension and today_extension are using the same provisioning
|
||||
# profile during development work.
|
||||
# TODO(crbug.com/682238) : Request provisioning profile if widget is kept.
|
||||
"WIDGET_EXTENSION_BUNDLE_ID=$chromium_bundle_id.TodayExtension",
|
||||
"WIDGET_EXTENSION_BUNDLE_ID=$chromium_bundle_id.SearchTodayExtension",
|
||||
]
|
||||
|
||||
configs += [ "//build/config/compiler:enable_arc" ]
|
@ -7,13 +7,13 @@
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>${CHROMIUM_SHORT_NAME}</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>widget_extension</string>
|
||||
<string>search_widget_extension</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>${IOS_BUNDLE_ID_PREFIX}.${WIDGET_EXTENSION_BUNDLE_ID}</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>widget_extension</string>
|
||||
<string>search_widget_extension</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>XPC!</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
@ -25,7 +25,7 @@
|
||||
<key>NSExtension</key>
|
||||
<dict>
|
||||
<key>NSExtensionPrincipalClass</key>
|
||||
<string>WidgetViewController</string>
|
||||
<string>SearchWidgetViewController</string>
|
||||
<key>NSExtensionPointIdentifier</key>
|
||||
<string>com.apple.widget-extension</string>
|
||||
</dict>
|
20
ios/chrome/widget_extension/widget_view.h → ios/chrome/search_widget_extension/search_widget_view.h
20
ios/chrome/widget_extension/widget_view.h → ios/chrome/search_widget_extension/search_widget_view.h
@ -2,14 +2,14 @@
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_
|
||||
#define IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_
|
||||
#ifndef IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_
|
||||
#define IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_H_
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
// Protocol to be implemented by targets for user actions coming from the widget
|
||||
// view.
|
||||
@protocol WidgetViewActionTarget
|
||||
// Protocol to be implemented by targets for user actions coming from the search
|
||||
// widget view.
|
||||
@protocol SearchWidgetViewActionTarget
|
||||
|
||||
// Called when the user taps the Search button.
|
||||
- (void)openSearch:(id)sender;
|
||||
@ -24,13 +24,13 @@
|
||||
|
||||
@end
|
||||
|
||||
// View for the widget. Shows a blinking cursor for a fake omnibox and calls the
|
||||
// target when tapped.
|
||||
@interface WidgetView : UIView
|
||||
// View for the search widget. Shows a blinking cursor for a fake omnibox and
|
||||
// calls the target when tapped.
|
||||
@interface SearchWidgetView : UIView
|
||||
|
||||
// Designated initializer, creates the widget view with a |target| for user
|
||||
// actions.
|
||||
- (instancetype)initWithActionTarget:(id<WidgetViewActionTarget>)target
|
||||
- (instancetype)initWithActionTarget:(id<SearchWidgetViewActionTarget>)target
|
||||
NS_DESIGNATED_INITIALIZER;
|
||||
- (instancetype)initWithFrame:(CGRect)frame NS_UNAVAILABLE;
|
||||
- (instancetype)initWithCoder:(NSCoder*)aDecoder NS_UNAVAILABLE;
|
||||
@ -40,4 +40,4 @@
|
||||
|
||||
@end
|
||||
|
||||
#endif // IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_H_
|
||||
#endif // IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_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/widget_extension/widget_view.h"
|
||||
#import "ios/chrome/search_widget_extension/search_widget_view.h"
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
@ -21,8 +21,8 @@ const CGFloat kFakeboxVerticalPadding = 40;
|
||||
|
||||
} // namespace
|
||||
|
||||
@interface WidgetView () {
|
||||
__weak id<WidgetViewActionTarget> _target;
|
||||
@interface SearchWidgetView () {
|
||||
__weak id<SearchWidgetViewActionTarget> _target;
|
||||
}
|
||||
|
||||
@property(nonatomic, copy) NSString* copiedURL;
|
||||
@ -35,14 +35,14 @@ const CGFloat kFakeboxVerticalPadding = 40;
|
||||
|
||||
@end
|
||||
|
||||
@implementation WidgetView
|
||||
@implementation SearchWidgetView
|
||||
|
||||
@synthesize copiedURL = _copiedURL;
|
||||
@synthesize copiedURLLabel = _copiedURLLabel;
|
||||
|
||||
@synthesize cursor = _cursor;
|
||||
|
||||
- (instancetype)initWithActionTarget:(id<WidgetViewActionTarget>)target {
|
||||
- (instancetype)initWithActionTarget:(id<SearchWidgetViewActionTarget>)target {
|
||||
self = [super initWithFrame:CGRectZero];
|
||||
if (self) {
|
||||
DCHECK(target);
|
@ -0,0 +1,15 @@
|
||||
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_CONTROLLER_H_
|
||||
#define IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_CONTROLLER_H_
|
||||
|
||||
#import <NotificationCenter/NotificationCenter.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface SearchWidgetViewController : UIViewController<NCWidgetProviding>
|
||||
|
||||
@end
|
||||
|
||||
#endif // IOS_CHROME_SEARCH_WIDGET_EXTENSION_SEARCH_WIDGET_VIEW_CONTROLLER_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/widget_extension/widget_view_controller.h"
|
||||
#import "ios/chrome/search_widget_extension/search_widget_view_controller.h"
|
||||
|
||||
#import <NotificationCenter/NotificationCenter.h>
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include "base/strings/sys_string_conversions.h"
|
||||
#include "components/open_from_clipboard/clipboard_recent_content_impl_ios.h"
|
||||
#include "ios/chrome/common/app_group/app_group_constants.h"
|
||||
#import "ios/chrome/widget_extension/widget_view.h"
|
||||
#import "ios/chrome/search_widget_extension/search_widget_view.h"
|
||||
|
||||
#if !defined(__has_feature) || !__has_feature(objc_arc)
|
||||
#error "This file requires ARC support."
|
||||
@ -25,8 +25,8 @@ namespace {
|
||||
NSString* const kXCallbackURLHost = @"x-callback-url";
|
||||
} // namespace
|
||||
|
||||
@interface WidgetViewController ()<WidgetViewActionTarget>
|
||||
@property(nonatomic, weak) WidgetView* widgetView;
|
||||
@interface SearchWidgetViewController ()<SearchWidgetViewActionTarget>
|
||||
@property(nonatomic, weak) SearchWidgetView* widgetView;
|
||||
@property(nonatomic, strong) NSURL* copiedURL;
|
||||
@property(nonatomic, strong)
|
||||
ClipboardRecentContentImplIOS* clipboardRecentContent;
|
||||
@ -45,7 +45,7 @@ NSString* const kXCallbackURLHost = @"x-callback-url";
|
||||
|
||||
@end
|
||||
|
||||
@implementation WidgetViewController
|
||||
@implementation SearchWidgetViewController
|
||||
|
||||
@synthesize widgetView = _widgetView;
|
||||
@synthesize copiedURL = _copiedURL;
|
||||
@ -70,7 +70,8 @@ NSString* const kXCallbackURLHost = @"x-callback-url";
|
||||
|
||||
// A local variable is necessary here as the property is declared weak and the
|
||||
// object would be deallocated before being retained by the addSubview call.
|
||||
WidgetView* widgetView = [[WidgetView alloc] initWithActionTarget:self];
|
||||
SearchWidgetView* widgetView =
|
||||
[[SearchWidgetView alloc] initWithActionTarget:self];
|
||||
self.widgetView = widgetView;
|
||||
[self.view addSubview:self.widgetView];
|
||||
|
||||
@ -172,9 +173,10 @@ NSString* const kXCallbackURLHost = @"x-callback-url";
|
||||
[[NSUserDefaults alloc] initWithSuiteName:app_group::ApplicationGroup()];
|
||||
NSString* defaultsKey =
|
||||
base::SysUTF8ToNSString(app_group::kChromeAppGroupCommandPreference);
|
||||
[sharedDefaults setObject:[WidgetViewController dictForCommand:command
|
||||
parameter:parameter]
|
||||
forKey:defaultsKey];
|
||||
[sharedDefaults
|
||||
setObject:[SearchWidgetViewController dictForCommand:command
|
||||
parameter:parameter]
|
||||
forKey:defaultsKey];
|
||||
[sharedDefaults synchronize];
|
||||
|
||||
NSString* scheme = base::mac::ObjCCast<NSString>([[NSBundle mainBundle]
|
@ -1,15 +0,0 @@
|
||||
// Copyright 2017 The Chromium Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_CONTROLLER_H_
|
||||
#define IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_CONTROLLER_H_
|
||||
|
||||
#import <NotificationCenter/NotificationCenter.h>
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
@interface WidgetViewController : UIViewController<NCWidgetProviding>
|
||||
|
||||
@end
|
||||
|
||||
#endif // IOS_CHROME_WIDGET_EXTENSION_WIDGET_VIEW_CONTROLLER_H_
|
Reference in New Issue
Block a user