Changeset 176862 in webkit
- Timestamp:
- Dec 5, 2014, 12:48:20 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r176861 r176862 1 2014-12-05 Anders Carlsson <andersca@apple.com> 2 3 Add a private browsing mode to MiniBrowser 4 https://bugs.webkit.org/show_bug.cgi?id=139308 5 6 Reviewed by Sam Weinig. 7 8 Use -1 instead of -2 for the deleted value. 9 10 * page/SessionIDHash.h: 11 1 12 2014-12-05 Chris Dumez <cdumez@apple.com> 2 13 -
trunk/Source/WebCore/page/SessionIDHash.h
r174465 r176862 33 33 namespace WTF { 34 34 35 // The empty value is emptySessionID(), the deleted value is (- 2)35 // The empty value is emptySessionID(), the deleted value is (-1) 36 36 struct SessionIDHash { 37 37 static unsigned hash(const WebCore::SessionID& p) { return (unsigned)p.sessionID(); } … … 40 40 }; 41 41 template<> struct HashTraits<WebCore::SessionID> : GenericHashTraits<WebCore::SessionID> { 42 static const uint64_t deletedValueIdentifier = 0xFFFFFFFFFFFFFFFE;42 static const uint64_t deletedValueIdentifier = std::numeric_limits<uint64_t>::max(); 43 43 static const bool needsDestruction = false; 44 44 static WebCore::SessionID emptyValue() { return WebCore::SessionID::emptySessionID(); } -
trunk/Tools/ChangeLog
r176830 r176862 1 2014-12-05 Anders Carlsson <andersca@apple.com> 2 3 Add a private browsing mode to MiniBrowser 4 https://bugs.webkit.org/show_bug.cgi?id=139308 5 6 Reviewed by Sam Weinig. 7 8 * MiniBrowser/mac/AppDelegate.m: 9 (defaultConfiguration): 10 (-[BrowserAppDelegate newWindow:]): 11 (-[BrowserAppDelegate newPrivateWindow:]): 12 * MiniBrowser/mac/MainMenu.xib: 13 * MiniBrowser/mac/WK2BrowserWindowController.h: 14 * MiniBrowser/mac/WK2BrowserWindowController.m: 15 (-[WK2BrowserWindowController awakeFromNib]): 16 (-[WK2BrowserWindowController initWithConfiguration:]): 17 (-[WK2BrowserWindowController dealloc]): 18 (-[WK2BrowserWindowController observeValueForKeyPath:ofObject:change:context:]): 19 1 20 2014-12-04 Alexey Proskuryakov <ap@apple.com> 2 21 -
trunk/Tools/MiniBrowser/mac/AppDelegate.m
r171935 r176862 29 29 #import "WK1BrowserWindowController.h" 30 30 #import "WK2BrowserWindowController.h" 31 #import <WebKit/WebHistory.h> 32 #import <WebKit/WebKit2.h> 31 #import <WebKit/WKPreferencesPrivate.h> 32 #import <WebKit/WKWebViewConfigurationPrivate.h> 33 #import <WebKit/WebKit.h> 34 #import <WebKit/_WKWebsiteDataStore.h> 33 35 34 36 enum { … … 55 57 [[NSApp mainMenu] insertItem:[item autorelease] atIndex:[[NSApp mainMenu] indexOfItemWithTitle:@"Debug"]]; 56 58 } 59 60 #if WK_API_ENABLED 61 static WKWebViewConfiguration *defaultConfiguration() 62 { 63 static WKWebViewConfiguration *configuration; 64 65 if (!configuration) { 66 configuration = [[WKWebViewConfiguration alloc] init]; 67 configuration.preferences._fullScreenEnabled = YES; 68 configuration.preferences._developerExtrasEnabled = YES; 69 } 70 71 return configuration; 72 } 73 #endif 74 57 75 58 76 - (IBAction)newWindow:(id)sender … … 71 89 #if WK_API_ENABLED 72 90 else 73 controller = [[WK2BrowserWindowController alloc] initWith WindowNibName:@"BrowserWindow"];91 controller = [[WK2BrowserWindowController alloc] initWithConfiguration:defaultConfiguration()]; 74 92 #endif 75 93 if (!controller) … … 80 98 81 99 [controller loadURLString:[SettingsController shared].defaultURL]; 100 } 101 102 - (IBAction)newPrivateWindow:(id)sender 103 { 104 #if WK_API_ENABLED 105 WKWebViewConfiguration *privateConfiguraton = [defaultConfiguration() copy]; 106 privateConfiguraton._websiteDataStore = [_WKWebsiteDataStore nonPersistentDataStore]; 107 108 BrowserWindowController *controller = [[WK2BrowserWindowController alloc] initWithConfiguration:privateConfiguraton]; 109 [privateConfiguraton release]; 110 111 [[controller window] makeKeyAndOrderFront:sender]; 112 [_browserWindowControllers addObject:controller]; 113 [controller release]; 114 115 [controller loadURLString:[SettingsController shared].defaultURL]; 116 #endif 82 117 } 83 118 -
trunk/Tools/MiniBrowser/mac/MainMenu.xib
r171926 r176862 1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion=" 5056" systemVersion="13E28" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">2 <document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7096" systemVersion="14D42" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none"> 3 3 <dependencies> 4 <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version=" 5056"/>4 <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7096"/> 5 5 </dependencies> 6 6 <objects> … … 11 11 </customObject> 12 12 <customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/> 13 <customObject id="-3" userLabel="Application" />13 <customObject id="-3" userLabel="Application" customClass="NSObject"/> 14 14 <menu title="AMainMenu" systemMenu="main" id="29"> 15 15 <items> … … 80 80 <connections> 81 81 <action selector="newWindow:" target="-1" id="572"/> 82 </connections> 83 </menuItem> 84 <menuItem title="New WebKit2 Private Window" tag="2" id="Zqs-AO-XAX"> 85 <modifierMask key="keyEquivalentModifierMask"/> 86 <connections> 87 <action selector="newPrivateWindow:" target="-1" id="mf5-zi-a5R"/> 82 88 </connections> 83 89 </menuItem> -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.h
r165749 r176862 29 29 30 30 @interface WK2BrowserWindowController : BrowserWindowController <BrowserController> 31 32 - (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration; 33 31 34 @end 32 35 -
trunk/Tools/MiniBrowser/mac/WK2BrowserWindowController.m
r176488 r176862 35 35 #import <WebKit/WKUIDelegate.h> 36 36 #import <WebKit/WKWebView.h> 37 #import <WebKit/WKWebViewConfiguration .h>37 #import <WebKit/WKWebViewConfigurationPrivate.h> 38 38 #import <WebKit/WKWebViewPrivate.h> 39 #import <WebKit/_WKWebsiteDataStore.h> 39 40 40 41 static void* keyValueObservingContext = &keyValueObservingContext; … … 44 45 45 46 @implementation WK2BrowserWindowController { 47 WKWebViewConfiguration *_configuration; 46 48 WKWebView *_webView; 47 49 BOOL _zoomTextOnly; 50 BOOL _isPrivateBrowsingWindow; 48 51 } 49 52 50 53 - (void)awakeFromNib 51 54 { 52 static WKWebViewConfiguration *configuration; 53 if (!configuration) { 54 configuration = [[WKWebViewConfiguration alloc] init]; 55 configuration.preferences._fullScreenEnabled = YES; 56 configuration.preferences._developerExtrasEnabled = YES; 57 } 58 _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:configuration]; 55 _webView = [[WKWebView alloc] initWithFrame:[containerView bounds] configuration:_configuration]; 59 56 [self didChangeSettings]; 60 57 … … 77 74 } 78 75 76 - (instancetype)initWithConfiguration:(WKWebViewConfiguration *)configuration 77 { 78 if (!(self = [super initWithWindowNibName:@"BrowserWindow"])) 79 return nil; 80 81 _configuration = [configuration copy]; 82 _isPrivateBrowsingWindow = _configuration._websiteDataStore.isNonPersistent; 83 84 return self; 85 } 86 79 87 - (void)dealloc 80 88 { … … 86 94 87 95 [_webView release]; 96 [_configuration release]; 88 97 89 98 [super dealloc]; … … 316 325 317 326 if ([keyPath isEqualToString:@"title"]) 318 self.window.title = [ _webView.title stringByAppendingFormat:@" [WK2, %d]", _webView._webProcessIdentifier];327 self.window.title = [NSString stringWithFormat:@"%@%@ [WK2 %d]", _isPrivateBrowsingWindow ? @"🙈 " : @"", _webView.title, _webView._webProcessIdentifier]; 319 328 else if ([keyPath isEqualToString:@"URL"]) 320 329 [self updateTextFieldFromURL:_webView.URL];
Note:
See TracChangeset
for help on using the changeset viewer.