Home | History | Annotate | Download | only in extensions
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/renderer/extensions/chrome_v8_extension.h"
      6 
      7 #include "base/lazy_instance.h"
      8 #include "base/logging.h"
      9 #include "base/strings/string_util.h"
     10 #include "base/strings/stringprintf.h"
     11 #include "chrome/common/extensions/api/extension_api.h"
     12 #include "chrome/common/extensions/extension.h"
     13 #include "chrome/common/extensions/extension_set.h"
     14 #include "chrome/renderer/extensions/chrome_v8_context.h"
     15 #include "chrome/renderer/extensions/dispatcher.h"
     16 #include "content/public/renderer/render_view.h"
     17 #include "third_party/WebKit/public/web/WebDocument.h"
     18 #include "third_party/WebKit/public/web/WebFrame.h"
     19 #include "third_party/WebKit/public/web/WebView.h"
     20 #include "ui/base/resource/resource_bundle.h"
     21 
     22 using WebKit::WebDocument;
     23 using WebKit::WebFrame;
     24 using WebKit::WebView;
     25 
     26 namespace extensions {
     27 
     28 ChromeV8Extension::ChromeV8Extension(Dispatcher* dispatcher,
     29                                      ChromeV8Context* context)
     30     : ObjectBackedNativeHandler(context),
     31       dispatcher_(dispatcher) {
     32   CHECK(dispatcher);
     33 }
     34 
     35 ChromeV8Extension::~ChromeV8Extension() {
     36 }
     37 
     38 content::RenderView* ChromeV8Extension::GetRenderView() {
     39   return context() ? context()->GetRenderView() : NULL;
     40 }
     41 
     42 const Extension* ChromeV8Extension::GetExtensionForRenderView() {
     43   return context() ? context()->extension() : NULL;
     44 }
     45 
     46 }  // namespace extensions
     47