mirror of
https://github.com/atom/atom.git
synced 2026-01-24 14:28:14 -05:00
90 lines
3.0 KiB
C++
90 lines
3.0 KiB
C++
// Copyright (c) 2011 The Chromium Embedded Framework Authors. All rights
|
|
// reserved. Use of this source code is governed by a BSD-style license that
|
|
// can be found in the LICENSE file.
|
|
|
|
#ifndef CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_
|
|
#define CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_
|
|
#pragma once
|
|
|
|
#include <set>
|
|
#include <string>
|
|
#include "include/cef_client.h"
|
|
#include "atom/util.h"
|
|
|
|
|
|
// ClientHandler implementation.
|
|
class ClientHandler : public CefClient,
|
|
public CefContextMenuHandler,
|
|
public CefDisplayHandler,
|
|
public CefKeyboardHandler,
|
|
public CefLifeSpanHandler,
|
|
public CefLoadHandler,
|
|
public CefRequestHandler {
|
|
public:
|
|
ClientHandler();
|
|
virtual ~ClientHandler();
|
|
|
|
|
|
CefRefPtr<CefBrowser> GetBrowser() { return m_Browser; }
|
|
|
|
virtual CefRefPtr<CefContextMenuHandler> GetContextMenuHandler() OVERRIDE {
|
|
return this;
|
|
}
|
|
virtual CefRefPtr<CefDisplayHandler> GetDisplayHandler() OVERRIDE {
|
|
return this;
|
|
}
|
|
virtual CefRefPtr<CefKeyboardHandler> GetKeyboardHandler() OVERRIDE {
|
|
return this;
|
|
}
|
|
virtual CefRefPtr<CefLifeSpanHandler> GetLifeSpanHandler() OVERRIDE {
|
|
return this;
|
|
}
|
|
virtual CefRefPtr<CefLoadHandler> GetLoadHandler() OVERRIDE {
|
|
return this;
|
|
}
|
|
virtual CefRefPtr<CefRequestHandler> GetRequestHandler() OVERRIDE {
|
|
return this;
|
|
}
|
|
|
|
// CefContextMenuHandler methods
|
|
virtual void OnBeforeContextMenu(CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> frame,
|
|
CefRefPtr<CefContextMenuParams> params,
|
|
CefRefPtr<CefMenuModel> model) OVERRIDE;
|
|
|
|
virtual bool OnContextMenuCommand(CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> frame,
|
|
CefRefPtr<CefContextMenuParams> params,
|
|
int command_id,
|
|
EventFlags event_flags) OVERRIDE;
|
|
|
|
// CefDisplayHandler methods
|
|
virtual bool OnConsoleMessage(CefRefPtr<CefBrowser> browser,
|
|
const CefString& message,
|
|
const CefString& source,
|
|
int line) OVERRIDE;
|
|
|
|
|
|
// CefLifeSpanHandler methods
|
|
virtual void OnBeforeClose(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
|
|
|
// CefLoadHandler methods
|
|
virtual void OnAfterCreated(CefRefPtr<CefBrowser> browser) OVERRIDE;
|
|
|
|
virtual void OnLoadError(CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> frame,
|
|
ErrorCode errorCode,
|
|
const CefString& errorText,
|
|
const CefString& failedUrl) OVERRIDE;
|
|
|
|
protected:
|
|
CefRefPtr<CefBrowser> m_Browser;
|
|
|
|
void ShowDevTools(CefRefPtr<CefBrowser> browser);
|
|
|
|
IMPLEMENT_REFCOUNTING(ClientHandler);
|
|
IMPLEMENT_LOCKING(ClientHandler);
|
|
};
|
|
|
|
#endif // CEF_TESTS_CEFCLIENT_CLIENT_HANDLER_H_
|