electron/atom/renderer/api/atom_api_web_frame.h

84 lines
2.3 KiB
C
Raw Normal View History

// Copyright (c) 2014 GitHub, Inc.
2014-06-16 06:27:57 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
2014-10-24 10:24:12 +00:00
#ifndef ATOM_RENDERER_API_ATOM_API_WEB_FRAME_H_
#define ATOM_RENDERER_API_ATOM_API_WEB_FRAME_H_
2014-06-16 06:27:57 +00:00
2014-10-24 10:44:15 +00:00
#include <string>
2015-05-29 05:47:09 +00:00
#include "atom/renderer/guest_view_container.h"
2014-12-18 21:54:01 +00:00
#include "base/memory/scoped_ptr.h"
2014-06-16 06:27:57 +00:00
#include "native_mate/handle.h"
#include "native_mate/wrappable.h"
namespace blink {
2014-10-24 10:24:12 +00:00
class WebLocalFrame;
2014-06-16 06:27:57 +00:00
}
namespace mate {
class Arguments;
}
2014-06-16 06:27:57 +00:00
namespace atom {
namespace api {
2014-12-18 21:54:01 +00:00
class SpellCheckClient;
2016-04-25 01:17:54 +00:00
class WebFrame : public mate::Wrappable<WebFrame> {
2014-06-16 06:27:57 +00:00
public:
2014-10-24 10:24:12 +00:00
static mate::Handle<WebFrame> Create(v8::Isolate* isolate);
2014-06-16 06:27:57 +00:00
2016-04-25 01:17:54 +00:00
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::ObjectTemplate> prototype);
2014-06-16 06:27:57 +00:00
private:
2016-04-25 01:17:54 +00:00
explicit WebFrame(v8::Isolate* isolate);
~WebFrame() override;
2014-06-16 06:27:57 +00:00
2014-10-24 10:44:15 +00:00
void SetName(const std::string& name);
double SetZoomLevel(double level);
2014-06-16 06:27:57 +00:00
double GetZoomLevel() const;
double SetZoomFactor(double factor);
double GetZoomFactor() const;
2014-06-16 06:27:57 +00:00
2015-08-27 14:08:25 +00:00
void SetZoomLevelLimits(double min_level, double max_level);
2015-05-22 11:11:22 +00:00
v8::Local<v8::Value> RegisterEmbedderCustomElement(
const base::string16& name, v8::Local<v8::Object> options);
2015-05-29 05:47:09 +00:00
void RegisterElementResizeCallback(
int element_instance_id,
const GuestViewContainer::ResizeCallback& callback);
2014-12-08 16:05:34 +00:00
void AttachGuest(int element_instance_id);
2014-10-22 13:01:12 +00:00
2014-12-18 21:54:01 +00:00
// Set the provider that will be used by SpellCheckClient for spell check.
void SetSpellCheckProvider(mate::Arguments* args,
const std::string& language,
bool auto_spell_correct_turned_on,
2015-05-22 11:11:22 +00:00
v8::Local<v8::Object> provider);
2014-12-18 21:54:01 +00:00
void RegisterURLSchemeAsSecure(const std::string& scheme);
2015-11-13 08:03:40 +00:00
void RegisterURLSchemeAsBypassingCSP(const std::string& scheme);
void RegisterURLSchemeAsPrivileged(const std::string& scheme);
2016-01-13 03:21:16 +00:00
// Editing.
void InsertText(const std::string& text);
2016-01-13 04:11:46 +00:00
// Excecuting scripts.
void ExecuteJavaScript(const base::string16& code, mate::Arguments* args);
2016-01-13 04:11:46 +00:00
2014-12-18 21:54:01 +00:00
scoped_ptr<SpellCheckClient> spell_check_client_;
2014-10-24 10:24:12 +00:00
blink::WebLocalFrame* web_frame_;
2014-06-16 06:27:57 +00:00
2014-10-24 10:24:12 +00:00
DISALLOW_COPY_AND_ASSIGN(WebFrame);
2014-06-16 06:27:57 +00:00
};
} // namespace api
} // namespace atom
2014-10-24 10:24:12 +00:00
#endif // ATOM_RENDERER_API_ATOM_API_WEB_FRAME_H_