FlutterViewController.mm 19.2 KB
Newer Older
1
// Copyright 2016 The Chromium Authors. All rights reserved.
C
Chinmay Garde 已提交
2 3 4
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
#import "flutter/shell/platform/darwin/ios/framework/Headers/FlutterViewController.h"
C
Chinmay Garde 已提交
6

A
Adam Barth 已提交
7 8
#include <memory>

9 10 11
#include "base/mac/scoped_block.h"
#include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h"
A
Adam Barth 已提交
12
#include "flutter/common/threads.h"
13 14 15
#include "flutter/shell/gpu/gpu_rasterizer.h"
#include "flutter/shell/gpu/gpu_surface_gl.h"
#include "flutter/shell/platform/darwin/common/platform_mac.h"
16
#include "flutter/shell/platform/darwin/common/string_conversions.h"
17
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterDartProject_Internal.h"
18
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterPlatformPlugin.h"
19 20
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputDelegate.h"
#include "flutter/shell/platform/darwin/ios/framework/Source/FlutterTextInputPlugin.h"
21
#include "flutter/shell/platform/darwin/ios/framework/Source/flutter_touch_mapper.h"
22
#include "flutter/shell/platform/darwin/ios/platform_view_ios.h"
A
Adam Barth 已提交
23
#include "lib/ftl/functional/make_copyable.h"
24
#include "lib/ftl/time/time_delta.h"
25

26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
namespace {

typedef void (^PlatformMessageResponseCallback)(NSString*);

class PlatformMessageResponseDarwin : public blink::PlatformMessageResponse {
  FRIEND_MAKE_REF_COUNTED(PlatformMessageResponseDarwin);

 public:
  void Complete(std::vector<uint8_t> data) override {
    ftl::RefPtr<PlatformMessageResponseDarwin> self(this);
    blink::Threads::Platform()->PostTask(
        ftl::MakeCopyable([ self, data = std::move(data) ]() mutable {
          self->callback_.get()(shell::GetNSStringFromVector(data));
        }));
  }

  void CompleteWithError() override { Complete(std::vector<uint8_t>()); }

 private:
45 46
  explicit PlatformMessageResponseDarwin(
      PlatformMessageResponseCallback callback)
47 48 49 50 51 52 53
      : callback_(callback, base::scoped_policy::RETAIN) {}

  base::mac::ScopedBlock<PlatformMessageResponseCallback> callback_;
};

}  // namespace

54 55
@interface FlutterViewController ()<UIAlertViewDelegate,
                                    FlutterTextInputDelegate>
56 57
@end

58
void FlutterInit(int argc, const char* argv[]) {
59 60 61 62
  // Deprecated. To be removed.
}

static void FlutterInitShell() {
63 64
  NSBundle* bundle = [NSBundle bundleForClass:[FlutterViewController class]];
  NSString* icuDataPath = [bundle pathForResource:@"icudtl" ofType:@"dat"];
65 66
  NSString* libraryName =
      [[NSBundle mainBundle] objectForInfoDictionaryKey:@"FLTLibraryPath"];
67
  shell::PlatformMacMain(icuDataPath.UTF8String,
68
                         libraryName != nil ? libraryName.UTF8String : "");
69 70
}

71
@implementation FlutterViewController {
72
  base::scoped_nsprotocol<FlutterDartProject*> _dartProject;
73
  UIInterfaceOrientationMask _orientationPreferences;
74
  UIStatusBarStyle _statusBarStyle;
75
  blink::ViewportMetrics _viewportMetrics;
76 77
  shell::TouchMapper _touchMapper;
  std::unique_ptr<shell::PlatformViewIOS> _platformView;
78
  base::scoped_nsprotocol<FlutterPlatformPlugin*> _platformPlugin;
79
  base::scoped_nsprotocol<FlutterTextInputPlugin*> _textInputPlugin;
80

81
  BOOL _initialized;
82 83
}

84 85
#pragma mark - Manage and override all designated initializers

86 87 88
- (instancetype)initWithProject:(FlutterDartProject*)project
                        nibName:(NSString*)nibNameOrNil
                         bundle:(NSBundle*)nibBundleOrNil {
89 90
  FlutterInitShell();

91
  self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
92

93
  if (self) {
94
    if (project == nil)
95 96
      _dartProject.reset(
          [[FlutterDartProject alloc] initFromDefaultSourceForConfiguration]);
97 98
    else
      _dartProject.reset([project retain]);
99 100

    [self performCommonViewControllerInitialization];
101
  }
102

103
  return self;
C
Chinmay Garde 已提交
104 105
}

106 107
- (instancetype)initWithNibName:(NSString*)nibNameOrNil
                         bundle:(NSBundle*)nibBundleOrNil {
108
  return [self initWithProject:nil nibName:nil bundle:nil];
C
Chinmay Garde 已提交
109 110
}

111
- (instancetype)initWithCoder:(NSCoder*)aDecoder {
112
  return [self initWithProject:nil nibName:nil bundle:nil];
113 114
}

115
#pragma mark - Common view controller initialization tasks
C
Chinmay Garde 已提交
116

117
- (void)performCommonViewControllerInitialization {
118
  if (_initialized)
119
    return;
120

121
  _initialized = YES;
C
Chinmay Garde 已提交
122

123
  _orientationPreferences = UIInterfaceOrientationMaskAll;
124
  _statusBarStyle = UIStatusBarStyleDefault;
A
Adam Barth 已提交
125
  _platformView = std::make_unique<shell::PlatformViewIOS>(
126 127
      reinterpret_cast<CAEAGLLayer*>(self.view.layer));
  _platformView->SetupResourceContextOnIOThread();
C
Chinmay Garde 已提交
128

129 130 131
  _platformPlugin.reset([[FlutterPlatformPlugin alloc] init]);
  [self addMessageListener:_platformPlugin.get()];

132 133 134 135
  _textInputPlugin.reset([[FlutterTextInputPlugin alloc] init]);
  _textInputPlugin.get().textInputDelegate = self;
  [self addMessageListener:_textInputPlugin.get()];

136
  [self setupNotificationCenterObservers];
C
Chinmay Garde 已提交
137

138
  [self connectToEngineAndLoad];
C
Chinmay Garde 已提交
139 140
}

141 142 143 144
- (void)setupNotificationCenterObservers {
  NSNotificationCenter* center = [NSNotificationCenter defaultCenter];
  [center addObserver:self
             selector:@selector(onOrientationPreferencesUpdated:)
A
Adam Barth 已提交
145
                 name:@(shell::kOrientationUpdateNotificationName)
146 147
               object:nil];

148 149
  [center addObserver:self
             selector:@selector(onPreferredStatusBarStyleUpdated:)
A
Adam Barth 已提交
150
                 name:@(shell::kOverlayStyleUpdateNotificationName)
151 152
               object:nil];

153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176
  [center addObserver:self
             selector:@selector(applicationBecameActive:)
                 name:UIApplicationDidBecomeActiveNotification
               object:nil];

  [center addObserver:self
             selector:@selector(applicationWillResignActive:)
                 name:UIApplicationWillResignActiveNotification
               object:nil];

  [center addObserver:self
             selector:@selector(keyboardWasShown:)
                 name:UIKeyboardDidShowNotification
               object:nil];

  [center addObserver:self
             selector:@selector(keyboardWillBeHidden:)
                 name:UIKeyboardWillHideNotification
               object:nil];

  [center addObserver:self
             selector:@selector(onLocaleUpdated:)
                 name:NSCurrentLocaleDidChangeNotification
               object:nil];
177 178 179 180 181

  [center addObserver:self
             selector:@selector(onVoiceOverChanged:)
                 name:UIAccessibilityVoiceOverStatusChanged
               object:nil];
C
Chinmay Garde 已提交
182 183
}

184
#pragma mark - Initializing the engine
185

186
- (void)alertView:(UIAlertView*)alertView
187
    clickedButtonAtIndex:(NSInteger)buttonIndex {
188 189 190
  exit(0);
}

191
- (void)connectToEngineAndLoad {
C
Chinmay Garde 已提交
192
  TRACE_EVENT0("flutter", "connectToEngineAndLoad");
193

194
  // We ask the VM to check what it supports.
195 196
  const enum VMType type =
      Dart_IsPrecompiledRuntime() ? VMTypePrecompilation : VMTypeInterpreter;
197

A
Adam Barth 已提交
198
  [_dartProject launchInEngine:&_platformView->engine()
199 200 201 202 203 204
                embedderVMType:type
                        result:^(BOOL success, NSString* message) {
                          if (!success) {
                            UIAlertView* alert = [[UIAlertView alloc]
                                    initWithTitle:@"Launch Error"
                                          message:message
205
                                         delegate:self
206 207 208 209 210 211
                                cancelButtonTitle:@"OK"
                                otherButtonTitles:nil];
                            [alert show];
                            [alert release];
                          }
                        }];
212 213 214 215 216
}

#pragma mark - Loading the view

- (void)loadView {
217
  FlutterView* view = [[FlutterView alloc] init];
218

219
  self.view = view;
220 221 222 223
  self.view.multipleTouchEnabled = YES;
  self.view.autoresizingMask =
      UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;

224
  [view release];
225 226 227 228 229
}

#pragma mark - Application lifecycle notifications

- (void)applicationBecameActive:(NSNotification*)notification {
230 231
  [self sendString:@"AppLifecycleState.resumed"
      withMessageName:@"flutter/lifecycle"];
232 233 234
}

- (void)applicationWillResignActive:(NSNotification*)notification {
235 236
  [self sendString:@"AppLifecycleState.paused"
      withMessageName:@"flutter/lifecycle"];
237 238 239 240 241 242 243 244 245 246
}

#pragma mark - Touch event handling

enum MapperPhase {
  Accessed,
  Added,
  Removed,
};

247 248
using PointerChangeMapperPhase =
    std::pair<blink::PointerData::Change, MapperPhase>;
A
Adam Barth 已提交
249
static inline PointerChangeMapperPhase PointerChangePhaseFromUITouchPhase(
250 251 252
    UITouchPhase phase) {
  switch (phase) {
    case UITouchPhaseBegan:
A
Adam Barth 已提交
253 254
      return PointerChangeMapperPhase(blink::PointerData::Change::kDown,
                                      MapperPhase::Added);
255 256 257 258
    case UITouchPhaseMoved:
    case UITouchPhaseStationary:
      // There is no EVENT_TYPE_POINTER_STATIONARY. So we just pass a move type
      // with the same coordinates
A
Adam Barth 已提交
259 260
      return PointerChangeMapperPhase(blink::PointerData::Change::kMove,
                                      MapperPhase::Accessed);
261
    case UITouchPhaseEnded:
A
Adam Barth 已提交
262 263
      return PointerChangeMapperPhase(blink::PointerData::Change::kUp,
                                      MapperPhase::Removed);
264
    case UITouchPhaseCancelled:
A
Adam Barth 已提交
265 266
      return PointerChangeMapperPhase(blink::PointerData::Change::kCancel,
                                      MapperPhase::Removed);
267 268
  }

A
Adam Barth 已提交
269 270
  return PointerChangeMapperPhase(blink::PointerData::Change::kCancel,
                                  MapperPhase::Accessed);
271
}
C
Chinmay Garde 已提交
272 273

- (void)dispatchTouches:(NSSet*)touches phase:(UITouchPhase)phase {
A
Adam Barth 已提交
274
  auto eventTypePhase = PointerChangePhaseFromUITouchPhase(phase);
C
Chinmay Garde 已提交
275
  const CGFloat scale = [UIScreen mainScreen].scale;
A
Adam Barth 已提交
276
  auto packet = std::make_unique<blink::PointerDataPacket>(touches.count);
C
Chinmay Garde 已提交
277

A
Adam Barth 已提交
278
  int i = 0;
C
Chinmay Garde 已提交
279
  for (UITouch* touch in touches) {
280
    int device_id = 0;
281 282 283

    switch (eventTypePhase.second) {
      case Accessed:
284
        device_id = _touchMapper.identifierOf(touch);
285 286
        break;
      case Added:
287
        device_id = _touchMapper.registerTouch(touch);
288 289
        break;
      case Removed:
290
        device_id = _touchMapper.unregisterTouch(touch);
291 292
        break;
    }
293

294
    DCHECK(device_id != 0);
C
Chinmay Garde 已提交
295
    CGPoint windowCoordinates = [touch locationInView:nil];
296

A
Adam Barth 已提交
297 298 299
    blink::PointerData pointer_data;
    pointer_data.Clear();

300 301
    constexpr int kMicrosecondsPerSecond = 1000 * 1000;
    pointer_data.time_stamp = touch.timestamp * kMicrosecondsPerSecond;
A
Adam Barth 已提交
302 303
    pointer_data.change = eventTypePhase.first;
    pointer_data.kind = blink::PointerData::DeviceKind::kTouch;
304
    pointer_data.device = device_id;
A
Adam Barth 已提交
305 306 307 308 309 310
    pointer_data.physical_x = windowCoordinates.x * scale;
    pointer_data.physical_y = windowCoordinates.y * scale;
    pointer_data.pressure = 1.0;
    pointer_data.pressure_max = 1.0;

    packet->SetPointerData(i++, pointer_data);
C
Chinmay Garde 已提交
311
  }
312

A
Adam Barth 已提交
313
  blink::Threads::UI()->PostTask(ftl::MakeCopyable([
314 315 316 317 318
    engine = _platformView->engine().GetWeakPtr(), packet = std::move(packet)
  ] {
    if (engine.get())
      engine->DispatchPointerDataPacket(*packet);
  }));
C
Chinmay Garde 已提交
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336
}

- (void)touchesBegan:(NSSet*)touches withEvent:(UIEvent*)event {
  [self dispatchTouches:touches phase:UITouchPhaseBegan];
}

- (void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event {
  [self dispatchTouches:touches phase:UITouchPhaseMoved];
}

- (void)touchesEnded:(NSSet*)touches withEvent:(UIEvent*)event {
  [self dispatchTouches:touches phase:UITouchPhaseEnded];
}

- (void)touchesCancelled:(NSSet*)touches withEvent:(UIEvent*)event {
  [self dispatchTouches:touches phase:UITouchPhaseCancelled];
}

337
#pragma mark - Handle view resizing
338

339 340
- (void)updateViewportMetrics {
  blink::Threads::UI()->PostTask([
341
    weak_platform_view = _platformView->GetWeakPtr(), metrics = _viewportMetrics
342
  ] {
343 344 345 346 347
    if (!weak_platform_view) {
      return;
    }
    weak_platform_view->UpdateSurfaceSize();
    weak_platform_view->engine().SetViewportMetrics(metrics);
348 349 350
  });
}

351
- (bool)isWindowFullscreen {
352
  UIWindow* window = self.view.window;
353 354 355 356 357 358 359 360 361 362 363 364 365 366
  return CGRectEqualToRect(window.frame, window.screen.bounds);
}

- (CGFloat)statusBarPadding {
  // If we're a child of a containing view, let the container apply padding.
  if (self.parentViewController != nil) {
    return 0.0;
  }

  // If not fullscreen, assume we don't want padding.
  if (![self isWindowFullscreen]) {
    return 0.0;
  }

367
  UIScreen* screen = self.view.window.screen;
368 369 370
  CGRect statusFrame = [UIApplication sharedApplication].statusBarFrame;
  CGRect viewFrame = [self.view convertRect:self.view.bounds
                          toCoordinateSpace:screen.coordinateSpace];
371 372
  CGFloat padding =
      statusFrame.origin.y + statusFrame.size.height - viewFrame.origin.y;
373 374 375
  return MAX(padding, 0.0);
}

376
- (void)viewDidLayoutSubviews {
377
  CGSize viewSize = self.view.bounds.size;
378 379
  CGFloat scale = [UIScreen mainScreen].scale;

380
  _viewportMetrics.device_pixel_ratio = scale;
381 382
  _viewportMetrics.physical_width = viewSize.width * scale;
  _viewportMetrics.physical_height = viewSize.height * scale;
383
  _viewportMetrics.physical_padding_top = [self statusBarPadding] * scale;
384
  [self updateViewportMetrics];
385 386
}

387
#pragma mark - Keyboard events
388

389 390 391 392 393
- (void)keyboardWasShown:(NSNotification*)notification {
  NSDictionary* info = [notification userInfo];
  CGFloat bottom = CGRectGetHeight(
      [[info objectForKey:UIKeyboardFrameBeginUserInfoKey] CGRectValue]);
  CGFloat scale = [UIScreen mainScreen].scale;
394 395
  _viewportMetrics.physical_padding_bottom = bottom * scale;
  [self updateViewportMetrics];
396 397
}

398
- (void)keyboardWillBeHidden:(NSNotification*)notification {
399 400
  _viewportMetrics.physical_padding_bottom = 0;
  [self updateViewportMetrics];
401 402
}

403 404 405
#pragma mark - Text input delegate

- (void)updateEditingClient:(int)client withState:(NSDictionary*)state {
406 407 408 409 410
  NSDictionary* message = @{
    @"method" : @"TextInputClient.updateEditingState",
    @"args" : @[ @(client), state ],
  };
  [self sendJSON:message withMessageName:@"flutter/textinputclient"];
411 412
}

413 414 415 416 417 418 419
#pragma mark - Orientation updates

- (void)onOrientationPreferencesUpdated:(NSNotification*)notification {
  // Notifications may not be on the iOS UI thread
  dispatch_async(dispatch_get_main_queue(), ^{
    NSDictionary* info = notification.userInfo;

420
    NSNumber* update = info[@(shell::kOrientationUpdateNotificationKey)];
421 422 423 424 425 426 427 428 429 430 431 432

    if (update == nil) {
      return;
    }

    NSUInteger new_preferences = update.unsignedIntegerValue;

    if (new_preferences != _orientationPreferences) {
      _orientationPreferences = new_preferences;
      [UIViewController attemptRotationToDeviceOrientation];
    }
  });
433 434
}

435 436
- (BOOL)shouldAutorotate {
  return YES;
437 438
}

439 440 441 442
- (NSUInteger)supportedInterfaceOrientations {
  return _orientationPreferences;
}

443 444 445 446 447 448 449
#pragma mark - Accessibility

- (void)onVoiceOverChanged:(NSNotification*)notification {
#if TARGET_OS_SIMULATOR
  // There doesn't appear to be any way to determine whether the accessibility
  // inspector is enabled on the simulator. We conservatively always turn on the
  // accessibility bridge in the simulator.
450
  bool enabled = true;
451
#else
452
  bool enabled = UIAccessibilityIsVoiceOverRunning();
453
#endif
454
  _platformView->ToggleAccessibility(self.view, enabled);
455 456
}

457 458 459 460 461 462
#pragma mark - Locale updates

- (void)onLocaleUpdated:(NSNotification*)notification {
  NSLocale* currentLocale = [NSLocale currentLocale];
  NSString* languageCode = [currentLocale objectForKey:NSLocaleLanguageCode];
  NSString* countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
463 464 465 466
  NSDictionary* message =
      @{ @"method" : @"setLocale",
         @"args" : @[ languageCode, countryCode ] };
  [self sendJSON:message withMessageName:@"flutter/localization"];
467 468 469 470 471
}

#pragma mark - Surface creation and teardown updates

- (void)surfaceUpdated:(BOOL)appeared {
472
  CHECK(_platformView != nullptr);
473 474

  if (appeared) {
475 476
    _platformView->NotifyCreated(
        std::make_unique<shell::GPUSurfaceGL>(_platformView.get()));
477
  } else {
478
    _platformView->NotifyDestroyed();
479 480 481
  }
}

482 483
- (void)viewDidAppear:(BOOL)animated {
  [self surfaceUpdated:YES];
484 485
  [self onLocaleUpdated:nil];
  [self onVoiceOverChanged:nil];
486 487

  [super viewWillAppear:animated];
488
}
C
Chinmay Garde 已提交
489

490 491
- (void)viewWillDisappear:(BOOL)animated {
  [self surfaceUpdated:NO];
492 493

  [super viewWillDisappear:animated];
494 495
}

C
Chinmay Garde 已提交
496
- (void)dealloc {
497
  [[NSNotificationCenter defaultCenter] removeObserver:self];
498 499
  [super dealloc];
}
500

501 502 503 504 505 506 507 508 509 510 511
#pragma mark - Status bar style

- (UIStatusBarStyle)preferredStatusBarStyle {
  return _statusBarStyle;
}

- (void)onPreferredStatusBarStyleUpdated:(NSNotification*)notification {
  // Notifications may not be on the iOS UI thread
  dispatch_async(dispatch_get_main_queue(), ^{
    NSDictionary* info = notification.userInfo;

512
    NSNumber* update = info[@(shell::kOverlayStyleUpdateNotificationKey)];
513 514 515 516 517 518 519 520 521 522 523 524 525 526

    if (update == nil) {
      return;
    }

    NSInteger style = update.integerValue;

    if (style != _statusBarStyle) {
      _statusBarStyle = static_cast<UIStatusBarStyle>(style);
      [self setNeedsStatusBarAppearanceUpdate];
    }
  });
}

527
#pragma mark - Application Messages
528

529
- (void)sendString:(NSString*)message withMessageName:(NSString*)channel {
530
  NSAssert(message, @"The message must not be null");
531 532 533
  NSAssert(channel, @"The channel must not be null");
  _platformView->DispatchPlatformMessage(
      ftl::MakeRefCounted<blink::PlatformMessage>(
534
          channel.UTF8String, shell::GetVectorFromNSString(message), nullptr));
535 536 537
}

- (void)sendString:(NSString*)message
538
    withMessageName:(NSString*)channel
539
           callback:(void (^)(NSString*))callback {
540
  NSAssert(message, @"The message must not be null");
541
  NSAssert(channel, @"The channel must not be null");
542
  NSAssert(callback, @"The callback must not be null");
543 544
  _platformView->DispatchPlatformMessage(
      ftl::MakeRefCounted<blink::PlatformMessage>(
545
          channel.UTF8String, shell::GetVectorFromNSString(message),
546
          ftl::MakeRefCounted<PlatformMessageResponseDarwin>(callback)));
547 548
}

549
- (void)sendJSON:(NSDictionary*)message withMessageName:(NSString*)channel {
550 551
  NSData* data =
      [NSJSONSerialization dataWithJSONObject:message options:0 error:nil];
552 553
  if (!data)
    return;
554
  const uint8_t* bytes = static_cast<const uint8_t*>(data.bytes);
555 556
  _platformView->DispatchPlatformMessage(
      ftl::MakeRefCounted<blink::PlatformMessage>(
557
          channel.UTF8String, std::vector<uint8_t>(bytes, bytes + data.length),
558 559 560
          nullptr));
}

561
- (void)addMessageListener:(NSObject<FlutterMessageListener>*)listener {
562
  NSAssert(listener, @"The listener must not be null");
563 564
  NSString* channel = listener.messageName;
  NSAssert(channel, @"The channel must not be null");
565 566
  _platformView->platform_message_router().SetMessageListener(
      channel.UTF8String, listener);
567 568
}

569
- (void)removeMessageListener:(NSObject<FlutterMessageListener>*)listener {
570
  NSAssert(listener, @"The listener must not be null");
571 572
  NSString* channel = listener.messageName;
  NSAssert(channel, @"The channel must not be null");
573 574
  _platformView->platform_message_router().SetMessageListener(
      channel.UTF8String, nil);
575 576
}

577 578
- (void)addAsyncMessageListener:
    (NSObject<FlutterAsyncMessageListener>*)listener {
579 580 581
  NSAssert(listener, @"The listener must not be null");
  NSString* messageName = listener.messageName;
  NSAssert(messageName, @"The messageName must not be null");
582
  _platformView->platform_message_router().SetAsyncMessageListener(
583
      messageName.UTF8String, listener);
584 585
}

586 587
- (void)removeAsyncMessageListener:
    (NSObject<FlutterAsyncMessageListener>*)listener {
588 589 590
  NSAssert(listener, @"The listener must not be null");
  NSString* messageName = listener.messageName;
  NSAssert(messageName, @"The messageName must not be null");
591
  _platformView->platform_message_router().SetAsyncMessageListener(
592
      messageName.UTF8String, nil);
C
Chinmay Garde 已提交
593 594 595
}

@end