OLD | NEW |
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/extension_process_bindings.h" | 5 #include "chrome/renderer/extensions/extension_process_bindings.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 DCHECK(args[1]->IsString()); | 321 DCHECK(args[1]->IsString()); |
322 std::string name(*v8::String::Utf8Value(args[0])); | 322 std::string name(*v8::String::Utf8Value(args[0])); |
323 std::string path(*v8::String::Utf8Value(args[1])); | 323 std::string path(*v8::String::Utf8Value(args[1])); |
324 | 324 |
325 WebFrame* webframe = WebFrame::frameForCurrentContext(); | 325 WebFrame* webframe = WebFrame::frameForCurrentContext(); |
326 #ifdef WEB_FILE_SYSTEM_TYPE_EXTERNAL | 326 #ifdef WEB_FILE_SYSTEM_TYPE_EXTERNAL |
327 return webframe->createFileSystem(WebKit::WebFileSystem::TypeExternal, | 327 return webframe->createFileSystem(WebKit::WebFileSystem::TypeExternal, |
328 WebKit::WebString::fromUTF8(name.c_str()), | 328 WebKit::WebString::fromUTF8(name.c_str()), |
329 WebKit::WebString::fromUTF8(path.c_str())); | 329 WebKit::WebString::fromUTF8(path.c_str())); |
330 #else | 330 #else |
331 return webframe->createFileSystem(fileapi::kFileSystemTypeLocal, | 331 return webframe->createFileSystem(fileapi::kFileSystemTypeExternal, |
332 WebKit::WebString::fromUTF8(name.c_str()), | 332 WebKit::WebString::fromUTF8(name.c_str()), |
333 WebKit::WebString::fromUTF8(path.c_str())); | 333 WebKit::WebString::fromUTF8(path.c_str())); |
334 #endif | 334 #endif |
335 } | 335 } |
336 | 336 |
337 // Creates a new messaging channel to the tab with the given ID. | 337 // Creates a new messaging channel to the tab with the given ID. |
338 static v8::Handle<v8::Value> OpenChannelToTab(const v8::Arguments& args) { | 338 static v8::Handle<v8::Value> OpenChannelToTab(const v8::Arguments& args) { |
339 // Get the current RenderView so that we can send a routed IPC message from | 339 // Get the current RenderView so that we can send a routed IPC message from |
340 // the correct source. | 340 // the correct source. |
341 RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); | 341 RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
677 ExtensionProcessBindings::ThrowPermissionDeniedException( | 677 ExtensionProcessBindings::ThrowPermissionDeniedException( |
678 const std::string& function_name) { | 678 const std::string& function_name) { |
679 static const char kMessage[] = | 679 static const char kMessage[] = |
680 "You do not have permission to use '%s'. Be sure to declare" | 680 "You do not have permission to use '%s'. Be sure to declare" |
681 " in your manifest what permissions you need."; | 681 " in your manifest what permissions you need."; |
682 std::string error_msg = StringPrintf(kMessage, function_name.c_str()); | 682 std::string error_msg = StringPrintf(kMessage, function_name.c_str()); |
683 | 683 |
684 return v8::ThrowException(v8::Exception::Error( | 684 return v8::ThrowException(v8::Exception::Error( |
685 v8::String::New(error_msg.c_str()))); | 685 v8::String::New(error_msg.c_str()))); |
686 } | 686 } |
OLD | NEW |