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

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

Issue 234413005: Move most of ChromeV8Context to a base ScriptContext (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: factor feature_channel out of module_system Created 6 years, 8 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/file_system_natives.h" 5 #include "chrome/renderer/extensions/file_system_natives.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "chrome/renderer/extensions/chrome_v8_context.h" 12 #include "chrome/renderer/extensions/chrome_v8_context.h"
13 #include "chrome/renderer/extensions/user_script_slave.h" 13 #include "chrome/renderer/extensions/user_script_slave.h"
14 #include "extensions/common/constants.h" 14 #include "extensions/common/constants.h"
15 #include "extensions/renderer/script_context.h"
15 #include "grit/renderer_resources.h" 16 #include "grit/renderer_resources.h"
16 #include "third_party/WebKit/public/platform/WebString.h" 17 #include "third_party/WebKit/public/platform/WebString.h"
17 #include "third_party/WebKit/public/web/WebDOMError.h" 18 #include "third_party/WebKit/public/web/WebDOMError.h"
18 #include "third_party/WebKit/public/web/WebDOMFileSystem.h" 19 #include "third_party/WebKit/public/web/WebDOMFileSystem.h"
19 #include "third_party/WebKit/public/web/WebLocalFrame.h" 20 #include "third_party/WebKit/public/web/WebLocalFrame.h"
20 #include "webkit/common/fileapi/file_system_types.h" 21 #include "webkit/common/fileapi/file_system_types.h"
21 #include "webkit/common/fileapi/file_system_util.h" 22 #include "webkit/common/fileapi/file_system_util.h"
22 23
23 namespace extensions { 24 namespace extensions {
24 25
(...skipping 15 matching lines...) Expand all
40 void FileSystemNatives::GetIsolatedFileSystem( 41 void FileSystemNatives::GetIsolatedFileSystem(
41 const v8::FunctionCallbackInfo<v8::Value>& args) { 42 const v8::FunctionCallbackInfo<v8::Value>& args) {
42 DCHECK(args.Length() == 1 || args.Length() == 2); 43 DCHECK(args.Length() == 1 || args.Length() == 2);
43 DCHECK(args[0]->IsString()); 44 DCHECK(args[0]->IsString());
44 std::string file_system_id(*v8::String::Utf8Value(args[0])); 45 std::string file_system_id(*v8::String::Utf8Value(args[0]));
45 blink::WebLocalFrame* webframe = 46 blink::WebLocalFrame* webframe =
46 blink::WebLocalFrame::frameForContext(context()->v8_context()); 47 blink::WebLocalFrame::frameForContext(context()->v8_context());
47 DCHECK(webframe); 48 DCHECK(webframe);
48 49
49 GURL context_url = 50 GURL context_url =
50 extensions::UserScriptSlave::GetDataSourceURLForFrame(webframe); 51 extensions::ScriptContext::GetDataSourceURLForFrame(webframe);
51 CHECK(context_url.SchemeIs(extensions::kExtensionScheme)); 52 CHECK(context_url.SchemeIs(extensions::kExtensionScheme));
52 53
53 std::string name(fileapi::GetIsolatedFileSystemName(context_url.GetOrigin(), 54 std::string name(fileapi::GetIsolatedFileSystemName(context_url.GetOrigin(),
54 file_system_id)); 55 file_system_id));
55 56
56 // The optional second argument is the subfolder within the isolated file 57 // The optional second argument is the subfolder within the isolated file
57 // system at which to root the DOMFileSystem we're returning to the caller. 58 // system at which to root the DOMFileSystem we're returning to the caller.
58 std::string optional_root_name; 59 std::string optional_root_name;
59 if (args.Length() == 2) { 60 if (args.Length() == 2) {
60 DCHECK(args[1]->IsString()); 61 DCHECK(args[1]->IsString());
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 std::string message(*v8::String::Utf8Value(args[1])); 151 std::string message(*v8::String::Utf8Value(args[1]));
151 // message is optional hence empty is fine. 152 // message is optional hence empty is fine.
152 153
153 blink::WebDOMError dom_error = blink::WebDOMError::create( 154 blink::WebDOMError dom_error = blink::WebDOMError::create(
154 blink::WebString::fromUTF8(name), 155 blink::WebString::fromUTF8(name),
155 blink::WebString::fromUTF8(message)); 156 blink::WebString::fromUTF8(message));
156 args.GetReturnValue().Set(dom_error.toV8Value()); 157 args.GetReturnValue().Set(dom_error.toV8Value());
157 } 158 }
158 159
159 } // namespace extensions 160 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/file_system_natives.h ('k') | chrome/renderer/extensions/logging_native_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698