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

Side by Side Diff: chrome/renderer/extensions/event_bindings.cc

Issue 6242010: Refactor away most of ExtensionRendererInfo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments Created 9 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/event_bindings.h" 5 #include "chrome/renderer/extensions/event_bindings.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 v8::Local<v8::Context> context = v8::Context::GetCurrent(); 258 v8::Local<v8::Context> context = v8::Context::GetCurrent();
259 DCHECK(!context.IsEmpty()); 259 DCHECK(!context.IsEmpty());
260 DCHECK(bindings_utils::FindContext(context) == contexts.end()); 260 DCHECK(bindings_utils::FindContext(context) == contexts.end());
261 261
262 // Figure out the frame's URL. If the frame is loading, use its provisional 262 // Figure out the frame's URL. If the frame is loading, use its provisional
263 // URL, since we get this notification before commit. 263 // URL, since we get this notification before commit.
264 WebDataSource* ds = frame->provisionalDataSource(); 264 WebDataSource* ds = frame->provisionalDataSource();
265 if (!ds) 265 if (!ds)
266 ds = frame->dataSource(); 266 ds = frame->dataSource();
267 GURL url = ds->request().url(); 267 GURL url = ds->request().url();
268 std::string extension_id = ExtensionRendererInfo::GetIdByURL(url); 268 const ExtensionRendererInfo* extensions = GetRenderThread()->GetExtensions();
269 std::string extension_id = extensions->GetIdByURL(url);
269 270
270 if (!ExtensionRendererInfo::ExtensionBindingsAllowed(url) && 271 if (!extensions->ExtensionBindingsAllowed(url) &&
271 !content_script) { 272 !content_script) {
272 // This context is a regular non-extension web page or an unprivileged 273 // This context is a regular non-extension web page or an unprivileged
273 // chrome app. Ignore it. We only care about content scripts and extension 274 // chrome app. Ignore it. We only care about content scripts and extension
274 // frames. 275 // frames.
275 // (Unless we're in unit tests, in which case we don't care what the URL 276 // (Unless we're in unit tests, in which case we don't care what the URL
276 // is). 277 // is).
277 DCHECK(frame_context.IsEmpty() || frame_context == context); 278 DCHECK(frame_context.IsEmpty() || frame_context == context);
278 if (!in_unit_tests) 279 if (!in_unit_tests)
279 return; 280 return;
280 281
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // TODO(rafaelw): Consider only doing this check if function_name == 372 // TODO(rafaelw): Consider only doing this check if function_name ==
372 // "Event.dispatchJSON". 373 // "Event.dispatchJSON".
373 #ifndef NDEBUG 374 #ifndef NDEBUG
374 if (!retval.IsEmpty() && !retval->IsUndefined()) { 375 if (!retval.IsEmpty() && !retval->IsUndefined()) {
375 std::string error = *v8::String::AsciiValue(retval); 376 std::string error = *v8::String::AsciiValue(retval);
376 DCHECK(false) << error; 377 DCHECK(false) << error;
377 } 378 }
378 #endif 379 #endif
379 } 380 }
380 } 381 }
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/chrome_app_bindings.cc ('k') | chrome/renderer/extensions/extension_process_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698