OLD | NEW |
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/content_settings_observer.h" | 5 #include "chrome/renderer/content_settings_observer.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/common/chrome_switches.h" | 9 #include "chrome/common/chrome_switches.h" |
10 #include "chrome/common/render_messages.h" | 10 #include "chrome/common/render_messages.h" |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 return false; | 259 return false; |
260 | 260 |
261 bool result = false; | 261 bool result = false; |
262 Send(new ChromeViewHostMsg_AllowDatabase( | 262 Send(new ChromeViewHostMsg_AllowDatabase( |
263 routing_id(), GURL(frame->document().securityOrigin().toString()), | 263 routing_id(), GURL(frame->document().securityOrigin().toString()), |
264 GURL(frame->top()->document().securityOrigin().toString()), | 264 GURL(frame->top()->document().securityOrigin().toString()), |
265 name, display_name, &result)); | 265 name, display_name, &result)); |
266 return result; | 266 return result; |
267 } | 267 } |
268 | 268 |
269 bool ContentSettingsObserver::allowFileSystem() { | |
270 WebFrame* frame = render_frame()->GetWebFrame(); | |
271 if (frame->document().securityOrigin().isUnique() || | |
272 frame->top()->document().securityOrigin().isUnique()) | |
273 return false; | |
274 | |
275 bool result = false; | |
276 Send(new ChromeViewHostMsg_RequestFileSystemAccessSync( | |
277 routing_id(), GURL(frame->document().securityOrigin().toString()), | |
278 GURL(frame->top()->document().securityOrigin().toString()), &result)); | |
279 return result; | |
280 } | |
281 | |
282 void ContentSettingsObserver::requestFileSystemAccessAsync( | 269 void ContentSettingsObserver::requestFileSystemAccessAsync( |
283 const WebPermissionCallbacks& callbacks) { | 270 const WebPermissionCallbacks& callbacks) { |
284 WebFrame* frame = render_frame()->GetWebFrame(); | 271 WebFrame* frame = render_frame()->GetWebFrame(); |
285 if (frame->document().securityOrigin().isUnique() || | 272 if (frame->document().securityOrigin().isUnique() || |
286 frame->top()->document().securityOrigin().isUnique()) { | 273 frame->top()->document().securityOrigin().isUnique()) { |
287 WebPermissionCallbacks permissionCallbacks(callbacks); | 274 WebPermissionCallbacks permissionCallbacks(callbacks); |
288 permissionCallbacks.doDeny(); | 275 permissionCallbacks.doDeny(); |
289 return; | 276 return; |
290 } | 277 } |
291 ++current_request_id_; | 278 ++current_request_id_; |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 | 697 |
711 // If the scheme is file:, an empty file name indicates a directory listing, | 698 // If the scheme is file:, an empty file name indicates a directory listing, |
712 // which requires JavaScript to function properly. | 699 // which requires JavaScript to function properly. |
713 if (EqualsASCII(origin.protocol(), content::kFileScheme)) { | 700 if (EqualsASCII(origin.protocol(), content::kFileScheme)) { |
714 return document_url.SchemeIs(content::kFileScheme) && | 701 return document_url.SchemeIs(content::kFileScheme) && |
715 document_url.ExtractFileName().empty(); | 702 document_url.ExtractFileName().empty(); |
716 } | 703 } |
717 | 704 |
718 return false; | 705 return false; |
719 } | 706 } |
OLD | NEW |