OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/renderer/console.h" | 5 #include "extensions/renderer/console.h" |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/debug/alias.h" | 8 #include "base/debug/alias.h" |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 content::RenderView::ForEach(&finder); | 32 content::RenderView::ForEach(&finder); |
33 return finder.found_; | 33 return finder.found_; |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
37 explicit ByContextFinder(v8::Handle<v8::Context> context) | 37 explicit ByContextFinder(v8::Handle<v8::Context> context) |
38 : context_(context), found_(NULL) {} | 38 : context_(context), found_(NULL) {} |
39 | 39 |
40 bool Visit(content::RenderView* render_view) override { | 40 bool Visit(content::RenderView* render_view) override { |
41 ExtensionHelper* helper = ExtensionHelper::Get(render_view); | 41 ExtensionHelper* helper = ExtensionHelper::Get(render_view); |
42 if (helper && | 42 if (helper) { |
43 helper->dispatcher()->script_context_set().GetByV8Context(context_)) { | 43 ScriptContext* script_context = |
44 found_ = render_view; | 44 helper->dispatcher()->script_context_set().GetByV8Context(context_); |
45 if (script_context && | |
46 content::RenderView::FromWebView( | |
47 script_context->web_frame()->view()) == render_view) { | |
not at google - send to devlin
2014/11/07 16:24:03
You should just be able to do "script_context->Get
| |
48 found_ = render_view; | |
49 } | |
45 } | 50 } |
46 return !found_; | 51 return !found_; |
47 } | 52 } |
48 | 53 |
49 v8::Handle<v8::Context> context_; | 54 v8::Handle<v8::Context> context_; |
50 content::RenderView* found_; | 55 content::RenderView* found_; |
51 | 56 |
52 DISALLOW_COPY_AND_ASSIGN(ByContextFinder); | 57 DISALLOW_COPY_AND_ASSIGN(ByContextFinder); |
53 }; | 58 }; |
54 | 59 |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
179 v8::Local<v8::Object> console_object = v8::Object::New(isolate); | 184 v8::Local<v8::Object> console_object = v8::Object::New(isolate); |
180 BindLogMethod(isolate, console_object, "debug", &Debug); | 185 BindLogMethod(isolate, console_object, "debug", &Debug); |
181 BindLogMethod(isolate, console_object, "log", &Log); | 186 BindLogMethod(isolate, console_object, "log", &Log); |
182 BindLogMethod(isolate, console_object, "warn", &Warn); | 187 BindLogMethod(isolate, console_object, "warn", &Warn); |
183 BindLogMethod(isolate, console_object, "error", &Error); | 188 BindLogMethod(isolate, console_object, "error", &Error); |
184 return handle_scope.Escape(console_object); | 189 return handle_scope.Escape(console_object); |
185 } | 190 } |
186 | 191 |
187 } // namespace console | 192 } // namespace console |
188 } // namespace extensions | 193 } // namespace extensions |
OLD | NEW |