summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/extensions/chrome_v8_extension.cc
blob: 02d287fe5178128d033a01867a16f13e187e0613 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
// Copyright (c) 2012 The Chromium 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 "chrome/renderer/extensions/chrome_v8_extension.h"

#include "base/lazy_instance.h"
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "chrome/common/extensions/extension_set.h"
#include "chrome/renderer/extensions/chrome_v8_context.h"
#include "chrome/renderer/extensions/dispatcher.h"
#include "content/public/renderer/render_view.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_api.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebFrame.h"
#include "third_party/WebKit/public/web/WebView.h"
#include "ui/base/resource/resource_bundle.h"

using blink::WebDocument;
using blink::WebFrame;
using blink::WebView;

namespace extensions {

ChromeV8Extension::ChromeV8Extension(Dispatcher* dispatcher,
                                     ChromeV8Context* context)
    : ObjectBackedNativeHandler(context),
      dispatcher_(dispatcher) {
  CHECK(dispatcher);
}

ChromeV8Extension::~ChromeV8Extension() {
}

content::RenderView* ChromeV8Extension::GetRenderView() {
  return context() ? context()->GetRenderView() : NULL;
}

const Extension* ChromeV8Extension::GetExtensionForRenderView() {
  return context() ? context()->extension() : NULL;
}

}  // namespace extensions