Wire up a new method in web frame
This commit is contained in:
parent
61e775c055
commit
22a3765394
2 changed files with 15 additions and 1 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include "atom/renderer/api/atom_api_web_frame.h"
|
#include "atom/renderer/api/atom_api_web_frame.h"
|
||||||
|
|
||||||
#include "atom/common/api/event_emitter_caller.h"
|
#include "atom/common/api/event_emitter_caller.h"
|
||||||
|
#include "atom/common/native_mate_converters/blink_converter.h"
|
||||||
#include "atom/common/native_mate_converters/callback.h"
|
#include "atom/common/native_mate_converters/callback.h"
|
||||||
#include "atom/common/native_mate_converters/gfx_converter.h"
|
#include "atom/common/native_mate_converters/gfx_converter.h"
|
||||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||||
|
@ -13,6 +14,7 @@
|
||||||
#include "content/public/renderer/render_view.h"
|
#include "content/public/renderer/render_view.h"
|
||||||
#include "native_mate/dictionary.h"
|
#include "native_mate/dictionary.h"
|
||||||
#include "native_mate/object_template_builder.h"
|
#include "native_mate/object_template_builder.h"
|
||||||
|
#include "third_party/WebKit/public/web/WebCache.h"
|
||||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||||
#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
|
#include "third_party/WebKit/public/web/WebScriptExecutionCallback.h"
|
||||||
|
@ -168,6 +170,13 @@ mate::Handle<WebFrame> WebFrame::Create(v8::Isolate* isolate) {
|
||||||
return mate::CreateHandle(isolate, new WebFrame(isolate));
|
return mate::CreateHandle(isolate, new WebFrame(isolate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v8::Local<v8::Value> WebFrame::GetResourceUsage(v8::Isolate* isolate) {
|
||||||
|
blink::WebCache::ResourceTypeStats stats;
|
||||||
|
|
||||||
|
blink::WebCache::getResourceTypeStats(&stats);
|
||||||
|
return mate::Converter<blink::WebCache::ResourceTypeStats>::ToV8(isolate, stats);
|
||||||
|
}
|
||||||
|
|
||||||
// static
|
// static
|
||||||
void WebFrame::BuildPrototype(
|
void WebFrame::BuildPrototype(
|
||||||
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
|
v8::Isolate* isolate, v8::Local<v8::ObjectTemplate> prototype) {
|
||||||
|
@ -191,7 +200,8 @@ void WebFrame::BuildPrototype(
|
||||||
.SetMethod("registerURLSchemeAsPrivileged",
|
.SetMethod("registerURLSchemeAsPrivileged",
|
||||||
&WebFrame::RegisterURLSchemeAsPrivileged)
|
&WebFrame::RegisterURLSchemeAsPrivileged)
|
||||||
.SetMethod("insertText", &WebFrame::InsertText)
|
.SetMethod("insertText", &WebFrame::InsertText)
|
||||||
.SetMethod("executeJavaScript", &WebFrame::ExecuteJavaScript);
|
.SetMethod("executeJavaScript", &WebFrame::ExecuteJavaScript)
|
||||||
|
.SetMethod("getResourceUsage", &WebFrame::GetResourceUsage);
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace api
|
} // namespace api
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include "base/memory/scoped_ptr.h"
|
#include "base/memory/scoped_ptr.h"
|
||||||
#include "native_mate/handle.h"
|
#include "native_mate/handle.h"
|
||||||
#include "native_mate/wrappable.h"
|
#include "native_mate/wrappable.h"
|
||||||
|
#include "third_party/WebKit/public/web/WebCache.h"
|
||||||
|
|
||||||
namespace blink {
|
namespace blink {
|
||||||
class WebLocalFrame;
|
class WebLocalFrame;
|
||||||
|
@ -69,6 +70,9 @@ class WebFrame : public mate::Wrappable<WebFrame> {
|
||||||
// Excecuting scripts.
|
// Excecuting scripts.
|
||||||
void ExecuteJavaScript(const base::string16& code, mate::Arguments* args);
|
void ExecuteJavaScript(const base::string16& code, mate::Arguments* args);
|
||||||
|
|
||||||
|
// Resource related methods
|
||||||
|
v8::Local<v8::Value> GetResourceUsage(v8::Isolate* isolate);
|
||||||
|
|
||||||
scoped_ptr<SpellCheckClient> spell_check_client_;
|
scoped_ptr<SpellCheckClient> spell_check_client_;
|
||||||
|
|
||||||
blink::WebLocalFrame* web_frame_;
|
blink::WebLocalFrame* web_frame_;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue