mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-09 08:05:53 +01:00
d8caf27e3b
- Add CefDOMNode::IsEditable method. - List interfaces alphabetically in CefClient. - Correct error checking for code and command input. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@680 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
// Copyright (c) 2012 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.
|
|
|
|
#include "cefclient/client_renderer.h"
|
|
|
|
#include <sstream>
|
|
#include <string>
|
|
|
|
#include "include/cef_dom.h"
|
|
#include "cefclient/util.h"
|
|
|
|
namespace client_renderer {
|
|
|
|
const char kFocusedNodeChangedMessage[] = "ClientRenderer.FocusedNodeChanged";
|
|
|
|
namespace {
|
|
|
|
class ClientRenderDelegate : public ClientApp::RenderDelegate {
|
|
public:
|
|
ClientRenderDelegate()
|
|
: last_node_is_editable_(false) {
|
|
}
|
|
|
|
virtual void OnFocusedNodeChanged(CefRefPtr<ClientApp> app,
|
|
CefRefPtr<CefBrowser> browser,
|
|
CefRefPtr<CefFrame> frame,
|
|
CefRefPtr<CefDOMNode> node) OVERRIDE {
|
|
bool is_editable = (node.get() && node->IsEditable());
|
|
if (is_editable != last_node_is_editable_) {
|
|
// Notify the browser of the change in focused element type.
|
|
last_node_is_editable_ = is_editable;
|
|
CefRefPtr<CefProcessMessage> message =
|
|
CefProcessMessage::Create(kFocusedNodeChangedMessage);
|
|
message->GetArgumentList()->SetBool(0, is_editable);
|
|
browser->SendProcessMessage(PID_BROWSER, message);
|
|
}
|
|
}
|
|
|
|
private:
|
|
bool last_node_is_editable_;
|
|
|
|
IMPLEMENT_REFCOUNTING(ClientRenderDelegate);
|
|
};
|
|
|
|
} // namespace
|
|
|
|
void CreateRenderDelegates(ClientApp::RenderDelegateSet& delegates) {
|
|
delegates.insert(new ClientRenderDelegate);
|
|
}
|
|
|
|
} // namespace client_renderer
|