プロジェクトでhttps://github.com/rsms/chromium-tabsを使用していて、タブがWebViewに登録されるようにアプリを作成しました。デバッグしているときに、Youtubeビデオまたはフラッシュコンテンツを表示していて、タブを切り替えてから、リロードされたコンテンツを元に戻すか、ビデオを再開したことに気付きました。これが起こるべき理由はありますか?
タブを選択すると、次のように設定されます。 [self becomeFirstResponder];
それ以外に、フラッシュがリセットされ、ページの残りの部分が同じままになる他の接続方法は見つかりませんでした。WebViewの設定が表示されていないときはいつでも、その設定を信じています。
以下のコメントについて:
Githubの例に従い、MyTabContents.mmを使用してコンテンツを作成しました。カスタムWebビューも使用しました。
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];
}