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

Side by Side Diff: content/renderer/pepper/pepper_file_system_host.cc

Issue 2928033002: Move GetDocument method from WebFrame to WebLocalFrame. (Closed)
Patch Set: Split a DCHECK in two as suggested by boliu@. Created 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "content/renderer/pepper/pepper_file_system_host.h" 5 #include "content/renderer/pepper/pepper_file_system_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "content/child/child_thread_impl.h" 9 #include "content/child/child_thread_impl.h"
10 #include "content/child/fileapi/file_system_dispatcher.h" 10 #include "content/child/fileapi/file_system_dispatcher.h"
11 #include "content/common/pepper_file_util.h" 11 #include "content/common/pepper_file_util.h"
12 #include "content/public/renderer/render_view.h" 12 #include "content/public/renderer/render_view.h"
13 #include "content/public/renderer/renderer_ppapi_host.h" 13 #include "content/public/renderer/renderer_ppapi_host.h"
14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" 14 #include "content/renderer/pepper/pepper_plugin_instance_impl.h"
15 #include "ppapi/c/pp_errors.h" 15 #include "ppapi/c/pp_errors.h"
16 #include "ppapi/host/dispatch_host_message.h" 16 #include "ppapi/host/dispatch_host_message.h"
17 #include "ppapi/host/ppapi_host.h" 17 #include "ppapi/host/ppapi_host.h"
18 #include "ppapi/proxy/ppapi_messages.h" 18 #include "ppapi/proxy/ppapi_messages.h"
19 #include "ppapi/shared_impl/file_system_util.h" 19 #include "ppapi/shared_impl/file_system_util.h"
20 #include "ppapi/shared_impl/file_type_conversion.h" 20 #include "ppapi/shared_impl/file_type_conversion.h"
21 #include "storage/common/fileapi/file_system_util.h" 21 #include "storage/common/fileapi/file_system_util.h"
22 #include "third_party/WebKit/public/web/WebDocument.h" 22 #include "third_party/WebKit/public/web/WebDocument.h"
23 #include "third_party/WebKit/public/web/WebFrame.h" 23 #include "third_party/WebKit/public/web/WebLocalFrame.h"
24 #include "third_party/WebKit/public/web/WebView.h" 24 #include "third_party/WebKit/public/web/WebView.h"
25 25
26 namespace content { 26 namespace content {
27 27
28 PepperFileSystemHost::PepperFileSystemHost(RendererPpapiHost* host, 28 PepperFileSystemHost::PepperFileSystemHost(RendererPpapiHost* host,
29 PP_Instance instance, 29 PP_Instance instance,
30 PP_Resource resource, 30 PP_Resource resource,
31 PP_FileSystemType type) 31 PP_FileSystemType type)
32 : ResourceHost(host->GetPpapiHost(), instance, resource), 32 : ResourceHost(host->GetPpapiHost(), instance, resource),
33 renderer_ppapi_host_(host), 33 renderer_ppapi_host_(host),
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 125
126 // Do a sanity check. 126 // Do a sanity check.
127 if (!storage::ValidateIsolatedFileSystemId(fsid)) 127 if (!storage::ValidateIsolatedFileSystemId(fsid))
128 return PP_ERROR_BADARGUMENT; 128 return PP_ERROR_BADARGUMENT;
129 129
130 RenderView* view = 130 RenderView* view =
131 renderer_ppapi_host_->GetRenderViewForInstance(pp_instance()); 131 renderer_ppapi_host_->GetRenderViewForInstance(pp_instance());
132 if (!view) 132 if (!view)
133 return PP_ERROR_FAILED; 133 return PP_ERROR_FAILED;
134 134
135 const GURL& url = view->GetWebView()->MainFrame()->GetDocument().Url(); 135 url::Origin main_frame_origin(
136 view->GetWebView()->MainFrame()->GetSecurityOrigin());
136 const std::string root_name = ppapi::IsolatedFileSystemTypeToRootName(type); 137 const std::string root_name = ppapi::IsolatedFileSystemTypeToRootName(type);
137 if (root_name.empty()) 138 if (root_name.empty())
138 return PP_ERROR_BADARGUMENT; 139 return PP_ERROR_BADARGUMENT;
139 root_url_ = GURL(storage::GetIsolatedFileSystemRootURIString( 140 root_url_ = GURL(storage::GetIsolatedFileSystemRootURIString(
140 url.GetOrigin(), fsid, root_name)); 141 main_frame_origin.GetURL(), fsid, root_name));
141 opened_ = true; 142 opened_ = true;
142 return PP_OK; 143 return PP_OK;
143 } 144 }
144 145
145 } // namespace content 146 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698