Sha256: 7a852ec53ecd6ec12c58eb248ad93b38ab945d013dbed8fce61273ff54a5e49d

Contents?: true

Size: 765 Bytes

Versions: 4

Compression:

Stored size: 765 Bytes

Contents

#include "WindowFocus.h"
#include "SocketCommand.h"
#include "WebPage.h"
#include "CommandFactory.h"
#include "WebPageManager.h"

WindowFocus::WindowFocus(WebPageManager *manager, QStringList &arguments, QObject *parent) : SocketCommand(manager, arguments, parent) {
}

void WindowFocus::start() {
  focusWindow(arguments()[0]);
}

void WindowFocus::windowNotFound() {
  emit finished(new Response(false, QString("Unable to locate window. ")));
}

void WindowFocus::success(WebPage *page) {
  page->setFocus();
  emit finished(new Response(true));
}

void WindowFocus::focusWindow(QString selector) {
  foreach(WebPage *page, manager()->pages()) {
    if (page->matchesWindowSelector(selector)) {
      success(page);
      return;
    }
  }

  windowNotFound();
}

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
capybara-webkit-0.13.2 src/WindowFocus.cpp
capybara-webkit-0.13.1 src/WindowFocus.cpp
capybara-webkit-0.13.0 src/WindowFocus.cpp
otherinbox-capybara-webkit-0.12.0.1 src/WindowFocus.cpp