Changeset 17352 in webkit


Ignore:
Timestamp:
Oct 26, 2006 7:55:45 PM (17 years ago)
Author:
ggaren
Message:

WebCore:

Reviewed by Darin, Maciej.

Removed many uses of NSString *.
Moved a few methods from WebCoreFrameBridge to FrameLoader, replacing
stringByCollapsingNonPrintingCharacters with a c++ equivalent.


PLT says no performance regression.


  • WebCore.exp:
  • bridge/mac/WebCoreFrameBridge.mm: (-[WebCoreFrameBridge receivedData:textEncodingName:]):
  • loader/mac/FrameLoader.h:
  • loader/mac/FrameLoader.mm: (WebCore::FrameLoader::setupForReplaceByMIMEType): (WebCore::FrameLoader::load): (WebCore::FrameLoader::canShowMIMEType): (WebCore::FrameLoader::representationExistsForURLScheme): (WebCore::FrameLoader::generatedMIMETypeForURLScheme): (WebCore::FrameLoader::checkContentPolicy): (WebCore::FrameLoader::reloadAllowingStaleData): (WebCore::FrameLoader::invalidatePendingPolicyDecision): (WebCore::FrameLoader::checkNewWindowPolicy): (WebCore::FrameLoader::continueAfterNewWindowPolicy): (WebCore::FrameLoader::transitionToCommitted): (WebCore::FrameLoader::continueLoadRequestAfterNewWindowPolicy): (WebCore::FrameLoader::post):
  • loader/mac/WebDocumentLoader.h:
  • loader/mac/WebDocumentLoader.mm: (WebCore::DocumentLoader::doesProgressiveLoad): (WebCore::DocumentLoader::setupForReplaceByMIMEType): (WebCore::DocumentLoader::title): (WebCore::DocumentLoader::setOverrideEncoding): (WebCore::DocumentLoader::overrideEncoding): (WebCore::DocumentLoader::setTitle):
  • loader/mac/WebFrameLoaderClient.h:
  • loader/mac/WebMainResourceLoader.mm: (WebCore::MainResourceLoader::continueAfterContentPolicy):

WebKit:

Reviewed by Darin, Maciej.

Removed many uses of NSString * from WebCore.


Changed a few files to ObjC++ for compatiblity with new WebCore methods
taking WebCore::Strings as arguments.


Added a static_cast to make the c++ compiler happy.

Location:
trunk
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r17351 r17352  
     12006-10-26  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Darin, Maciej.
     4
     5        Removed many uses of NSString *.
     6        Moved a few methods from WebCoreFrameBridge to FrameLoader, replacing
     7        stringByCollapsingNonPrintingCharacters with a c++ equivalent.
     8       
     9        PLT says no performance regression.
     10       
     11        * WebCore.exp:
     12        * bridge/mac/WebCoreFrameBridge.mm:
     13        (-[WebCoreFrameBridge receivedData:textEncodingName:]):
     14        * loader/mac/FrameLoader.h:
     15        * loader/mac/FrameLoader.mm:
     16        (WebCore::FrameLoader::setupForReplaceByMIMEType):
     17        (WebCore::FrameLoader::load):
     18        (WebCore::FrameLoader::canShowMIMEType):
     19        (WebCore::FrameLoader::representationExistsForURLScheme):
     20        (WebCore::FrameLoader::generatedMIMETypeForURLScheme):
     21        (WebCore::FrameLoader::checkContentPolicy):
     22        (WebCore::FrameLoader::reloadAllowingStaleData):
     23        (WebCore::FrameLoader::invalidatePendingPolicyDecision):
     24        (WebCore::FrameLoader::checkNewWindowPolicy):
     25        (WebCore::FrameLoader::continueAfterNewWindowPolicy):
     26        (WebCore::FrameLoader::transitionToCommitted):
     27        (WebCore::FrameLoader::continueLoadRequestAfterNewWindowPolicy):
     28        (WebCore::FrameLoader::post):
     29        * loader/mac/WebDocumentLoader.h:
     30        * loader/mac/WebDocumentLoader.mm:
     31        (WebCore::DocumentLoader::doesProgressiveLoad):
     32        (WebCore::DocumentLoader::setupForReplaceByMIMEType):
     33        (WebCore::DocumentLoader::title):
     34        (WebCore::DocumentLoader::setOverrideEncoding):
     35        (WebCore::DocumentLoader::overrideEncoding):
     36        (WebCore::DocumentLoader::setTitle):
     37        * loader/mac/WebFrameLoaderClient.h:
     38        * loader/mac/WebMainResourceLoader.mm:
     39        (WebCore::MainResourceLoader::continueAfterContentPolicy):
     40
    1412006-10-26  Timothy Hatcher  <timothy@apple.com>
    242
  • trunk/WebCore/WebCore.exp

    r17349 r17352  
    142142__ZN7WebCore11FrameLoader22defersCallbacksChangedEv
    143143__ZN7WebCore11FrameLoader23addExtraFieldsToRequestEP19NSMutableURLRequestbb
    144 __ZN7WebCore11FrameLoader23reloadAllowingStaleDataEP8NSString
     144__ZN7WebCore11FrameLoader23reloadAllowingStaleDataERKNS_6StringE
    145145__ZN7WebCore11FrameLoader23timeOfLastCompletedLoadEv
    146146__ZN7WebCore11FrameLoader24removePlugInStreamLoaderEPNS_17WebResourceLoaderE
     
    148148__ZN7WebCore11FrameLoader4loadEP12NSURLRequest
    149149__ZN7WebCore11FrameLoader4loadEP12NSURLRequestP12NSDictionaryNS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
    150 __ZN7WebCore11FrameLoader4loadEP12NSURLRequestP8NSString
    151 __ZN7WebCore11FrameLoader4loadEP5NSURLP8NSStringNS_13FrameLoadTypeES4_P7NSEventPNS_7ElementEP12NSDictionary
     150__ZN7WebCore11FrameLoader4loadEP12NSURLRequestRKNS_6StringE
     151__ZN7WebCore11FrameLoader4loadEP5NSURLRKNS_6StringENS_13FrameLoadTypeES5_P7NSEventPNS_7ElementEP12NSDictionary
    152152__ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderE
    153153__ZN7WebCore11FrameLoader4loadEPNS_14DocumentLoaderENS_13FrameLoadTypeEN3WTF10PassRefPtrINS_9FormStateEEE
    154154__ZN7WebCore11FrameLoader6reloadEv
     155__ZN7WebCore11FrameLoader7canLoadEP5NSURLRKNS_6StringERb
    155156__ZN7WebCore11FrameLoader8safeLoadEP5NSURL
    156157__ZN7WebCore11FrameLoader9setClientEPNS_17FrameLoaderClientE
     
    161162__ZN7WebCore14DocumentLoader15detachFromFrameEv
    162163__ZN7WebCore14DocumentLoader19prepareForLoadStartEv
    163 __ZN7WebCore14DocumentLoader19setOverrideEncodingEP8NSString
     164__ZN7WebCore14DocumentLoader19setOverrideEncodingERKNS_6StringE
    164165__ZN7WebCore14DocumentLoader32replaceRequestURLForAnchorScrollEP5NSURL
    165166__ZN7WebCore14DocumentLoader7requestEv
     
    186187__ZN7WebCore5RangeD1Ev
    187188__ZN7WebCore6StringC1EP8NSString
     189__ZN7WebCore6StringC1EP8NSString
     190__ZN7WebCore6StringC1EPKc
    188191__ZN7WebCore8FrameMac10mouseMovedEP7NSEvent
    189192__ZN7WebCore8FrameMac10wheelEventEP7NSEvent
     
    205208__ZN7WebCore9FrameTree11appendChildEN3WTF10PassRefPtrINS_5FrameEEE
    206209__ZN7WebCore9FrameTree7setNameERKNS_12AtomicStringE
     210__ZNK7WebCore10StringImplcvP8NSStringEv
    207211__ZNK7WebCore10StringImplcvP8NSStringEv
    208212__ZNK7WebCore11FrameLoader14documentLoaderEv
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r17349 r17352  
    1049010490                        isa = PBXProject;
    1049110491                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
    10492                         compatibilityVersion = "Xcode 2.4";
    1049310492                        hasScannedForEncodings = 1;
    1049410493                        knownRegions = (
     
    1050510504                        projectDirPath = "";
    1050610505                        projectRoot = "";
    10507                         shouldCheckCompatibility = 1;
    1050810506                        targets = (
    1050910507                                93F198A508245E59001E9ABC /* WebCore */,
  • trunk/WebCore/bridge/mac/BrowserExtensionMac.mm

    r17299 r17352  
    5858    const KURL& url = request.m_request.url();
    5959
    60     NSString *frameName = request.m_frameName.isEmpty() ? nil : (NSString*)request.m_frameName;
    61     if (frameName) {
    62         if (Frame* frame = m_frame->tree()->find(frameName)) {
     60    if (!request.m_frameName.isEmpty()) {
     61        if (Frame* frame = m_frame->tree()->find(request.m_frameName)) {
    6362            if (!url.isEmpty())
    6463                Mac(frame)->loadRequest(request, true, nil, nil, nil);
  • trunk/WebCore/bridge/mac/FrameMac.mm

    r17299 r17352  
    3535#import "ClipboardEvent.h"
    3636#import "Cursor.h"
     37#import "WebDocumentLoader.h"
    3738#import "DOMInternal.h"
    3839#import "DOMWindow.h"
     
    188189    BEGIN_BLOCK_OBJC_EXCEPTIONS;
    189190   
    190     NSString *referrer;
     191    String referrer;
    191192    String argsReferrer = request.m_request.httpReferrer();
    192193    if (!argsReferrer.isEmpty())
     
    195196        referrer = FrameMac::referrer();
    196197 
    197     BOOL hideReferrer;
    198     if (![_bridge canLoadURL:request.m_request.url().getNSURL() fromReferrer:referrer hideReferrer:&hideReferrer])
     198    bool hideReferrer;
     199    if (!loader()->canLoad(request.m_request.url().getNSURL(), referrer, hideReferrer))
    199200        return;
    200201    if (hideReferrer)
    201         referrer = nil;
     202        referrer = String();
    202203           
    203204    WebCoreFrameBridge *targetFrame = Mac(tree()->find(request.m_frameName))->bridge();
     
    627628}
    628629
     630// FIXME: Remove this method; it's superfluous.
    629631void FrameMac::setTitle(const String &title)
    630632{
    631     String text = title;
    632     text.replace('\\', backslashAsCurrencySymbol());
    633 
    634     BEGIN_BLOCK_OBJC_EXCEPTIONS;
    635     [_bridge setTitle:text];
    636     END_BLOCK_OBJC_EXCEPTIONS;
     633    loader()->documentLoader()->setTitle(title);
    637634}
    638635
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.h

    r17349 r17352  
    3535    class Element;
    3636    class FrameMac;
     37    class String;
    3738}
    3839
     
    211212- (void)invalidatePageCache:(NSDictionary *)pageCache;
    212213
    213 - (BOOL)canLoadURL:(NSURL *)URL fromReferrer:(NSString *)referrer hideReferrer:(BOOL *)hideReferrer;
    214214- (BOOL)canTargetLoadInFrame:(WebCoreFrameBridge *)targetFrame;
    215215
     
    406406- (BOOL)canSaveAsWebArchive;
    407407
    408 - (void)setTitle:(NSString *)title;
    409408- (NSURL*)originalRequestURL;
    410409- (void)frameDetached;
     
    437436- (void)setStatusText:(NSString *)status;
    438437
    439 - (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL
    440     referrer:(NSString *)referrer
    441     ownerElement:(WebCoreElement *)ownerElement
    442     allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
     438- (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName withURL:(NSURL *)URL referrer:(const WebCore::String&)referrer ownerElement:(WebCoreElement *)ownerElement allowsScrolling:(BOOL)allowsScrolling marginWidth:(int)width marginHeight:(int)height;
    443439
    444440- (BOOL)areToolbarsVisible;
  • trunk/WebCore/bridge/mac/WebCoreFrameBridge.mm

    r17349 r17352  
    154154    if (doc)
    155155        doc->updateRendering();
    156 }
    157 
    158 static BOOL hasCaseInsensitivePrefix(NSString *string, NSString *prefix)
    159 {
    160     return [string rangeOfString:prefix options:(NSCaseInsensitiveSearch | NSAnchoredSearch)].location !=
    161         NSNotFound;
    162156}
    163157
     
    522516}
    523517
    524 - (BOOL)canLoadURL:(NSURL *)URL fromReferrer:(NSString *)referrer hideReferrer:(BOOL *)hideReferrer
    525 {
    526     BOOL referrerIsWebURL = hasCaseInsensitivePrefix(referrer, @"http:") || hasCaseInsensitivePrefix(referrer, @"https:");
    527     BOOL referrerIsLocalURL = hasCaseInsensitivePrefix(referrer, @"file:") || hasCaseInsensitivePrefix(referrer, @"applewebdata:");
    528     BOOL URLIsFileURL = [URL scheme] != NULL && [[URL scheme] compare:@"file" options:(NSCaseInsensitiveSearch|NSLiteralSearch)] == NSOrderedSame;
    529     BOOL referrerIsSecureURL = hasCaseInsensitivePrefix(referrer, @"https:");
    530     BOOL URLIsSecureURL = [URL scheme] != NULL && [[URL scheme] compare:@"https" options:(NSCaseInsensitiveSearch|NSLiteralSearch)] == NSOrderedSame;
    531 
    532    
    533     *hideReferrer = !referrerIsWebURL || (referrerIsSecureURL && !URLIsSecureURL);
    534     return !URLIsFileURL || referrerIsLocalURL;
    535 }
    536 
    537518- (void)saveDocumentState
    538519{
     
    21662147}
    21672148
    2168 static NSString *stringByCollapsingNonPrintingCharacters(NSString *string)
    2169 {
    2170     NSMutableString *result = [NSMutableString string];
    2171     static NSCharacterSet *charactersToTurnIntoSpaces = nil;
    2172     static NSCharacterSet *charactersToNotTurnIntoSpaces = nil;
    2173    
    2174     if (charactersToTurnIntoSpaces == nil) {
    2175         NSMutableCharacterSet *set = [[NSMutableCharacterSet alloc] init];
    2176         [set addCharactersInRange:NSMakeRange(0x00, 0x21)];
    2177         [set addCharactersInRange:NSMakeRange(0x7F, 0x01)];
    2178         charactersToTurnIntoSpaces = [set copy];
    2179         [set release];
    2180         charactersToNotTurnIntoSpaces = [[charactersToTurnIntoSpaces invertedSet] retain];
    2181     }
    2182    
    2183     unsigned length = [string length];
    2184     unsigned position = 0;
    2185     while (position != length) {
    2186         NSRange nonSpace = [string rangeOfCharacterFromSet:charactersToNotTurnIntoSpaces
    2187                                                  options:0 range:NSMakeRange(position, length - position)];
    2188         if (nonSpace.location == NSNotFound)
    2189             break;
    2190        
    2191         NSRange space = [string rangeOfCharacterFromSet:charactersToTurnIntoSpaces
    2192                                               options:0 range:NSMakeRange(nonSpace.location, length - nonSpace.location)];
    2193         if (space.location == NSNotFound)
    2194             space.location = length;
    2195        
    2196         if (space.location > nonSpace.location) {
    2197             if (position != 0)
    2198                 [result appendString:@" "];
    2199             [result appendString:[string substringWithRange:
    2200                 NSMakeRange(nonSpace.location, space.location - nonSpace.location)]];
    2201         }
    2202        
    2203         position = space.location;
    2204     }
    2205    
    2206     return result;
    2207 }
    2208 
    2209 - (void)setTitle:(NSString *)title
    2210 {
    2211     if (!m_frame)
    2212         return;
    2213     m_frame->loader()->documentLoader()->setTitle(stringByCollapsingNonPrintingCharacters(title));
    2214 }
    2215 
    22162149- (NSURL*)originalRequestURL
    22172150{
     
    22332166{
    22342167    // Set the encoding. This only needs to be done once, but it's harmless to do it again later.
    2235     NSString *encoding = m_frame ? m_frame->loader()->documentLoader()->overrideEncoding() : nil;
    2236     bool userChosen = encoding != nil;
    2237     if (!encoding)
     2168    String encoding;
     2169    if (m_frame)
     2170        encoding = m_frame->loader()->documentLoader()->overrideEncoding();
     2171    bool userChosen = !encoding.isNull();
     2172    if (encoding.isNull())
    22382173        encoding = textEncodingName;
    22392174    m_frame->setEncoding(encoding, userChosen);
     
    22502185    // Since this is a subresource, we can load any URL (we ignore the return value).
    22512186    // But we still want to know whether we should hide the referrer or not, so we call the canLoadURL method.
    2252     NSString *referrer = m_frame->referrer();
    2253     BOOL hideReferrer;
    2254     [self canLoadURL:URL fromReferrer:referrer hideReferrer:&hideReferrer];
     2187    String referrer = m_frame->referrer();
     2188    bool hideReferrer;
     2189    m_frame->loader()->canLoad(URL, referrer, hideReferrer);
    22552190    if (hideReferrer)
    2256         referrer = nil;
     2191        referrer = String();
    22572192   
    22582193    return SubresourceLoader::create(m_frame, resourceLoader, method, URL, customHeaders, referrer);
     
    22832218    // Since this is a subresource, we can load any URL (we ignore the return value).
    22842219    // But we still want to know whether we should hide the referrer or not, so we call the canLoadURL method.
    2285     NSString *referrer = m_frame->referrer();
    2286     BOOL hideReferrer;
    2287     [self canLoadURL:URL fromReferrer:referrer hideReferrer:&hideReferrer];
     2220    String referrer = m_frame->referrer();
     2221    bool hideReferrer;
     2222    m_frame->loader()->canLoad(URL, referrer, hideReferrer);
    22882223    if (hideReferrer)
    2289         referrer = nil;
     2224        referrer = String();
    22902225   
    22912226    return SubresourceLoader::create(m_frame, resourceLoader, method, URL, customHeaders, postData, referrer);
     
    22962231    // Since this is a subresource, we can load any URL (we ignore the return value).
    22972232    // But we still want to know whether we should hide the referrer or not, so we call the canLoadURL method.
    2298     NSString *referrer = m_frame->referrer();
    2299     BOOL hideReferrer;
    2300     [self canLoadURL:URL fromReferrer:referrer hideReferrer:&hideReferrer];
     2233    String referrer = m_frame->referrer();
     2234    bool hideReferrer;
     2235    m_frame->loader()->canLoad(URL, referrer, hideReferrer);
    23012236    if (hideReferrer)
    2302         referrer = nil;
     2237        referrer = String();
    23032238   
    23042239    NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
     
    23232258        [request setCachePolicy:[m_frame->loader()->documentLoader()->request() cachePolicy]];
    23242259   
    2325     if (referrer)
     2260    if (!referrer.isNull())
    23262261        setHTTPReferrer(request, referrer);
    23272262   
  • trunk/WebCore/loader/mac/FrameLoader.h

    r17299 r17352  
    2828
    2929#import "FrameLoaderTypes.h"
     30#import <WebCore/PlatformString.h>
    3031#import <wtf/Forward.h>
    3132#import <wtf/HashSet.h>
     
    5152    class FrameLoaderClient;
    5253    class MainResourceLoader;
     54    class String;
    5355    class WebResourceLoader;
    5456
     
    6668        void prepareForLoadStart();
    6769        void setupForReplace();
    68         void setupForReplaceByMIMEType(NSString *newMIMEType);
     70        void setupForReplaceByMIMEType(const String& newMIMEType);
    6971        void finalSetupForReplace(DocumentLoader*);
    7072        void safeLoad(NSURL *);
    7173        void load(NSURLRequest *);
    72         void load(NSURLRequest *, NSString *frameName);
     74        void load(NSURLRequest *, const String& frameName);
    7375        void load(NSURLRequest *, NSDictionary *triggeringAaction, FrameLoadType, PassRefPtr<FormState>);
    7476        void load(DocumentLoader*);
    7577        void load(DocumentLoader*, FrameLoadType, PassRefPtr<FormState>);
    76         void load(NSURL *, NSString *referrer, FrameLoadType, NSString *target, NSEvent *event, Element* form, NSDictionary *formValues);
     78        void load(NSURL *, const String& referrer, FrameLoadType, const String& target,
     79                  NSEvent *event, Element* form, NSDictionary *formValues);
     80
     81        bool canLoad(NSURL *, const String& referrer, bool& hideReferrer);
    7782
    7883        // Also not cool.
     
    8388        void cancelMainResourceLoad();
    8489        void cancelPendingArchiveLoad(WebResourceLoader*);
    85            
     90
    8691        void addPlugInStreamLoader(WebResourceLoader*);
    8792        void removePlugInStreamLoader(WebResourceLoader*);
     
    132137        bool isHostedByObjectElement() const;
    133138        bool isLoadingMainFrame() const;
    134         bool canShowMIMEType(NSString *MIMEType) const;
    135         bool representationExistsForURLScheme(NSString *URLScheme);
    136         NSString *generatedMIMETypeForURLScheme(NSString *URLScheme);
     139        bool canShowMIMEType(const String& MIMEType) const;
     140        bool representationExistsForURLScheme(const String& URLScheme);
     141        String generatedMIMETypeForURLScheme(const String& URLScheme);
    137142        void notifyIconChanged(NSURL *iconURL);
    138143        void checkNavigationPolicy(NSURLRequest *newRequest, id continuationObject, SEL continuationSelector);
    139         void checkContentPolicy(NSString *MIMEType, id continuationObject, SEL continuationSelector);
     144        void checkContentPolicy(const String& MIMEType, id continuationObject, SEL continuationSelector);
    140145        void cancelContentPolicyCheck();
    141146        void reload();
    142         void reloadAllowingStaleData(NSString *overrideEncoding);
     147        void reloadAllowingStaleData(const String& overrideEncoding);
    143148
    144149        void didReceiveServerRedirectForProvisionalLoadForFrame();
     
    167172        void sendRemainingDelegateMessages(id identifier, NSURLResponse *, unsigned length, NSError *);
    168173        NSURLRequest *requestFromDelegate(NSURLRequest *, id& identifier, NSError *& error);
    169         void post(NSURL *, NSString *referrer, NSString *target, NSArray *postData, NSString *contentType, NSEvent *, Element* form, NSDictionary *formValues);
     174        void post(NSURL *, const String& referrer, const String& target, NSArray *postData, const String& contentType, NSEvent *, Element* form, NSDictionary *formValues);
    170175
    171176        void checkLoadComplete();
     
    184189        void continueLoadRequestAfterNavigationPolicy(NSURLRequest *, FormState*);
    185190        void continueFragmentScrollAfterNavigationPolicy(NSURLRequest *);
    186         void continueLoadRequestAfterNewWindowPolicy(NSURLRequest *, NSString *frameName, FormState*);
     191        void continueLoadRequestAfterNewWindowPolicy(NSURLRequest *, const String& frameName, FormState*);
    187192#endif
    188193
     
    206211
    207212        void invalidatePendingPolicyDecision(bool callDefaultAction);
    208         void checkNewWindowPolicy(NSURLRequest *, NSDictionary *, NSString *frameName, PassRefPtr<FormState>);
     213        void checkNewWindowPolicy(NSURLRequest *, NSDictionary *, const String& frameName, PassRefPtr<FormState>);
    209214        void checkNavigationPolicy(NSURLRequest *, DocumentLoader*, PassRefPtr<FormState>, id continuationObject, SEL continuationSelector);
    210215
     
    252257
    253258        RetainPtr<NSURLRequest> m_policyRequest;
    254         RetainPtr<NSString> m_policyFrameName;
     259        String m_policyFrameName;
    255260        RetainPtr<id> m_policyTarget;
    256261        SEL m_policySelector;
  • trunk/WebCore/loader/mac/FrameLoader.mm

    r17299 r17352  
    138138}
    139139
    140 void FrameLoader::setupForReplaceByMIMEType(NSString *newMIMEType)
     140void FrameLoader::setupForReplaceByMIMEType(const String& newMIMEType)
    141141{
    142142    activeDocumentLoader()->setupForReplaceByMIMEType(newMIMEType);
     
    165165}
    166166
    167 void FrameLoader::load(NSURLRequest *request, NSString *frameName)
    168 {
    169     if (!frameName) {
     167void FrameLoader::load(NSURLRequest *request, const String& frameName)
     168{
     169    if (frameName.isNull()) {
    170170        load(request);
    171171        return;
     
    194194}
    195195
    196 void FrameLoader::load(NSURL *URL, NSString *referrer, FrameLoadType newLoadType, NSString *target, NSEvent *event, Element* form, NSDictionary *values)
     196void FrameLoader::load(NSURL *URL, const String& referrer, FrameLoadType newLoadType, const String& target, NSEvent *event, Element* form, NSDictionary *values)
    197197{
    198198    bool isFormSubmission = values != nil;
     
    211211        formState = FormState::create(form, values, bridge());
    212212   
    213     if (target) {
     213    if (!target.isNull()) {
    214214        Frame* targetFrame = m_frame->tree()->find(target);
    215215        if (targetFrame)
    216             targetFrame->loader()->load(URL, referrer, newLoadType, nil, event, form, values);
     216            targetFrame->loader()->load(URL, referrer, newLoadType, String(), event, form, values);
    217217        else
    218218            checkNewWindowPolicy(request, action, target, formState.release());
     
    315315}
    316316
     317bool FrameLoader::canLoad(NSURL *URL, const String& referrer, bool& hideReferrer)
     318{
     319    bool referrerIsWebURL = referrer.startsWith("http:", false) || referrer.startsWith("https:", false);
     320    bool referrerIsLocalURL = referrer.startsWith("file:", false) || referrer.startsWith("applewebdata:");
     321    bool URLIsFileURL = [URL scheme] && [[URL scheme] compare:@"file" options:(NSCaseInsensitiveSearch|NSLiteralSearch)] == NSOrderedSame;
     322    bool referrerIsSecureURL = referrer.startsWith("https:", false);
     323    bool URLIsSecureURL = [URL scheme] && [[URL scheme] compare:@"https" options:(NSCaseInsensitiveSearch|NSLiteralSearch)] == NSOrderedSame;
     324   
     325    hideReferrer = !referrerIsWebURL || (referrerIsSecureURL && !URLIsSecureURL);
     326    return !URLIsFileURL || referrerIsLocalURL;
     327}
     328
    317329bool FrameLoader::startLoadingMainResource(NSMutableURLRequest *request, id identifier)
    318330{
     
    972984}
    973985
    974 bool FrameLoader::canShowMIMEType(NSString *MIMEType) const
     986bool FrameLoader::canShowMIMEType(const String& MIMEType) const
    975987{
    976988    return m_client->canShowMIMEType(MIMEType);
    977989}
    978990
    979 bool FrameLoader::representationExistsForURLScheme(NSString *URLScheme)
     991bool FrameLoader::representationExistsForURLScheme(const String& URLScheme)
    980992{
    981993    return m_client->representationExistsForURLScheme(URLScheme);
    982994}
    983995
    984 NSString *FrameLoader::generatedMIMETypeForURLScheme(NSString *URLScheme)
     996String FrameLoader::generatedMIMETypeForURLScheme(const String& URLScheme)
    985997{
    986998    return m_client->generatedMIMETypeForURLScheme(URLScheme);
     
    9921004}
    9931005
    994 void FrameLoader::checkContentPolicy(NSString *MIMEType, id obj, SEL sel)
     1006void FrameLoader::checkContentPolicy(const String& MIMEType, id obj, SEL sel)
    9951007{
    9961008    WebPolicyDecider *d = m_client->createPolicyDecider(obj, sel);
     
    10291041}
    10301042
    1031 void FrameLoader::reloadAllowingStaleData(NSString *encoding)
     1043void FrameLoader::reloadAllowingStaleData(const String& encoding)
    10321044{
    10331045    if (!m_documentLoader)
     
    11711183    m_policyDecider = nil;
    11721184
    1173     bool hadFrameName = m_policyFrameName;
     1185    bool hadFrameName = !m_policyFrameName.isNull();
    11741186    RetainPtr<id> target = m_policyTarget;
    11751187    SEL selector = m_policySelector;
    11761188
    11771189    m_policyRequest = nil;
    1178     m_policyFrameName = nil;
     1190    m_policyFrameName = String();
    11791191    m_policyTarget = nil;
    11801192    m_policyFormState = 0;
     
    11881200}
    11891201
    1190 void FrameLoader::checkNewWindowPolicy(NSURLRequest *request, NSDictionary *action,
    1191     NSString *frameName, PassRefPtr<FormState> formState)
     1202void FrameLoader::checkNewWindowPolicy(NSURLRequest *request, NSDictionary *action, const String& frameName, PassRefPtr<FormState> formState)
    11921203{
    11931204    WebPolicyDecider *decider = m_client->createPolicyDecider(asDelegate(),
     
    12091220{
    12101221    RetainPtr<NSURLRequest> request = m_policyRequest;
    1211     RetainPtr<NSString> frameName = m_policyFrameName;
     1222    String frameName = m_policyFrameName;
    12121223    RetainPtr<id> target = m_policyTarget;
    12131224    SEL selector = m_policySelector;
     
    12281239    }
    12291240
    1230     objc_msgSend(target.get(), selector, request.get(), frameName.get(), formState.get());
     1241    NSString *frameNameAsNSString = frameName;
     1242    objc_msgSend(target.get(), selector, request.get(), frameNameAsNSString, formState.get());
    12311243}
    12321244
     
    14181430    // Handle adding the URL to the back/forward list.
    14191431    DocumentLoader* dl = m_documentLoader.get();
    1420     NSString *ptitle = dl->title();
     1432    String ptitle = dl->title();
    14211433
    14221434    switch (m_loadType) {
     
    14681480   
    14691481    // If we have a title let the WebView know about it.
    1470     if (ptitle)
     1482    if (!ptitle.isNull())
    14711483        m_client->dispatchDidReceiveTitle(ptitle);
    14721484}
     
    15571569}
    15581570
    1559 void FrameLoader::continueLoadRequestAfterNewWindowPolicy(NSURLRequest *request, NSString *frameName, FormState* formState)
     1571void FrameLoader::continueLoadRequestAfterNewWindowPolicy(NSURLRequest *request, const String& frameName, FormState* formState)
    15601572{
    15611573    if (!request)
     
    16021614}
    16031615
    1604 void FrameLoader::post(NSURL *URL, NSString *referrer, NSString *target, NSArray *postData,
    1605     NSString *contentType, NSEvent *event, Element* form, NSDictionary *formValues)
     1616void FrameLoader::post(NSURL *URL, const String& referrer, const String& target, NSArray *postData,
     1617                       const String& contentType, NSEvent *event, Element* form, NSDictionary *formValues)
    16061618{
    16071619    // When posting, use the NSURLRequestReloadIgnoringCacheData load flag.
  • trunk/WebCore/loader/mac/LoaderNSURLRequestExtras.m

    r17025 r17352  
    4545#define WebReferrer     (@"Referer")
    4646
    47 void setHTTPReferrer(NSMutableURLRequest *request, NSString *theReferrer)
     47void setHTTPReferrer(NSMutableURLRequest *request, NSString *referrer)
    4848{
    4949    // Do not set the referrer to a string that refers to a file URL.
    5050    // That is a potential security hole.
    51     if (stringIsFileURL(theReferrer))
     51    if (stringIsFileURL(referrer))
    5252        return;
    5353   
    5454    // Don't allow empty Referer: headers; some servers refuse them
    55     if([theReferrer length] == 0)
    56         theReferrer = nil;
     55    if([referrer length] == 0)
     56        referrer = nil;
    5757   
    58     [request setValue:theReferrer forHTTPHeaderField:WebReferrer];
     58    [request setValue:referrer forHTTPHeaderField:WebReferrer];
    5959}
    6060
  • trunk/WebCore/loader/mac/WebDocumentLoader.h

    r17245 r17352  
    2929#include "RetainPtr.h"
    3030#include "Shared.h"
     31#include "PlatformString.h"
    3132#include <wtf/Vector.h>
    3233
     
    6869        void updateLoading();
    6970        void receivedData(NSData *);
    70         void setupForReplaceByMIMEType(NSString *newMIMEType);
     71        void setupForReplaceByMIMEType(const String& newMIMEType);
    7172        void finishedLoading();
    7273        NSURLResponse *response() const;
     
    7980        bool isLoadingInAPISense() const;
    8081        void setPrimaryLoadComplete(bool);
    81         void setTitle(NSString *);
    82         NSString *overrideEncoding() const;
     82        void setTitle(const String&);
     83        String overrideEncoding() const;
    8384        void addResponse(NSURLResponse *);
    8485        const ResponseVector& responses() const;
    8586        NSDictionary *triggeringAction() const;
    8687        void setTriggeringAction(NSDictionary *);
    87         void setOverrideEncoding(NSString *);
     88        void setOverrideEncoding(const String&);
    8889        void setLastCheckedRequest(NSURLRequest *request);
    8990        NSURLRequest *lastCheckedRequest() const;
    9091        void stopRecordingResponses();
    91         NSString *title() const;
     92        String title() const;
    9293        NSURL *URLForHistory() const;
    9394
     
    101102        void setMainDocumentError(NSError *);
    102103        void commitLoad(NSData *);
    103         bool doesProgressiveLoad(NSString *MIMEType) const;
     104        bool doesProgressiveLoad(const String& MIMEType) const;
    104105
    105106        Frame* m_frame;
     
    136137        bool m_isClientRedirect;
    137138
    138         RetainPtr<NSString> m_pageTitle;
     139        String m_pageTitle;
    139140
    140         RetainPtr<NSString> m_encoding;
    141         RetainPtr<NSString> m_overrideEncoding;
     141        String m_overrideEncoding;
    142142
    143143        // The action that triggered loading - we keep this around for the
  • trunk/WebCore/loader/mac/WebDocumentLoader.mm

    r17299 r17352  
    3232#import "FrameLoader.h"
    3333#import "FrameMac.h"
     34#import "PlatformString.h"
    3435#import "WebCoreFrameBridge.h"
    3536#import "WebCoreSystemInterface.h"
     
    3839
    3940namespace WebCore {
     41
     42/*
     43 * Performs three operations:
     44 *  1. Convert backslashes to currency symbols
     45 *  2. Convert control characters to spaces
     46 *  3. Trim leading and trailing spaces
     47 */
     48static inline String canonicalizedTitle(const String& title, Frame* frame)
     49{
     50    ASSERT(!title.isEmpty());
     51   
     52    const UChar* characters = title.characters();
     53    unsigned length = title.length();
     54    unsigned i;
     55   
     56    // Find the first non-canonical character
     57    for (i = 0; i < length; ++i) {
     58        UChar c = characters[i];
     59        if (c < 0x20 || c == 0x7F || c == '\\')
     60            break;
     61    }
     62
     63    // Optimization for titles that have no non-canonical characters and no leading or trailing spaces
     64    if (i == length && characters[0] != ' ' && characters[length - 1] != ' ')
     65        return title;
     66
     67    Vector<UChar> stringBuilder(length);
     68    unsigned builderIndex = 0;
     69   
     70    // Skip leading spaces and leading characters that would convert to spaces
     71    for (i = 0; i < length; ++i) {
     72        UChar c = characters[i];
     73        if (!(c <= 0x20 || c == 0x7F))
     74            break;
     75    }
     76   
     77    // Replace control characters with spaces, and backslashes with currency symbols
     78    for (; i < length; ++i) {
     79        UChar c = characters[i];
     80        if (c < 0x20 || c == 0x7F)
     81            c = ' ';
     82        else if (c == '\\')
     83            c = frame->backslashAsCurrencySymbol();
     84        stringBuilder[builderIndex++] = c;
     85    }
     86
     87    // Strip trailing spaces
     88    while (--builderIndex > 0)
     89        if (stringBuilder[builderIndex] != ' ')
     90            break;
     91   
     92    if (builderIndex == 0 && stringBuilder[builderIndex] == ' ')
     93        return "";
     94   
     95    stringBuilder.resize(builderIndex + 1);
     96    return String::adopt(stringBuilder);
     97}
    4098
    4199DocumentLoader::DocumentLoader(NSURLRequest *req)
     
    299357}
    300358
    301 bool DocumentLoader::doesProgressiveLoad(NSString *MIMEType) const
    302 {
    303     return !frameLoader()->isReplacing() || [MIMEType isEqualToString:@"text/html"];
     359bool DocumentLoader::doesProgressiveLoad(const String& MIMEType) const
     360{
     361    return !frameLoader()->isReplacing() || MIMEType == "text/html";
    304362}
    305363
     
    311369}
    312370
    313 void DocumentLoader::setupForReplaceByMIMEType(NSString *newMIMEType)
     371void DocumentLoader::setupForReplaceByMIMEType(const String& newMIMEType)
    314372{
    315373    if (!m_gotFirstByte)
    316374        return;
    317375   
    318     NSString *oldMIMEType = [m_response.get() MIMEType];
     376    String oldMIMEType = [m_response.get() MIMEType];
    319377   
    320378    if (!doesProgressiveLoad(oldMIMEType)) {
     
    440498}
    441499
    442 NSString *DocumentLoader::title() const
    443 {
    444     return [[m_pageTitle.get() retain] autorelease];
     500String DocumentLoader::title() const
     501{
     502    return m_pageTitle;
    445503}
    446504
     
    474532}
    475533
    476 void DocumentLoader::setOverrideEncoding(NSString *enc)
    477 {
    478     NSString *copy = [enc copy];
    479     m_overrideEncoding = copy;
    480     [copy release];
    481 }
    482 
    483 NSString *DocumentLoader::overrideEncoding() const
    484 {
    485     return [[m_overrideEncoding.get() copy] autorelease];
    486 }
    487 
    488 void DocumentLoader::setTitle(NSString *title)
    489 {
    490     if (!title)
     534void DocumentLoader::setOverrideEncoding(const String& enc)
     535{
     536    m_overrideEncoding = enc;
     537}
     538
     539String DocumentLoader::overrideEncoding() const
     540{
     541    return m_overrideEncoding;
     542}
     543
     544void DocumentLoader::setTitle(const String& title)
     545{
     546    if (title.isEmpty())
    491547        return;
    492548
    493     NSString *trimmed = [title mutableCopy];
    494     CFStringTrimWhitespace((CFMutableStringRef)trimmed);
    495 
    496     if ([trimmed length] != 0 && ![m_pageTitle.get() isEqualToString:trimmed]) {
    497         NSString *copy = [trimmed copy];
     549    String trimmed = canonicalizedTitle(title, m_frame);
     550    if (!trimmed.isEmpty() && m_pageTitle != trimmed) {
    498551        frameLoader()->willChangeTitle(this);
    499         m_pageTitle = copy;
     552        m_pageTitle = trimmed;
    500553        frameLoader()->didChangeTitle(this);
    501         [copy release];
    502     }
    503 
    504     [trimmed release];
     554    }
    505555}
    506556
  • trunk/WebCore/loader/mac/WebFrameLoaderClient.h

    r17280 r17352  
    3737    class Element;
    3838    class Frame;
     39    class String;
    3940    class WebResourceLoader;
    4041
     
    104105        virtual void dispatchDidReceiveIcon(NSImage *) = 0;
    105106        virtual void dispatchDidStartProvisionalLoad() = 0;
    106         virtual void dispatchDidReceiveTitle(NSString *title) = 0;
     107        virtual void dispatchDidReceiveTitle(const String& title) = 0;
    107108        virtual void dispatchDidCommitLoad() = 0;
    108109        virtual void dispatchDidFailProvisionalLoad(NSError *) = 0;
     
    114115        virtual void dispatchShow() = 0;
    115116
    116         virtual void dispatchDecidePolicyForMIMEType(WebPolicyDecider *, NSString *MIMEType, NSURLRequest *) = 0;
    117         virtual void dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *, NSString *frameName) = 0;
     117        virtual void dispatchDecidePolicyForMIMEType(WebPolicyDecider *, const String& MIMEType, NSURLRequest *) = 0;
     118        virtual void dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *, const String& frameName) = 0;
    118119        virtual void dispatchDecidePolicyForNavigationAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *) = 0;
    119120        virtual void dispatchUnableToImplementPolicy(NSError *) = 0;
     
    165166
    166167        virtual bool canHandleRequest(NSURLRequest *) const = 0;
    167         virtual bool canShowMIMEType(NSString *MIMEType) const = 0;
    168         virtual bool representationExistsForURLScheme(NSString *URLScheme) const = 0;
    169         virtual NSString *generatedMIMETypeForURLScheme(NSString *URLScheme) const = 0;
     168        virtual bool canShowMIMEType(const String& MIMEType) const = 0;
     169        virtual bool representationExistsForURLScheme(const String& URLScheme) const = 0;
     170        virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const = 0;
    170171
    171172        virtual NSDictionary *elementForEvent(NSEvent *) const = 0;
  • trunk/WebCore/loader/mac/WebMainResourceLoader.mm

    r17299 r17352  
    3131
    3232#import "FrameLoader.h"
     33#import "PlatformString.h"
    3334#import "WebCoreSystemInterface.h"
    3435#import "WebDataProtocol.h"
     
    196197}
    197198
    198 static bool isCaseInsensitiveEqual(NSString *a, NSString *b)
    199 {
    200     return [a caseInsensitiveCompare:b] == NSOrderedSame;
    201 }
    202 
    203199static bool shouldLoadAsEmptyDocument(NSURL *url)
    204200{
     
    218214{
    219215    NSURL *URL = [request() URL];
    220     NSString *MIMEType = [r MIMEType];
     216    String MIMEType = [r MIMEType];
    221217   
    222218    switch (contentPolicy) {
     
    224220        // Prevent remote web archives from loading because they can claim to be from any domain and thus avoid cross-domain security checks (4120255).
    225221        bool isRemote = ![URL isFileURL] && ![WebDataProtocol _webIsDataProtocolURL:URL];
    226         bool isRemoteWebArchive = isRemote && isCaseInsensitiveEqual(@"application/x-webarchive", MIMEType);
     222        bool isRemoteWebArchive = isRemote && equalIgnoringCase("application/x-webarchive", MIMEType);
    227223        if (!frameLoader()->canShowMIMEType(MIMEType) || isRemoteWebArchive) {
    228224            frameLoader()->cannotShowMIMEType(r);
  • trunk/WebCore/loader/mac/WebSubresourceLoader.h

    r17294 r17352  
    3232namespace WebCore {
    3333
     34    class String;
     35   
    3436    class SubresourceLoader : public WebResourceLoader {
    3537    public:
    3638        static id <WebCoreResourceHandle> create(Frame*, id <WebCoreResourceLoader>,
    37             NSString *method, NSURL *URL, NSDictionary *customHeaders, NSString *referrer);
     39            const String& method, NSURL *URL, NSDictionary *customHeaders, const String& referrer);
    3840        static id <WebCoreResourceHandle> create(Frame*, id <WebCoreResourceLoader>,
    39             NSString *method, NSURL *URL, NSDictionary *customHeaders, NSArray *postData, NSString *referrer);
     41            const String& method, NSURL *URL, NSDictionary *customHeaders, NSArray *postData, const String& referrer);
    4042
    4143        virtual ~SubresourceLoader();
     
    4951    private:
    5052        static id <WebCoreResourceHandle> create(Frame*, id <WebCoreResourceLoader>,
    51             NSMutableURLRequest *, NSDictionary *customHeaders, NSString *referrer);
     53            NSMutableURLRequest *, NSDictionary *customHeaders, const String& referrer);
    5254
    5355        SubresourceLoader(Frame*, id <WebCoreResourceLoader>);
  • trunk/WebCore/loader/mac/WebSubresourceLoader.mm

    r17299 r17352  
    6565
    6666id <WebCoreResourceHandle> SubresourceLoader::create(Frame* frame, id <WebCoreResourceLoader> rLoader,
    67     NSMutableURLRequest *newRequest, NSDictionary *customHeaders, NSString *referrer)
     67    NSMutableURLRequest *newRequest, NSDictionary *customHeaders, const String& referrer)
    6868{
    6969    FrameLoader* fl = frame->loader();
     
    9999
    100100id <WebCoreResourceHandle> SubresourceLoader::create(Frame* frame, id <WebCoreResourceLoader> rLoader,
    101     NSString *method, NSURL *URL, NSDictionary *customHeaders, NSString *referrer)
     101    const String& method, NSURL *URL, NSDictionary *customHeaders, const String& referrer)
    102102{
    103103    NSMutableURLRequest *newRequest = [[NSMutableURLRequest alloc] initWithURL:URL];   
     
    109109
    110110id <WebCoreResourceHandle> SubresourceLoader::create(Frame* frame, id <WebCoreResourceLoader> rLoader,
    111     NSString *method, NSURL *URL, NSDictionary *customHeaders, NSArray *postData, NSString *referrer)
     111    const String& method, NSURL *URL, NSDictionary *customHeaders, NSArray *postData, const String& referrer)
    112112{
    113113    NSMutableURLRequest *newRequest = [[NSMutableURLRequest alloc] initWithURL:URL];
  • trunk/WebKit/ChangeLog

    r17349 r17352  
     12006-10-26  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Reviewed by Darin, Maciej.
     4
     5        Removed many uses of NSString * from WebCore.
     6       
     7        Changed a few files to ObjC++ for compatiblity with new WebCore methods
     8        taking WebCore::Strings as arguments.
     9       
     10        Added a static_cast to make the c++ compiler happy.
     11
    1122006-10-26  John Sullivan  <sullivan@apple.com>
    213
     
    184618572006-10-09  Maciej Stachowiak  <mjs@apple.com>
    18471858
    1848 >>>>>>> .r16935
    18491859        Reviewed by Alice.
    18501860
  • trunk/WebKit/Misc/WebElementDictionary.m

    r16873 r17352  
    5555static void addLookupKey(NSString *key, SEL selector, WebElementTargetObject target)
    5656{
    57     WebElementMethod *elementMethod = malloc(sizeof(WebElementMethod));
     57    WebElementMethod *elementMethod = static_cast<WebElementMethod*>(malloc(sizeof(WebElementMethod)));
    5858    elementMethod->target = target;
    5959    elementMethod->selector = selector;
  • trunk/WebKit/Plugins/WebNetscapePluginStream.mm

    r17299 r17352  
    5555    WebBaseNetscapePluginView *view = (WebBaseNetscapePluginView *)thePluginPointer->ndata;
    5656
    57     WebFrameBridge *bridge = [[view webFrame] _bridge];
    58     BOOL hideReferrer;
    59     if (![bridge canLoadURL:[theRequest URL] fromReferrer:core([view webFrame])->referrer() hideReferrer:&hideReferrer])
     57    bool hideReferrer;
     58    if (!core([view webFrame])->loader()->canLoad([theRequest URL], core([view webFrame])->referrer(), hideReferrer))
    6059        return nil;
    6160
  • trunk/WebKit/Plugins/WebPluginContainerCheck.m

    r17299 r17352  
    4242#import <Foundation/NSURLRequest.h>
    4343#import <JavaScriptCore/Assertions.h>
     44#import <WebCore/FrameLoader.h>
    4445#import <WebCore/FrameLoaderTypes.h>
     46#import <WebCore/FrameMac.h>
    4547#import <objc/objc-runtime.h>
    4648
     
    9496- (BOOL)_isForbiddenFileLoad
    9597{
    96    BOOL ignore;
     98   bool ignore;
    9799   WebFrameBridge *bridge = [_controller bridge];
    98100   ASSERT(bridge);
    99    if (![bridge canLoadURL:[_request URL] fromReferrer:[_controller URLPolicyCheckReferrer] hideReferrer:&ignore]) {
     101   if (![bridge _frame]->loader()->canLoad([_request URL], [_controller URLPolicyCheckReferrer], ignore)) {
    100102       [self _continueWithPolicy:PolicyIgnore];
    101103       return YES;
  • trunk/WebKit/Plugins/WebPluginController.mm

    r17290 r17352  
    3232#import <Foundation/NSURLRequest.h>
    3333#import <WebCore/FrameLoader.h>
     34#import <WebCore/PlatformString.h>
    3435#import <WebCore/WebCoreFrameBridge.h>
    3536#import <WebCore/WebDocumentLoader.h>
  • trunk/WebKit/WebCoreSupport/WebFrameBridge.mm

    r17299 r17352  
    543543- (WebCoreFrameBridge *)createChildFrameNamed:(NSString *)frameName
    544544                                      withURL:(NSURL *)URL
    545                                      referrer:(NSString *)referrer
     545                                     referrer:(const String&)referrer
    546546                                   ownerElement:(WebCoreElement *)ownerElement
    547547                              allowsScrolling:(BOOL)allowsScrolling
     
    549549                                 marginHeight:(int)height
    550550{
    551     BOOL hideReferrer;
    552     if (![self canLoadURL:URL fromReferrer:referrer hideReferrer:&hideReferrer])
     551    bool hideReferrer;
     552    if (!m_frame->loader()->canLoad(URL, referrer, hideReferrer))
    553553        return nil;
    554554
     
    569569        return nil;
    570570
    571     [_frame _loadURL:URL referrer:(hideReferrer ? nil : referrer) intoChild:[newBridge webFrame]];
     571    [_frame _loadURL:URL referrer:(hideReferrer ? String() : referrer) intoChild:[newBridge webFrame]];
    572572
    573573    return newBridge;
     
    733733                    loadManually:(BOOL)loadManually
    734734{
    735     BOOL hideReferrer;
    736     if (![self canLoadURL:URL fromReferrer:m_frame->referrer() hideReferrer:&hideReferrer])
     735    bool hideReferrer;
     736    if (!m_frame->loader()->canLoad(URL, m_frame->referrer(), hideReferrer))
    737737        return nil;
    738738
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.h

    r17280 r17352  
    3131
    3232@class WebFrame;
     33
     34namespace WebCore {
     35    class String;
     36}
    3337
    3438class WebFrameLoaderClient : public WebCore::FrameLoaderClient {
     
    98102    virtual void dispatchDidReceiveIcon(NSImage *);
    99103    virtual void dispatchDidStartProvisionalLoad();
    100     virtual void dispatchDidReceiveTitle(NSString *title);
     104    virtual void dispatchDidReceiveTitle(const WebCore::String& title);
    101105    virtual void dispatchDidCommitLoad();
    102106    virtual void dispatchDidFailProvisionalLoad(NSError *);
     
    108112    virtual void dispatchShow();
    109113
    110     virtual void dispatchDecidePolicyForMIMEType(WebPolicyDecider *, NSString *MIMEType, NSURLRequest *);
    111     virtual void dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *, NSString *frameName);
     114    virtual void dispatchDecidePolicyForMIMEType(WebPolicyDecider *, const WebCore::String& MIMEType, NSURLRequest *);
     115    virtual void dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *, const WebCore::String& frameName);
    112116    virtual void dispatchDecidePolicyForNavigationAction(WebPolicyDecider *, NSDictionary *action, NSURLRequest *);
    113117    virtual void dispatchUnableToImplementPolicy(NSError *);
     
    159163
    160164    virtual bool canHandleRequest(NSURLRequest *) const;
    161     virtual bool canShowMIMEType(NSString *MIMEType) const;
    162     virtual bool representationExistsForURLScheme(NSString *URLScheme) const;
    163     virtual NSString *generatedMIMETypeForURLScheme(NSString *URLScheme) const;
     165    virtual bool canShowMIMEType(const WebCore::String& MIMEType) const;
     166    virtual bool representationExistsForURLScheme(const WebCore::String& URLScheme) const;
     167    virtual WebCore::String generatedMIMETypeForURLScheme(const WebCore::String& URLScheme) const;
    164168
    165169    virtual NSDictionary *elementForEvent(NSEvent *) const;
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.mm

    r17299 r17352  
    3131#import "WebFrameInternal.h"
    3232#import <WebCore/FrameMac.h>
     33#import <WebCore/PlatformString.h>
    3334#import <WebCore/WebCoreFrameBridge.h>
    3435#import <WebCore/WebDocumentLoader.h>
     
    281282}
    282283
    283 void WebFrameLoaderClient::dispatchDidReceiveTitle(NSString *title)
     284void WebFrameLoaderClient::dispatchDidReceiveTitle(const String& title)
    284285{
    285286    [m_webFrame.get() _dispatchDidReceiveTitle:title];
     
    321322}
    322323
    323 void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(WebPolicyDecider *decider, NSString *MIMEType,
    324     NSURLRequest *request)
     324void WebFrameLoaderClient::dispatchDecidePolicyForMIMEType(WebPolicyDecider *decider, const String& MIMEType, NSURLRequest *request)
    325325{
    326326    [m_webFrame.get() _dispatchDecidePolicyForMIMEType:MIMEType request:request decider:decider];
    327327}
    328328
    329 void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *decider, NSDictionary *action,
    330     NSURLRequest *request, NSString *frameName)
     329void WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction(WebPolicyDecider *decider, NSDictionary *action, NSURLRequest *request, const String& frameName)
    331330{
    332331    [m_webFrame.get() _dispatchDecidePolicyForNewWindowAction:action request:request newFrameName:frameName
     
    507506}
    508507
    509 bool WebFrameLoaderClient::canShowMIMEType(NSString *MIMEType) const
     508bool WebFrameLoaderClient::canShowMIMEType(const String& MIMEType) const
    510509{
    511510    return [m_webFrame.get() _canShowMIMEType:MIMEType];
    512511}
    513512
    514 bool WebFrameLoaderClient::representationExistsForURLScheme(NSString *URLScheme) const
     513bool WebFrameLoaderClient::representationExistsForURLScheme(const String& URLScheme) const
    515514{
    516515    return [m_webFrame.get() _representationExistsForURLScheme:URLScheme];
    517516}
    518517
    519 NSString *WebFrameLoaderClient::generatedMIMETypeForURLScheme(NSString *URLScheme) const
     518String WebFrameLoaderClient::generatedMIMETypeForURLScheme(const String& URLScheme) const
    520519{
    521520    return [m_webFrame.get() _generatedMIMETypeForURLScheme:URLScheme];
  • trunk/WebKit/WebKit.xcodeproj/project.pbxproj

    r17299 r17352  
    334334                3944607E020F50ED0ECA1767 /* WebBackForwardList.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebBackForwardList.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    335335                3944607F020F50ED0ECA1767 /* WebHistoryItem.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHistoryItem.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    336                 39446080020F50ED0ECA1767 /* WebHistoryItem.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebHistoryItem.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     336                39446080020F50ED0ECA1767 /* WebHistoryItem.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 30; indentWidth = 4; path = WebHistoryItem.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    337337                4BF99F8E0AE050BC00815C2B /* WebEditorClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebEditorClient.h; sourceTree = "<group>"; };
    338338                4BF99F8F0AE050BC00815C2B /* WebEditorClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebEditorClient.mm; sourceTree = "<group>"; };
     
    420420                83E679780726D7CF006C7A36 /* WebPluginViewFactoryPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginViewFactoryPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    421421                84311A1205EAAAF00088EDA4 /* WebResource.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebResource.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    422                 84311A1305EAAAF00088EDA4 /* WebResource.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebResource.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     422                84311A1305EAAAF00088EDA4 /* WebResource.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebResource.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    423423                84311AF105EAB12B0088EDA4 /* WebResourcePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebResourcePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    424424                846171F90624AE5B0071A4A3 /* WebDOMOperations.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDOMOperations.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    425                 846171FA0624AE5B0071A4A3 /* WebDOMOperations.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebDOMOperations.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     425                846171FA0624AE5B0071A4A3 /* WebDOMOperations.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebDOMOperations.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    426426                8467275C0367158500CA2ACA /* WebPluginController.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginController.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    427427                8467275D0367158500CA2ACA /* WebPluginController.mm */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebPluginController.mm; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    485485                DD7CDEE60A23BA9E00069928 /* WebTypesInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebTypesInternal.h; sourceTree = "<group>"; };
    486486                DD89681E09AA87240097E7F0 /* WebElementDictionary.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebElementDictionary.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    487                 DD89681F09AA87240097E7F0 /* WebElementDictionary.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebElementDictionary.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     487                DD89681F09AA87240097E7F0 /* WebElementDictionary.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebElementDictionary.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    488488                ED21B9810528F7AA003299AC /* WebDocumentInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebDocumentInternal.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    489489                ED2B2474033A2DA800C1A526 /* WebNSPasteboardExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSPasteboardExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    490                 ED2B2475033A2DA800C1A526 /* WebNSPasteboardExtras.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSPasteboardExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     490                ED2B2475033A2DA800C1A526 /* WebNSPasteboardExtras.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebNSPasteboardExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    491491                ED6BE2E5088C32B50044DEDC /* WebNSAttributedStringExtras.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebNSAttributedStringExtras.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    492492                ED6BE2E6088C32B50044DEDC /* WebNSAttributedStringExtras.m */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebNSAttributedStringExtras.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    515515                F59668C902AD2923018635CA /* WebStringTruncator.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebStringTruncator.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    516516                F59EAE3E0253C7EE018635CA /* WebCoreStatistics.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebCoreStatistics.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    517                 F59EAE410253C8DE018635CA /* WebCoreStatistics.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebCoreStatistics.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     517                F59EAE410253C8DE018635CA /* WebCoreStatistics.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebCoreStatistics.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    518518                F5A55DC702BAA2E8018635CC /* WebHTMLRepresentationPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebHTMLRepresentationPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    519519                F5A672B90263866E01000102 /* WebBaseNetscapePluginStream.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebBaseNetscapePluginStream.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     
    538538                F5F717230288493C018635CA /* npapi.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = npapi.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    539539                F5F7174C02885C5B018635CA /* WebViewFactory.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebViewFactory.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    540                 F5F7174D02885C5B018635CA /* WebViewFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebViewFactory.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     540                F5F7174D02885C5B018635CA /* WebViewFactory.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; path = WebViewFactory.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    541541                F5F732D202FF4D4F01A80180 /* WebKit.exp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.exports; path = WebKit.exp; sourceTree = SOURCE_ROOT; };
    542542                F5F81C3902B67C26018635CA /* WebRenderNode.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = WebRenderNode.h; path = ../WebView/WebRenderNode.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    543                 F5F81C3A02B67C26018635CA /* WebRenderNode.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; name = WebRenderNode.m; path = ../WebView/WebRenderNode.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
     543                F5F81C3A02B67C26018635CA /* WebRenderNode.m */ = {isa = PBXFileReference; explicitFileType = sourcecode.cpp.objcpp; fileEncoding = 4; indentWidth = 4; name = WebRenderNode.m; path = ../WebView/WebRenderNode.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
    544544                F738C9E903FAD3DF0321FBE0 /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = JavaScriptCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
    545545                F738C9EA03FAD3DF0321FBE0 /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
  • trunk/WebKit/WebView/WebFrame.mm

    r17349 r17352  
    735735        [childFrame loadArchive:archive];
    736736    else
    737         [childFrame _frameLoader]->load(URL, referrer, childLoadType, nil, nil, nil, nil);
     737        [childFrame _frameLoader]->load(URL, referrer, childLoadType, String(), nil, nil, nil);
    738738}
    739739
Note: See TracChangeset for help on using the changeset viewer.