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