#include "base/command_line.h"
#include "chrome/common/chrome_switches.h"
-#include "chrome/renderer/extensions/chrome_v8_context.h"
-#include "chrome/renderer/extensions/dispatcher.h"
-#include "chrome/renderer/extensions/scoped_persistent.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "content/public/renderer/render_view_observer.h"
#include "content/public/renderer/render_view_visitor.h"
#include "content/public/renderer/v8_value_converter.h"
#include "extensions/common/extension_messages.h"
+#include "extensions/renderer/dispatcher.h"
+#include "extensions/renderer/scoped_persistent.h"
+#include "extensions/renderer/script_context.h"
+#include "extensions/renderer/script_context_set.h"
#include "grit/renderer_resources.h"
-#include "third_party/WebKit/public/web/WebFrame.h"
+#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "ui/base/resource/resource_bundle.h"
#include "v8/include/v8.h"
class DidCreateDocumentElementObserver : public content::RenderViewObserver {
public:
- DidCreateDocumentElementObserver(
- content::RenderView* view, Dispatcher* dispatcher)
- : content::RenderViewObserver(view), dispatcher_(dispatcher) {
- }
+ DidCreateDocumentElementObserver(content::RenderView* view,
+ Dispatcher* dispatcher)
+ : content::RenderViewObserver(view), dispatcher_(dispatcher) {}
- virtual void DidCreateDocumentElement(blink::WebFrame* frame) OVERRIDE {
+ virtual void DidCreateDocumentElement(blink::WebLocalFrame* frame) OVERRIDE {
DCHECK(frame);
DCHECK(dispatcher_);
// Don't attempt to inject the titlebar into iframes.
if (frame->parent())
return;
v8::HandleScope handle_scope(v8::Isolate::GetCurrent());
- ChromeV8Context* v8_context =
- dispatcher_->v8_context_set().GetByV8Context(
+ ScriptContext* script_context =
+ dispatcher_->script_context_set().GetByV8Context(
frame->mainWorldScriptContext());
- if (!v8_context)
+ if (!script_context)
return;
- v8::Context::Scope context_scope(v8_context->v8_context());
- v8_context->module_system()->CallModuleMethod(
+ v8::Context::Scope context_scope(script_context->v8_context());
+ script_context->module_system()->CallModuleMethod(
"injectAppTitlebar", "didCreateDocumentElement");
}
Dispatcher* dispatcher_;
};
-AppWindowCustomBindings::AppWindowCustomBindings(
- Dispatcher* dispatcher,
- ChromeV8Context* context) : ChromeV8Extension(dispatcher, context) {
+AppWindowCustomBindings::AppWindowCustomBindings(Dispatcher* dispatcher,
+ ScriptContext* context)
+ : ObjectBackedNativeHandler(context), dispatcher_(dispatcher) {
RouteFunction("GetView",
base::Bind(&AppWindowCustomBindings::GetView,
base::Unretained(this)));
return;
if (inject_titlebar)
- new DidCreateDocumentElementObserver(view, dispatcher());
+ new DidCreateDocumentElementObserver(view, dispatcher_);
// TODO(jeremya): it doesn't really make sense to set the opener here, but we
// need to make sure the security origin is set up before returning the DOM
// reference. A better way to do this would be to have the browser pass the
// opener through so opener_id is set in RenderViewImpl's constructor.
- content::RenderView* render_view = GetRenderView();
+ content::RenderView* render_view = context()->GetRenderView();
if (!render_view)
return;
blink::WebFrame* opener = render_view->GetWebView()->mainFrame();