String ChromiumBridge::getFontFamilyForCharacters(const UChar* characters, size_t numCharacters) { if (webKitClient()->sandboxSupport()) return webKitClient()->sandboxSupport()->getFontFamilyForCharacters(characters, numCharacters); WebCString family = WebFontInfo::familyForChars(characters, numCharacters); if (family.data()) return WebString::fromUTF8(family.data()); return WebString(); }
void ChromiumBridge::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result) { WebFontRenderStyle style; if (webKitClient()->sandboxSupport()) webKitClient()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); else WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); style.toFontRenderStyle(result); }
bool ChromiumBridge::getFileModificationTime(const String& path, time_t& result) { double modificationTime; if (webKitClient()->fileSystem()) { if (!webKitClient()->fileSystem()->getFileModificationTime(path, modificationTime)) return false; } else { if (!webKitClient()->getFileModificationTime(path, modificationTime)) return false; } result = static_cast<time_t>(modificationTime); return true; }
void SocketStreamHandleInternal::connect(const KURL& url) { m_socket = adoptPtr(webKitClient()->createSocketStreamHandle()); LOG(Network, "connect"); ASSERT(m_socket.get()); m_socket->connect(url, this); }
void ChromiumBridge::paintScrollbarArrow( GraphicsContext* gc, int state, int classicState, const IntRect& rect) { webKitClient()->themeEngine()->paintScrollbarArrow( gc->platformContext()->canvas(), state, classicState, rect); }
LinkHash ChromiumBridge::visitedLinkHash(const KURL& base, const AtomicString& attributeURL) { // Resolve the relative URL using googleurl and pass the absolute URL up to // the embedder. We could create a GURL object from the base and resolve // the relative URL that way, but calling the lower-level functions // directly saves us the string allocation in most cases. url_canon::RawCanonOutput<2048> buffer; url_parse::Parsed parsed; #if USE(GOOGLEURL) const CString& cstr = base.utf8String(); const char* data = cstr.data(); int length = cstr.length(); const url_parse::Parsed& srcParsed = base.parsed(); #else // When we're not using GoogleURL, first canonicalize it so we can resolve it // below. url_canon::RawCanonOutput<2048> srcCanon; url_parse::Parsed srcParsed; String str = base.string(); if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed)) return 0; const char* data = srcCanon.data(); int length = srcCanon.length(); #endif if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(), attributeURL.length(), 0, &buffer, &parsed)) return 0; // Invalid resolved URL. return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); }
void ChromiumBridge::paintTrackbar( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect) { webKitClient()->themeEngine()->paintTrackbar( gc->platformContext()->canvas(), part, state, classicState, rect); }
PlatformMessagePortChannel::PlatformMessagePortChannel() : m_localPort(0) { m_webChannel = webKitClient()->createMessagePortChannel(); if (m_webChannel) m_webChannel->setClient(this); }
String ChromiumBridge::signedPublicKeyAndChallengeString( unsigned keySizeIndex, const String& challenge, const KURL& url) { return webKitClient()->signedPublicKeyAndChallengeString(keySizeIndex, WebString(challenge), WebURL(url)); }
bool ChromiumBridge::ensureFontLoaded(HFONT font) { WebSandboxSupport* ss = webKitClient()->sandboxSupport(); // if there is no sandbox, then we can assume the font // was able to be loaded successfully already return ss ? ss->ensureFontLoaded(font) : true; }
LinkHash ChromiumBridge::visitedLinkHash(const UChar* url, unsigned length) { url_canon::RawCanonOutput<2048> buffer; url_parse::Parsed parsed; if (!url_util::Canonicalize(url, length, 0, &buffer, &parsed)) return 0; // Invalid URLs are unvisited. return webKitClient()->visitedLinkHash(buffer.data(), buffer.length()); }
void ChromiumBridge::clipboardWriteSelection(const String& htmlText, const KURL& sourceURL, const String& plainText, bool writeSmartPaste) { webKitClient()->clipboard()->writeHTML( htmlText, sourceURL, plainText, writeSmartPaste); }
bool ChromiumBridge::clipboardIsFormatAvailable( PasteboardPrivate::ClipboardFormat format, PasteboardPrivate::ClipboardBuffer buffer) { return webKitClient()->clipboard()->isFormatAvailable( static_cast<WebClipboard::Format>(format), static_cast<WebClipboard::Buffer>(buffer)); }
void ChromiumBridge::paintThemePart( GraphicsContext* gc, ThemePart part, ThemePaintState state, const IntRect& rect, const ThemePaintExtraParams* extraParams) { WebThemeEngine::ExtraParams webThemeExtraParams; GetWebThemeExtraParams(part, state, extraParams, &webThemeExtraParams); webKitClient()->themeEngine()->paint( gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams); }
void ChromiumBridge::clipboardReadHTML( PasteboardPrivate::ClipboardBuffer buffer, String* htmlText, KURL* sourceURL) { WebURL url; *htmlText = webKitClient()->clipboard()->readHTML( static_cast<WebClipboard::Buffer>(buffer), &url); *sourceURL = url; }
AudioDestinationChromium::AudioDestinationChromium(AudioSourceProvider& provider, double sampleRate) : m_provider(provider) , m_renderBus(numberOfChannels, renderBufferSize, false) , m_sampleRate(sampleRate) , m_isPlaying(false) { m_audioDevice = adoptPtr(webKitClient()->createAudioDevice(callbackBufferSize, numberOfChannels, sampleRate, this)); ASSERT(m_audioDevice.get()); }
Vector<String> ChromiumBridge::clipboardReadFilenames(PasteboardPrivate::ClipboardBuffer buffer) { WebVector<WebString> result = webKitClient()->clipboard()->readFilenames( static_cast<WebClipboard::Buffer>(buffer)); Vector<String> convertedResult; for (size_t i = 0; i < result.size(); ++i) convertedResult.append(result[i]); return convertedResult; }
static WebCookieJar* getCookieJar(const Document* document) { WebFrameImpl* frameImpl = WebFrameImpl::fromFrame(document->frame()); if (!frameImpl || !frameImpl->client()) return 0; WebCookieJar* cookieJar = frameImpl->client()->cookieJar(); if (!cookieJar) cookieJar = webKitClient()->cookieJar(); return cookieJar; }
PassRefPtr<Image> ChromiumBridge::loadPlatformImageResource(const char* name) { const WebData& resource = webKitClient()->loadResource(name); if (resource.isEmpty()) return Image::nullImage(); RefPtr<Image> image = BitmapImage::create(); image->setData(resource, true); return image; }
HashSet<String> ChromiumBridge::clipboardReadAvailableTypes( PasteboardPrivate::ClipboardBuffer buffer, bool* containsFilenames) { WebVector<WebString> result = webKitClient()->clipboard()->readAvailableTypes( static_cast<WebClipboard::Buffer>(buffer), containsFilenames); HashSet<String> types; for (size_t i = 0; i < result.size(); ++i) types.add(result[i]); return types; }
void ChromiumBridge::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const String& keyPath, Vector<RefPtr<IDBKey> >& keys) { WebVector<WebSerializedScriptValue> webValues = values; WebVector<WebIDBKey> webKeys; webKitClient()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, WebString(keyPath), webKeys); size_t webKeysSize = webKeys.size(); keys.reserveCapacity(webKeysSize); for (size_t i = 0; i < webKeysSize; ++i) keys.append(PassRefPtr<IDBKey>(webKeys[i])); }
void ChromiumBridge::clipboardWriteImage(NativeImagePtr image, const KURL& sourceURL, const String& title) { #if WEBKIT_USING_SKIA WebImage webImage(*image); #else WebImage webImage(image); #endif webKitClient()->clipboard()->writeImage(webImage, sourceURL, title); }
void ChromiumBridge::paintTextField( GraphicsContext* gc, int part, int state, int classicState, const IntRect& rect, const Color& color, bool fillContentArea, bool drawEdges) { // Fallback to white when |color| is invalid. RGBA32 backgroundColor = color.isValid() ? color.rgb() : Color::white; webKitClient()->themeEngine()->paintTextField( gc->platformContext()->canvas(), part, state, classicState, rect, backgroundColor, fillContentArea, drawEdges); }
void ResourceHandleInternal::start() { if (m_state != ConnectionStateNew) CRASH(); m_state = ConnectionStateStarted; m_loader.set(webKitClient()->createURLLoader()); ASSERT(m_loader.get()); WrappedResourceRequest wrappedRequest(m_request); wrappedRequest.setAllowStoredCredentials(allowStoredCredentials()); m_loader->loadAsynchronously(wrappedRequest, this); }
bool ChromiumBridge::clipboardReadData(PasteboardPrivate::ClipboardBuffer buffer, const String& type, String& data, String& metadata) { WebString resultData; WebString resultMetadata; bool succeeded = webKitClient()->clipboard()->readData( static_cast<WebClipboard::Buffer>(buffer), type, &resultData, &resultMetadata); if (succeeded) { data = resultData; metadata = resultMetadata; } return succeeded; }
bool ChromiumBridge::loadFont(NSFont* srcFont, ATSFontContainerRef* out) { WebSandboxSupport* ss = webKitClient()->sandboxSupport(); if (ss) return ss->loadFont(srcFont, out); // This function should only be called in response to an error loading a // font due to being blocked by the sandbox. // This by definition shouldn't happen if there is no sandbox support. ASSERT_NOT_REACHED(); *out = 0; return false; }
MediaPlayer::SupportsType WebMediaPlayerClientImpl::supportsType(const String& type, const String& codecs) { WebMimeRegistry::SupportsType supportsType = webKitClient()->mimeRegistry()->supportsMediaMIMEType(type, codecs); switch (supportsType) { default: ASSERT_NOT_REACHED(); case WebMimeRegistry::IsNotSupported: return MediaPlayer::IsNotSupported; case WebMimeRegistry::IsSupported: return MediaPlayer::IsSupported; case WebMimeRegistry::MayBeSupported: return MediaPlayer::MayBeSupported; } return MediaPlayer::IsNotSupported; }
// static void ResourceHandle::loadResourceSynchronously(NetworkingContext* context, const ResourceRequest& request, StoredCredentials storedCredentials, ResourceError& error, ResourceResponse& response, Vector<char>& data) { OwnPtr<WebURLLoader> loader(webKitClient()->createURLLoader()); ASSERT(loader.get()); WrappedResourceRequest requestIn(request); requestIn.setAllowStoredCredentials(storedCredentials == AllowStoredCredentials); WrappedResourceResponse responseOut(response); WebURLError errorOut; WebData dataOut; loader->loadSynchronously(requestIn, responseOut, errorOut, dataOut); error = errorOut; data.clear(); data.append(dataOut.data(), dataOut.size()); }
int ChromiumBridge::memoryUsageMB() { return static_cast<int>(webKitClient()->memoryUsageMB()); }
bool ChromiumBridge::isLinkVisited(LinkHash visitedLinkHash) { return webKitClient()->isLinkVisited(visitedLinkHash); }