void WebInspectorProxy::attach(AttachmentSide side) { if (!m_page || !canAttach()) return; m_isAttached = true; m_attachmentSide = side; inspectorPageGroup()->preferences()->setInspectorAttachmentSide(side); if (m_isVisible) inspectorPageGroup()->preferences()->setInspectorStartsAttached(true); switch (m_attachmentSide) { case AttachmentSideBottom: m_page->process().send(Messages::WebInspector::AttachedBottom(), m_page->pageID()); break; case AttachmentSideRight: m_page->process().send(Messages::WebInspector::AttachedRight(), m_page->pageID()); break; } platformAttach(); }
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); #ifdef HAVE_ECORE_X const char* engine = "opengl_x11"; m_inspectorWindow = ecore_evas_new(engine, 0, 0, initialWindowWidth, initialWindowHeight, 0); // Gracefully fall back to software if evas_gl engine is not available. if (!m_inspectorWindow) #endif m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0); if (!m_inspectorWindow) return 0; WKContextRef wkContext = toAPI(page()->process()->context()); WKPageGroupRef wkPageGroup = toAPI(inspectorPageGroup()); m_inspectorView = EWKViewCreate(wkContext, wkPageGroup, ecore_evas_get(m_inspectorWindow), /* smart */ 0); WKViewRef wkView = EWKViewGetWKView(m_inspectorView); WKRetainPtr<WKStringRef> wkTheme = adoptWK(WKStringCreateWithUTF8CString(TEST_THEME_DIR "/default.edj")); WKViewSetThemePath(wkView, wkTheme.get()); WKPreferencesRef wkPreferences = WKPageGroupGetPreferences(wkPageGroup); WKPreferencesSetFileAccessFromFileURLsAllowed(wkPreferences, true); return toImpl(WKViewGetPage(wkView)); }
void WebInspectorProxy::detach() { m_isAttached = false; if (m_isVisible) inspectorPageGroup()->preferences()->setInspectorStartsAttached(false); platformDetach(); }
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(!m_inspectorView); ASSERT(!m_inspectorWindow); RECT emptyRect = { 0 }; m_inspectorView = WebView::create(emptyRect, m_page->context(), inspectorPageGroup(), 0); return m_inspectorView->page(); }
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(!m_inspectorView); ASSERT(!m_inspectorWindow); RECT initialRect = { 0, 0, initialWindowWidth, initialWindowHeight }; m_inspectorView = WebView::create(initialRect, m_page->process()->context(), inspectorPageGroup(), 0); return m_inspectorView->page(); }
// Called by WebInspectorProxy messages void WebInspectorProxy::createInspectorPage(uint64_t& inspectorPageID, WebPageCreationParameters& inspectorPageParameters) { inspectorPageID = 0; if (!m_page) return; m_isAttached = shouldOpenAttached(); m_attachmentSide = static_cast<AttachmentSide>(inspectorPageGroup()->preferences()->inspectorAttachmentSide()); WebPageProxy* inspectorPage = platformCreateInspectorPage(); ASSERT(inspectorPage); if (!inspectorPage) return; inspectorPageID = inspectorPage->pageID(); inspectorPageParameters = inspectorPage->creationParameters(); WKPagePolicyClientV1 policyClient = { { 1, this }, 0, /* decidePolicyForNavigationAction_deprecatedForUseWithV0 */ 0, /* decidePolicyForNewWindowAction */ 0, /* decidePolicyForResponse_deprecatedForUseWithV0 */ 0, /* unableToImplementPolicy */ decidePolicyForNavigationAction, 0, /* decidePolicyForResponse */ }; WKPageSetPagePolicyClient(toAPI(inspectorPage), &policyClient.base); String url = inspectorPageURL(); url.append("?dockSide="); if (m_isAttached) { switch (m_attachmentSide) { case AttachmentSideBottom: url.append("bottom"); m_page->process().send(Messages::WebInspector::AttachedBottom(), m_page->pageID()); break; case AttachmentSideRight: url.append("right"); m_page->process().send(Messages::WebInspector::AttachedRight(), m_page->pageID()); break; } } else url.append("undocked"); m_page->process().assumeReadAccessToBaseURL(inspectorBaseURL()); inspectorPage->loadRequest(URL(URL(), url)); m_createdInspectorPage = true; }
void WebInspectorProxy::attach() { if (!canAttach()) return; m_isAttached = true; if (m_isVisible) inspectorPageGroup()->preferences()->setInspectorStartsAttached(true); platformAttach(); }
void WebInspectorProxy::detach() { if (!m_page) return; m_isAttached = false; if (m_isVisible) inspectorPageGroup()->preferences()->setInspectorStartsAttached(false); m_page->process().send(Messages::WebInspector::Detached(), m_page->pageID()); platformDetach(); }
bool WebInspectorProxy::canAttach() { // Keep this in sync with InspectorFrontendClientLocal::canAttachWindow. There are two implementations // to make life easier in the multi-process world we have. WebInspectorProxy uses canAttach to decide if // we can attach on open (on the UI process side). And InspectorFrontendClientLocal::canAttachWindow is // used to decide if we can attach when the attach button is pressed (on the WebProcess side). // Don't allow the attach if the window would be too small to accommodate the minimum inspector height. // Also don't allow attaching to another inspector -- two inspectors in one window is too much! bool isInspectorPage = m_page->pageGroup() == inspectorPageGroup(); unsigned inspectedPageHeight = platformInspectedWindowHeight(); unsigned maximumAttachedHeight = inspectedPageHeight * 3 / 4; return minimumAttachedHeight <= maximumAttachedHeight && !isInspectorPage; }
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0); if (!m_inspectorWindow) return 0; m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup())); ewk_view_theme_set(m_inspectorView, TEST_THEME_DIR"/default.edj"); Ewk_Settings* settings = ewk_view_settings_get(m_inspectorView); ewk_settings_file_access_from_file_urls_allowed_set(settings, true); return ewk_view_page_get(m_inspectorView); }
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); ASSERT(!m_inspectorView); m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(&inspectorContext(), nullptr, inspectorPageGroup(), nullptr, nullptr)); g_object_add_weak_pointer(G_OBJECT(m_inspectorView), reinterpret_cast<void**>(&m_inspectorView)); return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView)); }
bool WebInspectorProxy::shouldOpenAttached() { return inspectorPageGroup()->preferences()->inspectorStartsAttached() && canAttach(); }
void WebInspectorProxy::setAttachedWindowWidth(unsigned width) { inspectorPageGroup()->preferences()->setInspectorAttachedWidth(width); platformSetAttachedWindowWidth(width); }
void WebInspectorProxy::setAttachedWindowHeight(unsigned height) { inspectorPageGroup()->preferences()->setInspectorAttachedHeight(height); platformSetAttachedWindowHeight(height); }
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); ASSERT(!m_inspectorView); m_inspectorView = GTK_WIDGET(webkitWebViewBaseCreate(page()->process()->context(), inspectorPageGroup())); return webkitWebViewBaseGetPage(WEBKIT_WEB_VIEW_BASE(m_inspectorView)); }
WebPageProxy* WebInspectorProxy::platformCreateInspectorPage() { ASSERT(m_page); #if USE(ACCELERATED_COMPOSITING) && defined HAVE_ECORE_X const char* engine = "opengl_x11"; m_inspectorWindow = ecore_evas_new(engine, 0, 0, initialWindowWidth, initialWindowHeight, 0); #else m_inspectorWindow = ecore_evas_new(0, 0, 0, initialWindowWidth, initialWindowHeight, 0); #endif if (!m_inspectorWindow) return 0; m_inspectorView = ewk_view_base_add(ecore_evas_get(m_inspectorWindow), toAPI(page()->process()->context()), toAPI(inspectorPageGroup())); EwkViewImpl* inspectorViewImpl = EwkViewImpl::fromEvasObject(m_inspectorView); inspectorViewImpl->setThemePath(TEST_THEME_DIR "/default.edj"); Ewk_Settings* settings = inspectorViewImpl->settings(); ewk_settings_file_access_from_file_urls_allowed_set(settings, true); return inspectorViewImpl->page(); }
bool WebInspectorProxy::isInspectorPage(WebPageProxy* page) { return page->pageGroup() == inspectorPageGroup(); }