Exemple #1
0
void Application::OnContextCreated( CefRefPtr<CefBrowser> browser, CefRefPtr<CefFrame> frame, CefRefPtr<CefV8Context> context )
{
    HL_DEBUG(logger, "create native JS bridge object");
    CefRefPtr<CefV8Value> global = context->GetGlobal();
    _exposedJSObject = CefV8Value::CreateObject(NULL);
    CefRefPtr<CefV8Value> exec = CefV8Value::CreateFunction("exec", this);
    _exposedJSObject->SetValue("exec", exec, V8_PROPERTY_ATTRIBUTE_READONLY);
    global->SetValue("_cordovaNative", _exposedJSObject, V8_PROPERTY_ATTRIBUTE_READONLY);
}
Exemple #2
0
void Client::showDevTools( CefRefPtr<CefBrowser> browser )
{
  std::stringstream ss;
  ss << "showDevTools, id=" << browser->GetIdentifier();
  HL_DEBUG(logger, ss.str());
  CefWindowInfo windowInfo;
  CefBrowserSettings settings;

#if defined(OS_WIN)
  windowInfo.SetAsPopup(browser->GetHost()->GetWindowHandle(), "DevTools");
#endif

  browser->GetHost()->ShowDevTools(windowInfo, this, settings, CefPoint());
}
void ControlToMasterConnectionHandler::Private::onNewIncomingRequest(QCorFrameRefPtr frame)
{
  HL_DEBUG(HL, "New request");
}
Exemple #4
0
void Application::createBrowser()
{
    std::string startup_document = _config->startDocument();

    // test if absolute url with http or https
    if(Helper::StringUtils::starts_with(startup_document, "http://") || Helper::StringUtils::starts_with(startup_document, "https://"))
    {
        _startupUrl = startup_document;
    }
    else
    {
        Helper::Path www_dir = _pathManager->getApplicationDir() + "www";
        std::string www_dir_str = www_dir.filePath();
        if(!Helper::StringUtils::starts_with(www_dir_str, "/"))
            www_dir_str = "/" + www_dir_str;
        _startupUrl = "file://" + www_dir_str + "/" + startup_document;
    }




    CefWindowInfo info;
    bool transparent = true;

    //bool offscreenrendering = false;
    //config()->getBoolPreference("OffScreenRendering", offscreenrendering);

    /*
    if(offscreenrendering)
    {
      CefRefPtr<Client::RenderHandler> osr_window = createOSRWindow(_mainWindow, _client.get(), transparent);
      _client->setOSRHandler(osr_window);
      // old
      //info.SetTransparentPainting(transparent ? true : false);
      //info.SetAsOffScreen(osr_window->handle());
      info.SetAsWindowless(osr_window->handle(), transparent);
    }
    else*/
    {
        RECT rect;
        GetClientRect(_mainWindow, &rect);
        info.SetAsChild(_mainWindow, rect);
    }

    /*
    RECT r;
    r.left = 0; r.top = 0; r.right = 700; r.bottom = 500;
    info.SetAsChild(_mainWindow, r);
    */

    //TODO: move the settings into config.xml
    CefBrowserSettings browserSettings;

    //browserSettings.developer_tools = STATE_ENABLED;
    browserSettings.file_access_from_file_urls = STATE_ENABLED;
    browserSettings.universal_access_from_file_urls = STATE_ENABLED;
    browserSettings.web_security = STATE_DISABLED;
    browserSettings.application_cache = STATE_ENABLED;
    browserSettings.local_storage = STATE_ENABLED;
    //browserSettings.accelerated_compositing = STATE_ENABLED; ??

    // init plugin manager (also create the plugins with onload=true)
    _pluginManager->init();

    // Create the browser asynchronously and load the startup url
    HL_DEBUG(logger, "create browser with startup url: '" + _startupUrl + "'");
    CefBrowserHost::CreateBrowser(info, _client.get(), _startupUrl, browserSettings, NULL);
}
Exemple #5
0
/* TODO : Celui qui appelle suprime des element pour rien ... Enfin c'est pas très grave... 
 * Il suffirait juste de suprimer celui d'avant si il n'est pas terminer...
 */
void appl::Highlight::parse(int64_t _start,
                            int64_t _stop,
                            std::vector<appl::HighlightInfo> & _metaData,
                            int64_t _addingPos,
                            std::string& _buffer) {
	if (0 > _addingPos) {
		_addingPos = 0;
	}
	HL_DEBUG("Parse element 0 => " << m_listHighlightPass1.size() << "  == > position search: (" << _start << "," << _stop << ")" );
	int64_t elementStart = _start;
	int64_t elementStop = _stop;
	appl::HighlightInfo resultat;
	int64_t startTime = ewol::getTime();
	while (elementStart <= elementStop) {
		//HL_DEBUG("Parse element in the buffer pos=" << elementStart);
		int64_t currentTime = ewol::getTime();
		//try to fond the HL in ALL of we have
		for (int64_t jjj=0; jjj<(int64_t)m_listHighlightPass1.size(); jjj++){
			bool ret = true;
			/*
			if (_buffer[elementStart] == '\n') {
				HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='\\n' " << m_listHighlightPass1[jjj].getPaternString());
			} else {
				HL_DEBUG("Parse HL id=" << jjj << " position search: (" << elementStart << "," << _stop << ") input start='" << _buffer[elementStart] << "' " << m_listHighlightPass1[jjj].getPaternString());
			}
			*/
			// Stop the search to the end (to get the end of the pattern)
			ret = m_listHighlightPass1[jjj].find(elementStart, _buffer.size(), resultat, _buffer);
			if (ret == true) {
				int64_t currentTimeEnd = ewol::getTime();
				int64_t deltaTime = currentTimeEnd - currentTime;
				HL_DEBUG("Find Pattern in the Buffer : time=" << (float)deltaTime/1000.0f << " ms (" << resultat.start << "," << resultat.stop << ") startPos=" << elementStart << " for=" << m_listHighlightPass1[jjj].getPaternString().first << " " << m_listHighlightPass1[jjj].getPaternString().second);
				// remove element in the current List where the current Element have a end inside the next...
				int64_t kkk=_addingPos;
				while(kkk < (int64_t)_metaData.size() ) {
					if (_metaData[kkk].start <= resultat.stop) {
						// remove element
						HL_DEBUG("Erase element=" << kkk);
						_metaData.erase(_metaData.begin()+kkk, _metaData.begin()+kkk+1);
						// Increase the end of search
						if (kkk < (int64_t)_metaData.size()) {
							// just before the end of the next element
							elementStop = _metaData[kkk].start-1;
						} else {
							// end of the buffer
							elementStop = _buffer.size();
						}
					} else {
						// Not find  == > exit the cycle : 
						break;
					}
				}
				// add curent element in the list ...
				_metaData.insert(_metaData.begin()+_addingPos, resultat);
				HL_DEBUG("INSERT at "<< _addingPos << " S=" << resultat.start << " E=" << resultat.stop );
				// update the current research starting element: (set position at the end of the current element
				elementStart = resultat.stop-1;
				// increment the position of insertion:
				_addingPos++;
				// We find a pattern  == > Stop search for the current element
				break;
			}
		}
		// Go to the next element (and search again ...).
		elementStart++;
	}
	int64_t stopTime = ewol::getTime();
	int64_t deltaTimeGlobal = stopTime - startTime;
	APPL_DEBUG("parse in time=" << (float)deltaTimeGlobal/1000.0f << " ms ");
	
	
}