Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(574)

Side by Side Diff: extensions/renderer/console.cc

Issue 678393002: Send extension console messages to the right WebFrame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add the missing copyright notice. Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 && script_context->GetRenderView() == render_view)
46 found_ = render_view;
45 } 47 }
46 return !found_; 48 return !found_;
47 } 49 }
48 50
49 v8::Handle<v8::Context> context_; 51 v8::Handle<v8::Context> context_;
50 content::RenderView* found_; 52 content::RenderView* found_;
51 53
52 DISALLOW_COPY_AND_ASSIGN(ByContextFinder); 54 DISALLOW_COPY_AND_ASSIGN(ByContextFinder);
53 }; 55 };
54 56
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 v8::Local<v8::Object> console_object = v8::Object::New(isolate); 180 v8::Local<v8::Object> console_object = v8::Object::New(isolate);
179 BindLogMethod(isolate, console_object, "debug", &Debug); 181 BindLogMethod(isolate, console_object, "debug", &Debug);
180 BindLogMethod(isolate, console_object, "log", &Log); 182 BindLogMethod(isolate, console_object, "log", &Log);
181 BindLogMethod(isolate, console_object, "warn", &Warn); 183 BindLogMethod(isolate, console_object, "warn", &Warn);
182 BindLogMethod(isolate, console_object, "error", &Error); 184 BindLogMethod(isolate, console_object, "error", &Error);
183 return handle_scope.Escape(console_object); 185 return handle_scope.Escape(console_object);
184 } 186 }
185 187
186 } // namespace console 188 } // namespace console
187 } // namespace extensions 189 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/test/data/extensions/api_test/uncaught_exception_logging/test.js ('k') | extensions/renderer/console_apitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698