Changeset 56548 in webkit


Ignore:
Timestamp:
Mar 25, 2010 8:25:40 AM (14 years ago)
Author:
eric@webkit.org
Message:

2010-03-25 Jochen Eisinger <jochen@chromium.org>

Reviewed by Jeremy Orlow.

Forward DatabaseTracker::canEstablishDatabase to chromium layer.
https://bugs.webkit.org/show_bug.cgi?id=36595

  • storage/chromium/DatabaseObserver.h:
  • storage/chromium/DatabaseTrackerChromium.cpp: (WebCore::DatabaseTracker::canEstablishDatabase):

2010-03-25 Jochen Eisinger <jochen@chromium.org>

Reviewed by Jeremy Orlow.

Forward DatabaseTracker::canEstablishDatabase to chromium layer.
https://bugs.webkit.org/show_bug.cgi?id=36595

  • public/WebFrameClient.h: (WebKit::WebFrameClient::allowDatabase):
  • src/DatabaseObserver.cpp: (WebCore::DatabaseObserver::canEstablishDatabase):
  • src/WebWorkerBase.h: (WebKit::WebWorkerBase::allowDatabase):
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r56546 r56548  
     12010-03-25  Jochen Eisinger  <jochen@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Forward DatabaseTracker::canEstablishDatabase to chromium layer.
     6        https://bugs.webkit.org/show_bug.cgi?id=36595
     7
     8        * storage/chromium/DatabaseObserver.h:
     9        * storage/chromium/DatabaseTrackerChromium.cpp:
     10        (WebCore::DatabaseTracker::canEstablishDatabase):
     11
    1122010-03-25  yael aharon  <yael.aharon@nokia.com>
    213
  • trunk/WebCore/storage/chromium/DatabaseObserver.h

    r50434 r56548  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3535
    3636class Database;
     37class ScriptExecutionContext;
     38class String;
    3739
    3840// The implementation of this class is in the WebKit API (Chromium source tree)
    39 // in webkit/api/src/DatabaseObserver.cpp.
     41// in WebKit/chromium/src/DatabaseObserver.cpp.
    4042class DatabaseObserver {
    4143public:
     44    static bool canEstablishDatabase(ScriptExecutionContext*, const String&, const String&, unsigned long);
    4245    static void databaseOpened(Database*);
    4346    static void databaseModified(Database*);
  • trunk/WebCore/storage/chromium/DatabaseTrackerChromium.cpp

    r54506 r56548  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    5858}
    5959
    60 bool DatabaseTracker::canEstablishDatabase(ScriptExecutionContext*, const String&, const String&, unsigned long)
     60bool DatabaseTracker::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize)
    6161{
    62     // In Chromium, a database can always be established (even though we might not
    63     // be able to write anything to it if the quota for this origin was exceeded)
    64     return true;
     62    return DatabaseObserver::canEstablishDatabase(scriptExecutionContext, name, displayName, estimatedSize);
    6563}
    6664
  • trunk/WebKit/chromium/ChangeLog

    r56515 r56548  
     12010-03-25  Jochen Eisinger  <jochen@chromium.org>
     2
     3        Reviewed by Jeremy Orlow.
     4
     5        Forward DatabaseTracker::canEstablishDatabase to chromium layer.
     6        https://bugs.webkit.org/show_bug.cgi?id=36595
     7
     8        * public/WebFrameClient.h:
     9        (WebKit::WebFrameClient::allowDatabase):
     10        * src/DatabaseObserver.cpp:
     11        (WebCore::DatabaseObserver::canEstablishDatabase):
     12        * src/WebWorkerBase.h:
     13        (WebKit::WebWorkerBase::allowDatabase):
     14
    1152010-03-10  John Abd-El-Malek  <jam@chromium.org>
    216
  • trunk/WebKit/chromium/public/WebFrameClient.h

    r56070 r56548  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    264264    virtual bool allowScript(WebFrame*, bool enabledPerSettings) { return enabledPerSettings; }
    265265
     266    // Controls whether access to Web Databases is allowed for this frame.
     267    virtual bool allowDatabase(const WebSecurityOrigin&, const WebString&, const WebString&, unsigned long) { return true; }
     268
    266269    // Notifies the client that the frame would have executed script if script were enabled.
    267270    virtual void didNotAllowScript(WebFrame*) { }
  • trunk/WebKit/chromium/src/DatabaseObserver.cpp

    r50961 r56548  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    3333
    3434#include "Database.h"
     35#include "Document.h"
     36#include "ScriptExecutionContext.h"
    3537#include "WebDatabase.h"
    3638#include "WebDatabaseObserver.h"
     39#include "WebFrameClient.h"
     40#include "WebFrameImpl.h"
     41#include "WebSecurityOrigin.h"
     42#include "WebWorkerImpl.h"
     43#include "WorkerContext.h"
     44#include "WorkerThread.h"
    3745
    3846using namespace WebKit;
    3947
    4048namespace WebCore {
     49
     50bool DatabaseObserver::canEstablishDatabase(ScriptExecutionContext* scriptExecutionContext, const String& name, const String& displayName, unsigned long estimatedSize)
     51{
     52    ASSERT(isMainThread());
     53    ASSERT(scriptExecutionContext->isDocument() || scriptExecutionContext->isWorkerContext());
     54    if (scriptExecutionContext->isDocument()) {
     55        Document* document = static_cast<Document*>(scriptExecutionContext);
     56        WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame());
     57        return webFrame->client()->allowDatabase(WebSecurityOrigin(scriptExecutionContext->securityOrigin()), name, displayName, estimatedSize);
     58    } else {
     59        WorkerContext* worker = static_cast<WorkerContext*>(scriptExecutionContext);
     60        WorkerLoaderProxy* workerLoaderProxy = &worker->thread()->workerLoaderProxy();
     61        WebWorkerImpl* webWorker = reinterpret_cast<WebWorkerImpl*>(workerLoaderProxy);
     62        return webWorker->allowDatabase(WebSecurityOrigin(scriptExecutionContext->securityOrigin()), name, displayName, estimatedSize);
     63    }
     64}
    4165
    4266void DatabaseObserver::databaseOpened(Database* database)
  • trunk/WebKit/chromium/src/WebWorkerBase.h

    r50751 r56548  
    11/*
    2  * Copyright (C) 2009 Google Inc. All rights reserved.
     2 * Copyright (C) 2010 Google Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    4646namespace WebKit {
    4747class WebCommonWorkerClient;
     48class WebSecurityOrigin;
     49class WebString;
    4850class WebURL;
    4951class WebView;
     52class WebWorker;
    5053class WebWorkerClient;
    5154
     
    7780    virtual void postTaskForModeToWorkerContext(
    7881        PassOwnPtr<WebCore::ScriptExecutionContext::Task>, const WebCore::String& mode);
     82
     83    // Controls whether access to Web Databases is allowed for this worker.
     84    virtual bool allowDatabase(const WebSecurityOrigin&, const WebString&, const WebString&, unsigned long) { return true; }
    7985
    8086    // Executes the given task on the main thread.
Note: See TracChangeset for help on using the changeset viewer.