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

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

Issue 16174005: Implement externally_connectable! Web pages can now communicate directly with (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: absolute path... Created 7 years, 6 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) 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/dispatcher.h" 5 #include "chrome/renderer/extensions/dispatcher.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after
988 988
989 // chrome.Event is part of the public API (although undocumented). Make it 989 // chrome.Event is part of the public API (although undocumented). Make it
990 // lazily evalulate to Event from event_bindings.js. 990 // lazily evalulate to Event from event_bindings.js.
991 module_system->SetLazyField(chrome, "Event", kEventModule, "Event"); 991 module_system->SetLazyField(chrome, "Event", kEventModule, "Event");
992 992
993 // Loading JavaScript is expensive, so only run the full API bindings 993 // Loading JavaScript is expensive, so only run the full API bindings
994 // generation mechanisms in extension pages (NOT all web pages). 994 // generation mechanisms in extension pages (NOT all web pages).
995 switch (context_type) { 995 switch (context_type) {
996 case Feature::UNSPECIFIED_CONTEXT: 996 case Feature::UNSPECIFIED_CONTEXT:
997 case Feature::WEB_PAGE_CONTEXT: 997 case Feature::WEB_PAGE_CONTEXT:
998 // TODO(kalman): see comment below about ExtensionAPI. 998 RegisterBinding("app", context);
999 InstallBindings(module_system, v8_context, "app"); 999 RegisterBinding("runtime", context); // for connect() and sendMessage()
1000 InstallBindings(module_system, v8_context, "webstore"); 1000 RegisterBinding("webstore", context);
1001 break; 1001 break;
1002 case Feature::BLESSED_EXTENSION_CONTEXT: 1002 case Feature::BLESSED_EXTENSION_CONTEXT:
1003 case Feature::UNBLESSED_EXTENSION_CONTEXT: 1003 case Feature::UNBLESSED_EXTENSION_CONTEXT:
1004 case Feature::CONTENT_SCRIPT_CONTEXT: 1004 case Feature::CONTENT_SCRIPT_CONTEXT:
1005 // TODO(kalman): move this code back out of the switch and execute it 1005 // TODO(kalman): move this code back out of the switch and execute it
1006 // regardless of |context_type|. ExtensionAPI knows how to return the 1006 // regardless of |context_type|. ExtensionAPI knows how to return the
1007 // correct APIs, however, until it doesn't have a 2MB overhead we can't 1007 // correct APIs, however, until it doesn't have a 2MB overhead we can't
1008 // load it in every process. 1008 // load it in every process.
1009 AddOrRemoveBindings(context); 1009 AddOrRemoveBindings(context);
1010 break; 1010 break;
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
1433 RenderView* background_view = 1433 RenderView* background_view =
1434 ExtensionHelper::GetBackgroundPage(extension_id); 1434 ExtensionHelper::GetBackgroundPage(extension_id);
1435 if (background_view) { 1435 if (background_view) {
1436 background_view->Send(new ExtensionHostMsg_EventAck( 1436 background_view->Send(new ExtensionHostMsg_EventAck(
1437 background_view->GetRoutingID())); 1437 background_view->GetRoutingID()));
1438 } 1438 }
1439 } 1439 }
1440 } 1440 }
1441 1441
1442 } // namespace extensions 1442 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698