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 "chrome/common/chrome_switches.h" | 8 #include "chrome/common/chrome_switches.h" |
9 #include "chrome/common/render_messages.h" | 9 #include "chrome/common/render_messages.h" |
10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
54 DCHECK(rules[0].secondary_pattern == ContentSettingsPattern::Wildcard()); | 54 DCHECK(rules[0].secondary_pattern == ContentSettingsPattern::Wildcard()); |
55 return rules[0].setting; | 55 return rules[0].setting; |
56 } | 56 } |
57 const GURL& primary_url = GetOriginOrURL(frame); | 57 const GURL& primary_url = GetOriginOrURL(frame); |
58 for (it = rules.begin(); it != rules.end(); ++it) { | 58 for (it = rules.begin(); it != rules.end(); ++it) { |
59 if (it->primary_pattern.Matches(primary_url) && | 59 if (it->primary_pattern.Matches(primary_url) && |
60 it->secondary_pattern.Matches(secondary_url)) { | 60 it->secondary_pattern.Matches(secondary_url)) { |
61 return it->setting; | 61 return it->setting; |
62 } | 62 } |
63 } | 63 } |
64 NOTREACHED(); | |
65 return CONTENT_SETTING_DEFAULT; | 64 return CONTENT_SETTING_DEFAULT; |
66 } | 65 } |
67 | 66 |
68 } // namespace | 67 } // namespace |
69 | 68 |
70 ContentSettingsObserver::ContentSettingsObserver( | 69 ContentSettingsObserver::ContentSettingsObserver( |
71 content::RenderView* render_view) | 70 content::RenderView* render_view) |
72 : content::RenderViewObserver(render_view), | 71 : content::RenderViewObserver(render_view), |
73 content::RenderViewObserverTracker<ContentSettingsObserver>(render_view), | 72 content::RenderViewObserverTracker<ContentSettingsObserver>(render_view), |
74 content_setting_rules_(NULL), | 73 content_setting_rules_(NULL), |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
358 | 357 |
359 if (EqualsASCII(origin.protocol(), chrome::kChromeDevToolsScheme)) | 358 if (EqualsASCII(origin.protocol(), chrome::kChromeDevToolsScheme)) |
360 return true; // DevTools UI elements should still work. | 359 return true; // DevTools UI elements should still work. |
361 | 360 |
362 if (EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) | 361 if (EqualsASCII(origin.protocol(), extensions::kExtensionScheme)) |
363 return true; | 362 return true; |
364 | 363 |
365 if (EqualsASCII(origin.protocol(), chrome::kChromeInternalScheme)) | 364 if (EqualsASCII(origin.protocol(), chrome::kChromeInternalScheme)) |
366 return true; | 365 return true; |
367 | 366 |
367 // TODO(creis, fsamuel): Remove this once the concept of swapped out | |
368 // RenderViews goes away. | |
369 if (EqualsASCII(origin.protocol(), GURL(content::kSwappedOutURL).scheme())) | |
jochen (gone - plz use gerrit)
2013/12/03 15:35:07
doesn't document_url == GURL(content::kSwappedOutU
Fady Samuel
2013/12/03 15:56:26
It does. Changed.
| |
370 return true; | |
371 | |
368 // If the scheme is file:, an empty file name indicates a directory listing, | 372 // If the scheme is file:, an empty file name indicates a directory listing, |
369 // which requires JavaScript to function properly. | 373 // which requires JavaScript to function properly. |
370 if (EqualsASCII(origin.protocol(), chrome::kFileScheme)) { | 374 if (EqualsASCII(origin.protocol(), chrome::kFileScheme)) { |
371 return document_url.SchemeIs(chrome::kFileScheme) && | 375 return document_url.SchemeIs(chrome::kFileScheme) && |
372 document_url.ExtractFileName().empty(); | 376 document_url.ExtractFileName().empty(); |
373 } | 377 } |
374 | 378 |
375 return false; | 379 return false; |
376 } | 380 } |
OLD | NEW |