本文整理汇总了C++中ChromeClient类的典型用法代码示例。如果您正苦于以下问题:C++ ChromeClient类的具体用法?C++ ChromeClient怎么用?C++ ChromeClient使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChromeClient类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: logPluginRequest
static void logPluginRequest(Page* page, const String& mimeType, const String& url, bool success)
{
if (!page || !page->settings()->diagnosticLoggingEnabled())
return;
String newMIMEType = mimeType;
if (!newMIMEType) {
// Try to figure out the MIME type from the URL extension.
newMIMEType = findPluginMIMETypeFromURL(page, url);
if (!newMIMEType)
return;
}
PluginData* pluginData = page->pluginData();
String pluginFile = pluginData ? pluginData->pluginFileForMimeType(newMIMEType) : String();
String description = !pluginFile ? newMIMEType : pluginFile;
ChromeClient* client = page->chrome().client();
client->logDiagnosticMessage(success ? DiagnosticLoggingKeys::pluginLoadedKey() : DiagnosticLoggingKeys::pluginLoadingFailedKey(), description, DiagnosticLoggingKeys::noopKey());
if (!page->hasSeenAnyPlugin())
client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsAtLeastOnePluginKey(), emptyString(), DiagnosticLoggingKeys::noopKey());
if (!page->hasSeenPlugin(description))
client->logDiagnosticMessage(DiagnosticLoggingKeys::pageContainsPluginKey(), description, DiagnosticLoggingKeys::noopKey());
page->sawPlugin(description);
}
示例2: toFrameView
void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotification notification)
{
if (obj && obj->isAccessibilityScrollbar() && notification == AXValueChanged) {
// Send document value changed on scrollbar value changed notification.
Scrollbar* scrollBar = static_cast<AccessibilityScrollbar*>(obj)->scrollbar();
if (!scrollBar || !scrollBar->parent() || !scrollBar->parent()->isFrameView())
return;
Document* document = toFrameView(scrollBar->parent())->frame()->document();
if (document != document->topDocument())
return;
obj = get(document->renderer());
}
if (!obj || !obj->document() || !obj->documentFrameView() || !obj->documentFrameView()->frame() || !obj->documentFrameView()->frame()->page())
return;
ChromeClient* client = obj->documentFrameView()->frame()->page()->chrome().client();
if (!client)
return;
switch (notification) {
case AXActiveDescendantChanged:
if (!obj->document()->focusedNode() || (obj->node() != obj->document()->focusedNode()))
break;
// Calling handleFocusedUIElementChanged will focus the new active
// descendant and send the AXFocusedUIElementChanged notification.
handleFocusedUIElementChanged(0, obj->document()->focusedNode());
break;
case AXAriaAttributeChanged:
case AXAutocorrectionOccured:
case AXCheckedStateChanged:
case AXChildrenChanged:
case AXFocusedUIElementChanged:
case AXInvalidStatusChanged:
case AXLayoutComplete:
case AXLiveRegionChanged:
case AXLoadComplete:
case AXMenuListItemSelected:
case AXMenuListValueChanged:
case AXRowCollapsed:
case AXRowCountChanged:
case AXRowExpanded:
case AXScrolledToAnchor:
case AXSelectedChildrenChanged:
case AXSelectedTextChanged:
case AXTextChanged:
case AXValueChanged:
break;
}
client->postAccessibilityNotification(obj, notification);
}
示例3: setPaletteFromPageClientIfExists
void RenderThemeQStyle::setPaletteFromPageClientIfExists(QPalette& palette) const
{
if (!m_page)
return;
ChromeClient* chromeClient = m_page->chrome().client();
if (!chromeClient)
return;
if (QWebPageClient* pageClient = chromeClient->platformPageClient())
palette = pageClient->palette();
}
示例4: handleDOMActivateEvent
void ColorInputType::handleDOMActivateEvent(Event* event)
{
if (element().isDisabledFormControl() || !element().layoutObject())
return;
if (!UserGestureIndicator::processingUserGesture())
return;
ChromeClient* chromeClient = this->chromeClient();
if (chromeClient && !m_chooser)
m_chooser = chromeClient->openColorChooser(element().document().frame(), this, valueAsColor());
event->setDefaultHandled();
}
示例5: setPaletteFromPageClientIfExists
void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const
{
// If the webview has a custom palette, use it
if (!m_page)
return;
Chrome* chrome = m_page->chrome();
if (!chrome)
return;
ChromeClient* chromeClient = chrome->client();
if (!chromeClient)
return;
QWebPageClient* pageClient = chromeClient->platformPageClient();
if (!pageClient)
return;
palette = pageClient->palette();
}
示例6: ASSERT
void TextFieldInputType::createShadowSubtree()
{
ASSERT(element()->hasShadowRoot());
ASSERT(!m_innerText);
ASSERT(!m_innerBlock);
ASSERT(!m_innerSpinButton);
Document* document = element()->document();
ChromeClient* chromeClient = document->page() ? document->page()->chrome()->client() : 0;
bool shouldAddDecorations = chromeClient && chromeClient->willAddTextFieldDecorationsTo(element());
bool shouldHaveSpinButton = this->shouldHaveSpinButton();
bool createsContainer = shouldHaveSpinButton || needsContainer() || shouldAddDecorations;
ExceptionCode ec = 0;
m_innerText = TextControlInnerTextElement::create(document);
if (!createsContainer) {
element()->shadowTree()->oldestShadowRoot()->appendChild(m_innerText, ec);
return;
}
ShadowRoot* shadowRoot = element()->shadowTree()->oldestShadowRoot();
m_container = HTMLDivElement::create(document);
m_container->setShadowPseudoId("-webkit-textfield-decoration-container");
shadowRoot->appendChild(m_container, ec);
m_innerBlock = TextControlInnerElement::create(document);
m_innerBlock->appendChild(m_innerText, ec);
m_container->appendChild(m_innerBlock, ec);
#if ENABLE(INPUT_SPEECH)
ASSERT(!m_speechButton);
if (element()->isSpeechEnabled()) {
m_speechButton = InputFieldSpeechButtonElement::create(document);
m_container->appendChild(m_speechButton, ec);
}
#endif
if (shouldHaveSpinButton) {
m_innerSpinButton = SpinButtonElement::create(document);
m_container->appendChild(m_innerSpinButton, ec);
}
if (shouldAddDecorations)
chromeClient->addTextFieldDecorationsTo(element());
}
示例7: node
bool RenderSVGRoot::isEmbeddedThroughSVGImage() const
{
if (!node())
return false;
Frame* frame = node()->document()->frame();
if (!frame)
return false;
// Test whether we're embedded through an img.
if (!frame->page() || !frame->page()->chrome())
return false;
ChromeClient* chromeClient = frame->page()->chrome()->client();
if (!chromeClient || !chromeClient->isSVGImageChromeClient())
return false;
return true;
}
示例8: ASSERT
void FormData::generateFiles(Document* document)
{
ASSERT(!m_hasGeneratedFiles);
if (m_hasGeneratedFiles)
return;
Page* page = document->page();
if (!page)
return;
ChromeClient* client = page->chrome()->client();
size_t n = m_elements.size();
for (size_t i = 0; i < n; ++i) {
FormDataElement& e = m_elements[i];
if (e.m_type == FormDataElement::encodedFile && e.m_shouldGenerateFile) {
e.m_generatedFilename = client->generateReplacementFile(e.m_filename);
m_hasGeneratedFiles = true;
}
}
}
示例9: USE
void RenderThemeQt::setPaletteFromPageClientIfExists(QPalette& palette) const
{
#if USE(QT_MOBILE_THEME)
static QPalette lightGrayPalette(Qt::lightGray);
palette = lightGrayPalette;
return;
#endif
// If the webview has a custom palette, use it
if (!m_page)
return;
Chrome* chrome = m_page->chrome();
if (!chrome)
return;
ChromeClient* chromeClient = chrome->client();
if (!chromeClient)
return;
QWebPageClient* pageClient = chromeClient->platformPageClient();
if (!pageClient)
return;
palette = pageClient->palette();
}
示例10: TEST_F
TEST_F(ChromeClientTest, SetToolTipFlood) {
ChromeClientToolTipLogger logger;
ChromeClient* client = &logger;
HitTestResult result(HitTestRequest(HitTestRequest::Move),
LayoutPoint(10, 20));
Document* doc = Document::create();
Element* element = HTMLElement::create(HTMLNames::divTag, *doc);
element->setAttribute(HTMLNames::titleAttr, "tooltip");
result.setInnerNode(element);
client->setToolTip(*doc->frame(), result);
EXPECT_EQ("tooltip", logger.toolTipForLastSetToolTip());
// seToolTip(HitTestResult) again in the same condition.
logger.clearToolTipForLastSetToolTip();
client->setToolTip(*doc->frame(), result);
// setToolTip(String,TextDirection) should not be called.
EXPECT_EQ(String(), logger.toolTipForLastSetToolTip());
// Cancel the tooltip, and setToolTip(HitTestResult) again.
client->clearToolTip(*doc->frame());
logger.clearToolTipForLastSetToolTip();
client->setToolTip(*doc->frame(), result);
// setToolTip(String,TextDirection) should not be called.
EXPECT_EQ(String(), logger.toolTipForLastSetToolTip());
logger.clearToolTipForLastSetToolTip();
element->setAttribute(HTMLNames::titleAttr, "updated");
client->setToolTip(*doc->frame(), result);
// setToolTip(String,TextDirection) should be called because tooltip string
// is different from the last one.
EXPECT_EQ("updated", logger.toolTipForLastSetToolTip());
}
示例11: postPlatformNotification
void AXObjectCache::postPlatformNotification(AccessibilityObject* obj, AXNotification notification)
{
if (!obj || !obj->document() || !obj->documentFrameView() || !obj->documentFrameView()->frame() || !obj->documentFrameView()->frame()->page())
return;
ChromeClient* client = obj->documentFrameView()->frame()->page()->chrome()->client();
if (!client)
return;
switch (notification) {
case AXActiveDescendantChanged:
if (!obj->document()->focusedNode() || (obj->node() != obj->document()->focusedNode()))
break;
// Calling handleFocusedUIElementChanged will focus the new active
// descendant and send the AXFocusedUIElementChanged notification.
handleFocusedUIElementChanged(0, obj->document()->focusedNode()->renderer());
break;
case AXCheckedStateChanged:
case AXChildrenChanged:
case AXFocusedUIElementChanged:
case AXLayoutComplete:
case AXLiveRegionChanged:
case AXLoadComplete:
case AXMenuListValueChanged:
case AXRowCollapsed:
case AXRowCountChanged:
case AXRowExpanded:
case AXScrolledToAnchor:
case AXSelectedChildrenChanged:
case AXSelectedTextChanged:
case AXValueChanged:
break;
}
client->postAccessibilityNotification(obj, notification);
}
示例12: effectiveType
WebScreenOrientationType ScreenOrientationController::effectiveType(ChromeClient& chromeClient)
{
return m_override ? m_overrideType : chromeClient.screenInfo().orientationType;
}
示例13: effectiveAngle
unsigned short ScreenOrientationController::effectiveAngle(ChromeClient& chromeClient)
{
return m_override ? m_overrideAngle : chromeClient.screenInfo().orientationAngle;
}
示例14: switch
ControlPart RenderThemeQt::applyTheme(QStyleOption& option, RenderObject* o) const
{
// Default bits: no focus, no mouse over
option.state &= ~(QStyle::State_HasFocus | QStyle::State_MouseOver);
if (!isEnabled(o))
option.state &= ~QStyle::State_Enabled;
if (isReadOnlyControl(o))
// Readonly is supported on textfields.
option.state |= QStyle::State_ReadOnly;
if (supportsFocus(o->style()->appearance()) && isFocused(o)) {
option.state |= QStyle::State_HasFocus;
option.state |= QStyle::State_KeyboardFocusChange;
}
if (isHovered(o))
option.state |= QStyle::State_MouseOver;
option.direction = Qt::LeftToRight;
if (o->style() && o->style()->direction() == WebCore::RTL)
option.direction = Qt::RightToLeft;
ControlPart result = o->style()->appearance();
switch (result) {
case PushButtonPart:
case SquareButtonPart:
case ButtonPart:
case ButtonBevelPart:
case ListItemPart:
case MenulistButtonPart:
case SearchFieldResultsButtonPart:
case SearchFieldCancelButtonPart: {
if (isPressed(o))
option.state |= QStyle::State_Sunken;
else if (result == PushButtonPart)
option.state |= QStyle::State_Raised;
break;
}
}
if (result == RadioPart || result == CheckboxPart)
option.state |= (isChecked(o) ? QStyle::State_On : QStyle::State_Off);
#ifdef Q_WS_MAEMO_5
static QPalette lightGrayPalette(Qt::lightGray);
option.palette = lightGrayPalette;
#else
// If the owner widget has a custom palette, use it
Page* page = o->document()->page();
if (page) {
ChromeClient* client = page->chrome()->client();
QWebPageClient* pageClient = client->platformPageClient();
if (pageClient)
option.palette = pageClient->palette();
}
#endif
return result;
}