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

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

Issue 11093080: <webview>: First stab at implementing media permission request for guests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit fix Created 8 years 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/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS); 672 source_map_.RegisterSource("tts", IDR_TTS_CUSTOM_BINDINGS_JS);
673 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); 673 source_map_.RegisterSource("ttsEngine", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS);
674 source_map_.RegisterSource("types", IDR_TYPES_CUSTOM_BINDINGS_JS); 674 source_map_.RegisterSource("types", IDR_TYPES_CUSTOM_BINDINGS_JS);
675 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS); 675 source_map_.RegisterSource("webRequest", IDR_WEB_REQUEST_CUSTOM_BINDINGS_JS);
676 source_map_.RegisterSource("webRequestInternal", 676 source_map_.RegisterSource("webRequestInternal",
677 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS); 677 IDR_WEB_REQUEST_INTERNAL_CUSTOM_BINDINGS_JS);
678 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); 678 source_map_.RegisterSource("webstore", IDR_WEBSTORE_CUSTOM_BINDINGS_JS);
679 679
680 // Platform app sources that are not API-specific.. 680 // Platform app sources that are not API-specific..
681 source_map_.RegisterSource("webview", IDR_WEB_VIEW_JS); 681 source_map_.RegisterSource("webview", IDR_WEB_VIEW_JS);
682 source_map_.RegisterSource("webview.permissionAPI",
683 IDR_WEB_VIEW_PERMISSION_API_JS);
682 source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS); 684 source_map_.RegisterSource("platformApp", IDR_PLATFORM_APP_JS);
683 source_map_.RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS); 685 source_map_.RegisterSource("injectAppTitlebar", IDR_INJECT_APP_TITLEBAR_JS);
684 } 686 }
685 687
686 void Dispatcher::PopulateLazyBindingsMap() { 688 void Dispatcher::PopulateLazyBindingsMap() {
687 lazy_bindings_map_["app"] = InstallAppBindings; 689 lazy_bindings_map_["app"] = InstallAppBindings;
688 lazy_bindings_map_["webstore"] = InstallWebstoreBindings; 690 lazy_bindings_map_["webstore"] = InstallWebstoreBindings;
689 } 691 }
690 692
691 void Dispatcher::InstallBindings(ModuleSystem* module_system, 693 void Dispatcher::InstallBindings(ModuleSystem* module_system,
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
805 } 807 }
806 } 808 }
807 809
808 // Inject custom JS into the platform app context. 810 // Inject custom JS into the platform app context.
809 if (IsWithinPlatformApp(frame)) 811 if (IsWithinPlatformApp(frame))
810 module_system->Require("platformApp"); 812 module_system->Require("platformApp");
811 813
812 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT && 814 if (context_type == Feature::BLESSED_EXTENSION_CONTEXT &&
813 extension->HasAPIPermission(APIPermission::kWebView)) { 815 extension->HasAPIPermission(APIPermission::kWebView)) {
814 module_system->Require("webview"); 816 module_system->Require("webview");
817 if (extension->HasAPIPermission(APIPermission::kWebViewPermissionAPI))
818 module_system->Require("webview.permissionAPI");
815 } 819 }
816 820
817 context->set_module_system(module_system.Pass()); 821 context->set_module_system(module_system.Pass());
818 822
819 context->DispatchOnLoadEvent( 823 context->DispatchOnLoadEvent(
820 ChromeRenderProcessObserver::is_incognito_process(), 824 ChromeRenderProcessObserver::is_incognito_process(),
821 manifest_version); 825 manifest_version);
822 826
823 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size(); 827 VLOG(1) << "Num tracked contexts: " << v8_context_set_.size();
824 } 828 }
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after
1131 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str()); 1135 std::string error_msg = base::StringPrintf(kMessage, function_name.c_str());
1132 v8::ThrowException( 1136 v8::ThrowException(
1133 v8::Exception::Error(v8::String::New(error_msg.c_str()))); 1137 v8::Exception::Error(v8::String::New(error_msg.c_str())));
1134 return false; 1138 return false;
1135 } 1139 }
1136 1140
1137 return true; 1141 return true;
1138 } 1142 }
1139 1143
1140 } // namespace extensions 1144 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698