Changeset 70561 in webkit


Ignore:
Timestamp:
Oct 26, 2010 1:16:18 PM (14 years ago)
Author:
bweinstein@apple.com
Message:

Need a way to retrieve custom user agent from a WKPage
https://bugs.webkit.org/show_bug.cgi?id=48360
<rdar://problem/8466537>

Reviewed by Darin Adler.

Add an exported function on WKPage to get the page's custom user agent.

  • UIProcess/API/C/WKPage.cpp:

(WKPageCopyCustomUserAgent): Exported function that returns the custom user

agent.

  • UIProcess/API/C/WKPage.h:
  • UIProcess/WebPageProxy.cpp:

(WebKit::WebPageProxy::close): Clear the custom user agent string.
(WebKit::WebPageProxy::processDidCrash): Ditto.
(WebKit::WebPageProxy::setCustomUserAgent): Add a new early return if we're setting

the custom user agent to what it was before, and set the custom user agent member
variable.

  • UIProcess/WebPageProxy.h:

(WebKit::WebPageProxy::customUserAgent): Returns the custom user agent.

Location:
trunk/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r70548 r70561  
     12010-10-26  Brian Weinstein  <bweinstein@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Need a way to retrieve custom user agent from a WKPage
     6        https://bugs.webkit.org/show_bug.cgi?id=48360
     7        <rdar://problem/8466537>
     8       
     9        Add an exported function on WKPage to get the page's custom user agent.
     10
     11        * UIProcess/API/C/WKPage.cpp:
     12        (WKPageCopyCustomUserAgent): Exported function that returns the custom user
     13            agent.
     14        * UIProcess/API/C/WKPage.h:
     15        * UIProcess/WebPageProxy.cpp:
     16        (WebKit::WebPageProxy::close): Clear the custom user agent string.
     17        (WebKit::WebPageProxy::processDidCrash): Ditto.
     18        (WebKit::WebPageProxy::setCustomUserAgent): Add a new early return if we're setting
     19            the custom user agent to what it was before, and set the custom user agent member
     20            variable.
     21        * UIProcess/WebPageProxy.h:
     22        (WebKit::WebPageProxy::customUserAgent): Returns the custom user agent.
     23
    1242010-10-26  Simon Fraser  <simon.fraser@apple.com>
    225
  • trunk/WebKit2/UIProcess/API/C/WKPage.cpp

    r70504 r70561  
    153153}
    154154
     155WKStringRef WKPageCopyCustomUserAgent(WKPageRef pageRef)
     156{
     157    return toCopiedAPI(toImpl(pageRef)->customUserAgent());
     158}
     159
    155160void WKPageSetCustomUserAgent(WKPageRef pageRef, WKStringRef userAgentRef)
    156161{
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r70510 r70561  
    215215WK_EXPORT WKInspectorRef WKPageGetInspector(WKPageRef page);
    216216
     217WK_EXPORT WKStringRef WKPageCopyCustomUserAgent(WKPageRef page);
    217218WK_EXPORT void WKPageSetCustomUserAgent(WKPageRef page, WKStringRef userAgent);
    218219
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r70504 r70561  
    187187    m_mainFrame = 0;
    188188
     189    m_customUserAgent = String();
    189190    m_pageTitle = String();
    190191    m_toolTip = String();
     
    458459        return;
    459460
     461    if (m_customUserAgent == userAgent || (m_customUserAgent.isEmpty() && userAgent.isEmpty()))
     462        return;
     463
     464    m_customUserAgent = userAgent;
    460465    process()->send(Messages::WebPage::SetCustomUserAgent(userAgent), m_pageID);
    461466}
     
    11791184    }
    11801185
     1186    m_customUserAgent = String();
    11811187    m_pageTitle = String();
    11821188    m_toolTip = String();
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r70504 r70561  
    167167    const String& pageTitle() const { return m_pageTitle; }
    168168    const String& toolTip() const { return m_toolTip; }
     169    const String& customUserAgent() const { return m_customUserAgent; }
    169170
    170171    double estimatedProgress() const { return m_estimatedProgress; }
     
    328329    String m_pageTitle;
    329330
     331    String m_customUserAgent;
     332
    330333    RefPtr<WebInspectorProxy> m_inspector;
    331334
Note: See TracChangeset for help on using the changeset viewer.