Chromium选项卡正在重置WebView中的Flash内容

时间:2013-03-14 20:26:52

标签: macos cocoa webview

我在我的项目中使用https://github.com/rsms/chromium-tabs并创建了我的应用程序,因此选项卡已注册到WebView。当我调试时,我注意到当我查看Youtube视频或任何Flash内容时,我切换了标签,然后切换回重新加载的内容或重新启动视频。这有什么理由应该讨论。

选择标签后,设置为:[self becomeFirstResponder]; 除此之外,我没有找到其他连接方式,闪存将重置,页面的其余部分将保持不变。只要不可见,我就相信它在WebView中的设置。

对于下面的评论:

我按照Github上的示例并使用MyTabContents.mm创建内容。还使用了自定义webview。

MyTabContents.mm:

-(id)initWithBaseTabContents:(CTTabContents*)baseContents {
  if (!(self = [super initWithBaseTabContents:baseContents])) return nil;
    ProgressWebView *wv = [[ProgressWebView alloc] initWithFrame:NSZeroRect];
    [wv setProgressDelegate:self];

    [[wv mainFrame] loadRequest:[[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://google.com"]]];
    [wv setShouldUpdateWhileOffscreen:YES];
    webView = wv;
  // Create a NSScrollView to which we add the NSTextView
  NSScrollView *sv = [[NSScrollView alloc] initWithFrame:NSZeroRect];
  [sv setDocumentView:wv];
  [sv setHasVerticalScroller:NO];

  // Set the NSScrollView as our view
  self.view = sv;

  return self;
}

AppDelegate.mm:

- (void)applicationDidFinishLaunching:(NSNotification *)notification {
    CTBrowserWindowController* windowController =
    [[CTBrowserWindowController alloc] initWithBrowser:[MyBrowser browser]];
    [windowController.browser addBlankTabInForeground:YES];
    [windowController showWindow:self];
}

MyBrowser.mm:

-(CTTabContents*)createBlankTabBasedOn:(CTTabContents*)baseContents {
  // Create a new instance of our tab type
    MyTabContents *contents = [[MyTabContents alloc]
                               initWithBaseTabContents:baseContents];
    [self changeLayout];
  return [contents autorelease];
}

0 个答案:

没有答案