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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 // Attach an event name to an object. | 308 // Attach an event name to an object. |
309 static v8::Handle<v8::Value> GetLocalFileSystem( | 309 static v8::Handle<v8::Value> GetLocalFileSystem( |
310 const v8::Arguments& args) { | 310 const v8::Arguments& args) { |
311 DCHECK(args.Length() == 2); | 311 DCHECK(args.Length() == 2); |
312 DCHECK(args[0]->IsString()); | 312 DCHECK(args[0]->IsString()); |
313 DCHECK(args[1]->IsString()); | 313 DCHECK(args[1]->IsString()); |
314 std::string name(*v8::String::Utf8Value(args[0])); | 314 std::string name(*v8::String::Utf8Value(args[0])); |
315 std::string path(*v8::String::Utf8Value(args[1])); | 315 std::string path(*v8::String::Utf8Value(args[1])); |
316 | 316 |
317 WebFrame* webframe = WebFrame::frameForCurrentContext(); | 317 WebFrame* webframe = WebFrame::frameForCurrentContext(); |
| 318 #ifdef WEB_FILE_SYSTEM_TYPE_EXTERNAL |
| 319 return webframe->createFileSystem(WebKit::WebFileSystem::TypeExternal, |
| 320 WebKit::WebString::fromUTF8(name.c_str()), |
| 321 WebKit::WebString::fromUTF8(path.c_str())); |
| 322 #else |
318 return webframe->createFileSystem(fileapi::kFileSystemTypeLocal, | 323 return webframe->createFileSystem(fileapi::kFileSystemTypeLocal, |
319 WebKit::WebString::fromUTF8(name.c_str()), | 324 WebKit::WebString::fromUTF8(name.c_str()), |
320 WebKit::WebString::fromUTF8(path.c_str())); | 325 WebKit::WebString::fromUTF8(path.c_str())); |
| 326 #endif |
321 } | 327 } |
322 | 328 |
323 // Creates a new messaging channel to the tab with the given ID. | 329 // Creates a new messaging channel to the tab with the given ID. |
324 static v8::Handle<v8::Value> OpenChannelToTab(const v8::Arguments& args) { | 330 static v8::Handle<v8::Value> OpenChannelToTab(const v8::Arguments& args) { |
325 // Get the current RenderView so that we can send a routed IPC message from | 331 // Get the current RenderView so that we can send a routed IPC message from |
326 // the correct source. | 332 // the correct source. |
327 RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); | 333 RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); |
328 if (!renderview) | 334 if (!renderview) |
329 return v8::Undefined(); | 335 return v8::Undefined(); |
330 | 336 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 ExtensionProcessBindings::ThrowPermissionDeniedException( | 664 ExtensionProcessBindings::ThrowPermissionDeniedException( |
659 const std::string& function_name) { | 665 const std::string& function_name) { |
660 static const char kMessage[] = | 666 static const char kMessage[] = |
661 "You do not have permission to use '%s'. Be sure to declare" | 667 "You do not have permission to use '%s'. Be sure to declare" |
662 " in your manifest what permissions you need."; | 668 " in your manifest what permissions you need."; |
663 std::string error_msg = StringPrintf(kMessage, function_name.c_str()); | 669 std::string error_msg = StringPrintf(kMessage, function_name.c_str()); |
664 | 670 |
665 return v8::ThrowException(v8::Exception::Error( | 671 return v8::ThrowException(v8::Exception::Error( |
666 v8::String::New(error_msg.c_str()))); | 672 v8::String::New(error_msg.c_str()))); |
667 } | 673 } |
OLD | NEW |