| 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 "components/content_settings/content/common/content_settings_messages.h
" | 9 #include "components/content_settings/content/common/content_settings_messages.h
" |
| 10 #include "content/public/common/url_constants.h" | 10 #include "content/public/common/url_constants.h" |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 temporarily_allowed_plugins_.clear(); | 241 temporarily_allowed_plugins_.clear(); |
| 242 } | 242 } |
| 243 | 243 |
| 244 GURL url = frame->document().url(); | 244 GURL url = frame->document().url(); |
| 245 // If we start failing this DCHECK, please makes sure we don't regress | 245 // If we start failing this DCHECK, please makes sure we don't regress |
| 246 // this bug: http://code.google.com/p/chromium/issues/detail?id=79304 | 246 // this bug: http://code.google.com/p/chromium/issues/detail?id=79304 |
| 247 DCHECK(frame->document().getSecurityOrigin().toString() == "null" || | 247 DCHECK(frame->document().getSecurityOrigin().toString() == "null" || |
| 248 !url.SchemeIs(url::kDataScheme)); | 248 !url.SchemeIs(url::kDataScheme)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void ContentSettingsObserver::OnDestruct() { |
| 252 delete this; |
| 253 } |
| 254 |
| 251 bool ContentSettingsObserver::allowDatabase(const WebString& name, | 255 bool ContentSettingsObserver::allowDatabase(const WebString& name, |
| 252 const WebString& display_name, | 256 const WebString& display_name, |
| 253 unsigned long estimated_size) { | 257 unsigned long estimated_size) { |
| 254 WebFrame* frame = render_frame()->GetWebFrame(); | 258 WebFrame* frame = render_frame()->GetWebFrame(); |
| 255 if (frame->getSecurityOrigin().isUnique() || | 259 if (frame->getSecurityOrigin().isUnique() || |
| 256 frame->top()->getSecurityOrigin().isUnique()) | 260 frame->top()->getSecurityOrigin().isUnique()) |
| 257 return false; | 261 return false; |
| 258 | 262 |
| 259 bool result = false; | 263 bool result = false; |
| 260 Send(new ChromeViewHostMsg_AllowDatabase( | 264 Send(new ChromeViewHostMsg_AllowDatabase( |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 | 627 |
| 624 // If the scheme is file:, an empty file name indicates a directory listing, | 628 // If the scheme is file:, an empty file name indicates a directory listing, |
| 625 // which requires JavaScript to function properly. | 629 // which requires JavaScript to function properly. |
| 626 if (base::EqualsASCII(protocol, url::kFileScheme)) { | 630 if (base::EqualsASCII(protocol, url::kFileScheme)) { |
| 627 return document_url.SchemeIs(url::kFileScheme) && | 631 return document_url.SchemeIs(url::kFileScheme) && |
| 628 document_url.ExtractFileName().empty(); | 632 document_url.ExtractFileName().empty(); |
| 629 } | 633 } |
| 630 | 634 |
| 631 return false; | 635 return false; |
| 632 } | 636 } |
| OLD | NEW |