Changeset 149646 in webkit


Ignore:
Timestamp:
May 6, 2013 3:49:17 PM (11 years ago)
Author:
ap@apple.com
Message:

<rdar://problem/13479806> [Mac] Pass information about open pages to LaunchServices
https://bugs.webkit.org/show_bug.cgi?id=115665

Reviewed by Darin Adler.

  • WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): Moved repeated check for frame->isMainFrame() to the top, matching oter similar functions. Call updateActivePages().
  • WebProcess/WebProcess.cpp: (WebKit::WebProcess::networkProcessConnectionClosed): Removed an obsolete FIXME. (WebKit::WebProcess::updateActivePages): Empty implementation for platforms that don't need to do anything here.
  • WebProcess/WebProcess.h: Added updateActivePages().
  • WebProcess/mac/WebProcessMac.mm: (WebKit::WebProcess::updateActivePages): Collect user visible origins of pages in the process and pass them to LS.
Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r149644 r149646  
     12013-05-06  Alexey Proskuryakov  <ap@apple.com>
     2
     3        <rdar://problem/13479806> [Mac] Pass information about open pages to LaunchServices
     4        https://bugs.webkit.org/show_bug.cgi?id=115665
     5
     6        Reviewed by Darin Adler.
     7
     8        * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::didCommitLoad): Moved repeated
     9        check for frame->isMainFrame() to the top, matching oter similar functions.
     10        Call updateActivePages().
     11
     12        * WebProcess/WebProcess.cpp:
     13        (WebKit::WebProcess::networkProcessConnectionClosed): Removed an obsolete FIXME.
     14        (WebKit::WebProcess::updateActivePages): Empty implementation for platforms
     15        that don't need to do anything here.
     16
     17        * WebProcess/WebProcess.h: Added updateActivePages().
     18
     19        * WebProcess/mac/WebProcessMac.mm: (WebKit::WebProcess::updateActivePages):
     20        Collect user visible origins of pages in the process and pass them to LS.
     21
    1222013-05-06  Mark Rowe  <mrowe@apple.com>
    223
  • trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp

    r149561 r149646  
    39533953void WebPage::didCommitLoad(WebFrame* frame)
    39543954{
     3955    if (!frame->isMainFrame())
     3956        return;
     3957
    39553958    // If previous URL is invalid, then it's not a real page that's being navigated away from.
    39563959    // Most likely, this is actually the first load to be committed in this page.
    3957     if (frame->isMainFrame() && frame->coreFrame()->loader()->previousURL().isValid())
     3960    if (frame->coreFrame()->loader()->previousURL().isValid())
    39583961        reportUsedFeatures();
    39593962
    39603963    // Only restore the scale factor for standard frame loads (of the main frame).
    3961     if (frame->isMainFrame() && frame->coreFrame()->loader()->loadType() == FrameLoadTypeStandard) {
     3964    if (frame->coreFrame()->loader()->loadType() == FrameLoadTypeStandard) {
    39623965        Page* page = frame->coreFrame()->page();
    39633966        if (page && page->pageScaleFactor() != 1)
     
    39663969
    39673970#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
    3968     if (frame->isMainFrame())
    3969         resetPrimarySnapshottedPlugIn();
    3970 #endif
     3971    resetPrimarySnapshottedPlugIn();
     3972#endif
     3973
     3974    WebProcess::shared().updateActivePages();
    39713975}
    39723976
  • trunk/Source/WebKit2/WebProcess/WebProcess.cpp

    r149332 r149646  
    10341034void WebProcess::networkProcessConnectionClosed(NetworkProcessConnection* connection)
    10351035{
    1036     // FIXME (NetworkProcess): How do we handle not having the connection when the WebProcess needs it?
    1037     // If the NetworkProcess crashed, for example.  Do we respawn it?
    10381036    ASSERT(m_networkProcessConnection);
    10391037    ASSERT(m_networkProcessConnection == connection);
     
    11241122{
    11251123}
     1124
     1125void WebProcess::updateActivePages()
     1126{
     1127}
     1128
    11261129#endif
    11271130   
  • trunk/Source/WebKit2/WebProcess/WebProcess.h

    r148715 r149646  
    185185    void pageDidEnterWindow(WebPage*);
    186186    void pageWillLeaveWindow(WebPage*);
    187    
     187
    188188    void nonVisibleProcessCleanupTimerFired(WebCore::Timer<WebProcess>*);
     189
     190    void updateActivePages();
    189191
    190192private:
  • trunk/Source/WebKit2/WebProcess/mac/WebProcessMac.mm

    r149413 r149646  
    3131#import "SandboxInitializationParameters.h"
    3232#import "WKFullKeyboardAccessWatcher.h"
     33#import "WebFrame.h"
    3334#import "WebInspector.h"
    3435#import "WebPage.h"
     
    4041#import <WebCore/MemoryCache.h>
    4142#import <WebCore/PageCache.h>
     43#import <WebCore/WebCoreNSURLExtras.h>
    4244#import <WebKitSystemInterface.h>
    4345#import <algorithm>
     
    5658using namespace std;
    5759
     60const CFStringRef kLSActivePageUserVisibleOriginsKey = CFSTR("LSActivePageUserVisibleOriginsKey");
     61
    5862namespace WebKit {
    5963
     
    221225}
    222226
     227void WebProcess::updateActivePages()
     228{
     229#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     230    RetainPtr<CFMutableArrayRef> activePageURLs = adoptCF(CFArrayCreateMutable(0, 0, &kCFTypeArrayCallBacks));
     231    for (const auto& iter: m_pageMap) {
     232        WebPage* page = iter.value.get();
     233        WebFrame* mainFrame = page->mainWebFrame();
     234        if (!mainFrame)
     235            continue;
     236        String mainFrameOriginString;
     237        RefPtr<SecurityOrigin> mainFrameOrigin = SecurityOrigin::createFromString(mainFrame->url());
     238        if (!mainFrameOrigin->isUnique())
     239            mainFrameOriginString = mainFrameOrigin->toRawString();
     240        else
     241            mainFrameOriginString = KURL(KURL(), mainFrame->url()).protocol() + ':'; // toRawString() is not supposed to work with unique origins, and would just return "://".
     242        CFArrayAppendValue(activePageURLs.get(), userVisibleString([NSURL URLWithString:mainFrameOriginString]));
     243    }
     244    WKSetApplicationInformationItem(kLSActivePageUserVisibleOriginsKey, activePageURLs.get());
     245#endif
     246}
     247
    223248} // namespace WebKit
Note: See TracChangeset for help on using the changeset viewer.