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

Side by Side Diff: chrome/renderer/content_settings_observer.cc

Issue 2651543007: Use explicit WebString conversions in remaining chrome/renderer files (Closed)
Patch Set: Created 3 years, 11 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) 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 "chrome/common/render_messages.h" 7 #include "chrome/common/render_messages.h"
8 #include "chrome/common/ssl_insecure_content.h" 8 #include "chrome/common/ssl_insecure_content.h"
9 #include "content/public/common/url_constants.h" 9 #include "content/public/common/url_constants.h"
10 #include "content/public/renderer/document_state.h" 10 #include "content/public/renderer/document_state.h"
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 const WebString& display_name, 209 const WebString& display_name,
210 unsigned estimated_size) { 210 unsigned estimated_size) {
211 WebFrame* frame = render_frame()->GetWebFrame(); 211 WebFrame* frame = render_frame()->GetWebFrame();
212 if (frame->getSecurityOrigin().isUnique() || 212 if (frame->getSecurityOrigin().isUnique() ||
213 frame->top()->getSecurityOrigin().isUnique()) 213 frame->top()->getSecurityOrigin().isUnique())
214 return false; 214 return false;
215 215
216 bool result = false; 216 bool result = false;
217 Send(new ChromeViewHostMsg_AllowDatabase( 217 Send(new ChromeViewHostMsg_AllowDatabase(
218 routing_id(), url::Origin(frame->getSecurityOrigin()).GetURL(), 218 routing_id(), url::Origin(frame->getSecurityOrigin()).GetURL(),
219 url::Origin(frame->top()->getSecurityOrigin()).GetURL(), name, 219 url::Origin(frame->top()->getSecurityOrigin()).GetURL(), name.utf16(),
220 display_name, &result)); 220 display_name.utf16(), &result));
221 return result; 221 return result;
222 } 222 }
223 223
224 void ContentSettingsObserver::requestFileSystemAccessAsync( 224 void ContentSettingsObserver::requestFileSystemAccessAsync(
225 const WebContentSettingCallbacks& callbacks) { 225 const WebContentSettingCallbacks& callbacks) {
226 WebFrame* frame = render_frame()->GetWebFrame(); 226 WebFrame* frame = render_frame()->GetWebFrame();
227 if (frame->getSecurityOrigin().isUnique() || 227 if (frame->getSecurityOrigin().isUnique() ||
228 frame->top()->getSecurityOrigin().isUnique()) { 228 frame->top()->getSecurityOrigin().isUnique()) {
229 WebContentSettingCallbacks permissionCallbacks(callbacks); 229 WebContentSettingCallbacks permissionCallbacks(callbacks);
230 permissionCallbacks.doDeny(); 230 permissionCallbacks.doDeny();
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 bool ContentSettingsObserver::allowIndexedDB(const WebString& name, 268 bool ContentSettingsObserver::allowIndexedDB(const WebString& name,
269 const WebSecurityOrigin& origin) { 269 const WebSecurityOrigin& origin) {
270 WebFrame* frame = render_frame()->GetWebFrame(); 270 WebFrame* frame = render_frame()->GetWebFrame();
271 if (frame->getSecurityOrigin().isUnique() || 271 if (frame->getSecurityOrigin().isUnique() ||
272 frame->top()->getSecurityOrigin().isUnique()) 272 frame->top()->getSecurityOrigin().isUnique())
273 return false; 273 return false;
274 274
275 bool result = false; 275 bool result = false;
276 Send(new ChromeViewHostMsg_AllowIndexedDB( 276 Send(new ChromeViewHostMsg_AllowIndexedDB(
277 routing_id(), url::Origin(frame->getSecurityOrigin()).GetURL(), 277 routing_id(), url::Origin(frame->getSecurityOrigin()).GetURL(),
278 url::Origin(frame->top()->getSecurityOrigin()).GetURL(), name, &result)); 278 url::Origin(frame->top()->getSecurityOrigin()).GetURL(), name.utf16(),
279 &result));
279 return result; 280 return result;
280 } 281 }
281 282
282 bool ContentSettingsObserver::allowPlugins(bool enabled_per_settings) { 283 bool ContentSettingsObserver::allowPlugins(bool enabled_per_settings) {
283 return enabled_per_settings; 284 return enabled_per_settings;
284 } 285 }
285 286
286 bool ContentSettingsObserver::allowScript(bool enabled_per_settings) { 287 bool ContentSettingsObserver::allowScript(bool enabled_per_settings) {
287 if (!enabled_per_settings) 288 if (!enabled_per_settings)
288 return false; 289 return false;
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 const extensions::Extension* extension = GetExtension(origin); 475 const extensions::Extension* extension = GetExtension(origin);
475 return extension && extension->is_platform_app(); 476 return extension && extension->is_platform_app();
476 #else 477 #else
477 return false; 478 return false;
478 #endif 479 #endif
479 } 480 }
480 481
481 #if BUILDFLAG(ENABLE_EXTENSIONS) 482 #if BUILDFLAG(ENABLE_EXTENSIONS)
482 const extensions::Extension* ContentSettingsObserver::GetExtension( 483 const extensions::Extension* ContentSettingsObserver::GetExtension(
483 const WebSecurityOrigin& origin) const { 484 const WebSecurityOrigin& origin) const {
484 if (!base::EqualsASCII(base::StringPiece16(origin.protocol()), 485 if (origin.protocol().ascii() != extensions::kExtensionScheme)
485 extensions::kExtensionScheme))
486 return NULL; 486 return NULL;
487 487
488 const std::string extension_id = origin.host().utf8().data(); 488 const std::string extension_id = origin.host().utf8().data();
489 if (!extension_dispatcher_->IsExtensionActive(extension_id)) 489 if (!extension_dispatcher_->IsExtensionActive(extension_id))
490 return NULL; 490 return NULL;
491 491
492 return extensions::RendererExtensionRegistry::Get()->GetByID(extension_id); 492 return extensions::RendererExtensionRegistry::Get()->GetByID(extension_id);
493 } 493 }
494 #endif 494 #endif
495 495
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 #endif 530 #endif
531 531
532 // If the scheme is file:, an empty file name indicates a directory listing, 532 // If the scheme is file:, an empty file name indicates a directory listing,
533 // which requires JavaScript to function properly. 533 // which requires JavaScript to function properly.
534 if (protocol == url::kFileScheme && 534 if (protocol == url::kFileScheme &&
535 document_url.protocolIs(url::kFileScheme)) { 535 document_url.protocolIs(url::kFileScheme)) {
536 return GURL(document_url).ExtractFileName().empty(); 536 return GURL(document_url).ExtractFileName().empty();
537 } 537 }
538 return false; 538 return false;
539 } 539 }
OLDNEW
« no previous file with comments | « chrome/renderer/chrome_render_thread_observer.cc ('k') | chrome/renderer/extensions/page_capture_custom_bindings.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698