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

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

Issue 13516002: Whitelist Instant processes for content settings (Closed) Base URL: http://git.chromium.org/chromium/src.git@omniboxtest
Patch Set: 4 Created 7 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
« no previous file with comments | « chrome/browser/ui/search/instant_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/command_line.h"
8 #include "chrome/common/chrome_switches.h"
7 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
8 #include "chrome/common/url_constants.h" 10 #include "chrome/common/url_constants.h"
9 #include "content/public/renderer/document_state.h" 11 #include "content/public/renderer/document_state.h"
10 #include "content/public/renderer/navigation_state.h" 12 #include "content/public/renderer/navigation_state.h"
11 #include "content/public/renderer/render_view.h" 13 #include "content/public/renderer/render_view.h"
12 #include "extensions/common/constants.h" 14 #include "extensions/common/constants.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h" 15 #include "third_party/WebKit/Source/Platform/chromium/public/WebURL.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDataSource.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 } 313 }
312 314
313 void ContentSettingsObserver::ClearBlockedContentSettings() { 315 void ContentSettingsObserver::ClearBlockedContentSettings() {
314 for (size_t i = 0; i < arraysize(content_blocked_); ++i) 316 for (size_t i = 0; i < arraysize(content_blocked_); ++i)
315 content_blocked_[i] = false; 317 content_blocked_[i] = false;
316 cached_storage_permissions_.clear(); 318 cached_storage_permissions_.clear();
317 cached_script_permissions_.clear(); 319 cached_script_permissions_.clear();
318 } 320 }
319 321
320 bool ContentSettingsObserver::IsWhitelistedForContentSettings(WebFrame* frame) { 322 bool ContentSettingsObserver::IsWhitelistedForContentSettings(WebFrame* frame) {
323 // Whitelist Instant processes.
324 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kInstantProcess))
markusheintz_ 2013/04/17 19:24:38 Sorry for being late in this party. Does this whit
ckocagil 2013/04/17 21:39:42 No, it affects all Instant processes, including th
325 return true;
326
321 // Whitelist ftp directory listings, as they require JavaScript to function 327 // Whitelist ftp directory listings, as they require JavaScript to function
322 // properly. 328 // properly.
323 webkit_glue::WebURLResponseExtraDataImpl* extra_data = 329 webkit_glue::WebURLResponseExtraDataImpl* extra_data =
324 static_cast<webkit_glue::WebURLResponseExtraDataImpl*>( 330 static_cast<webkit_glue::WebURLResponseExtraDataImpl*>(
325 frame->dataSource()->response().extraData()); 331 frame->dataSource()->response().extraData());
326 if (extra_data && extra_data->is_ftp_directory_listing()) 332 if (extra_data && extra_data->is_ftp_directory_listing())
327 return true; 333 return true;
328 return IsWhitelistedForContentSettings(frame->document().securityOrigin(), 334 return IsWhitelistedForContentSettings(frame->document().securityOrigin(),
329 frame->document().url()); 335 frame->document().url());
330 } 336 }
(...skipping 21 matching lines...) Expand all
352 358
353 // If the scheme is file:, an empty file name indicates a directory listing, 359 // If the scheme is file:, an empty file name indicates a directory listing,
354 // which requires JavaScript to function properly. 360 // which requires JavaScript to function properly.
355 if (EqualsASCII(origin.protocol(), chrome::kFileScheme)) { 361 if (EqualsASCII(origin.protocol(), chrome::kFileScheme)) {
356 return document_url.SchemeIs(chrome::kFileScheme) && 362 return document_url.SchemeIs(chrome::kFileScheme) &&
357 document_url.ExtractFileName().empty(); 363 document_url.ExtractFileName().empty();
358 } 364 }
359 365
360 return false; 366 return false;
361 } 367 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/search/instant_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698