OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * Copyright (C) 2013 Apple Inc. All rights reserved. | 3 * Copyright (C) 2013 Apple Inc. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled); | 93 settings->setMockScrollbarsEnabled(m_originalMockScrollbarsEnabled); |
94 RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttr
ibuteAwareFormControlUIEnabled); | 94 RuntimeEnabledFeatures::setLangAttributeAwareFormControlUIEnabled(m_langAttr
ibuteAwareFormControlUIEnabled); |
95 settings->setImagesEnabled(m_imagesEnabled); | 95 settings->setImagesEnabled(m_imagesEnabled); |
96 settings->setDefaultVideoPosterURL(m_defaultVideoPosterURL); | 96 settings->setDefaultVideoPosterURL(m_defaultVideoPosterURL); |
97 settings->setCompositorDrivenAcceleratedScrollingEnabled(m_originalComposito
rDrivenAcceleratedScrollEnabled); | 97 settings->setCompositorDrivenAcceleratedScrollingEnabled(m_originalComposito
rDrivenAcceleratedScrollEnabled); |
98 settings->setLayerSquashingEnabled(m_originalLayerSquashingEnabled); | 98 settings->setLayerSquashingEnabled(m_originalLayerSquashingEnabled); |
99 settings->setPasswordGenerationDecorationEnabled(m_originalPasswordGeneratio
nDecorationEnabled); | 99 settings->setPasswordGenerationDecorationEnabled(m_originalPasswordGeneratio
nDecorationEnabled); |
100 settings->genericFontFamilySettings().reset(); | 100 settings->genericFontFamilySettings().reset(); |
101 } | 101 } |
102 | 102 |
| 103 #if ENABLE(OILPAN) |
| 104 InternalSettings* InternalSettings::from(Page& page) |
| 105 { |
| 106 if (!HeapSupplement<Page>::from(page, supplementName())) |
| 107 HeapSupplement<Page>::provideTo(page, supplementName(), new InternalSett
ings(page)); |
| 108 return static_cast<InternalSettings*>(HeapSupplement<Page>::from(page, suppl
ementName())); |
| 109 } |
| 110 #else |
103 // We can't use RefCountedSupplement because that would try to make InternalSett
ings RefCounted | 111 // We can't use RefCountedSupplement because that would try to make InternalSett
ings RefCounted |
104 // and InternalSettings is already RefCounted via its base class, InternalSettin
gsGenerated. | 112 // and InternalSettings is already RefCounted via its base class, InternalSettin
gsGenerated. |
105 // Instead, we manually make InternalSettings supplement Page. | 113 // Instead, we manually make InternalSettings supplement Page. |
106 class InternalSettingsWrapper : public Supplement<Page> { | 114 class InternalSettingsWrapper : public Supplement<Page> { |
107 public: | 115 public: |
108 explicit InternalSettingsWrapper(Page& page) | 116 explicit InternalSettingsWrapper(Page& page) |
109 : m_internalSettings(InternalSettings::create(page)) { } | 117 : m_internalSettings(InternalSettings::create(page)) { } |
110 virtual ~InternalSettingsWrapper() { m_internalSettings->hostDestroyed(); } | 118 virtual ~InternalSettingsWrapper() { m_internalSettings->hostDestroyed(); } |
111 #if !ASSERT_DISABLED | 119 #if !ASSERT_DISABLED |
112 virtual bool isRefCountedWrapper() const OVERRIDE { return true; } | 120 virtual bool isRefCountedWrapper() const OVERRIDE { return true; } |
113 #endif | 121 #endif |
114 InternalSettings* internalSettings() const { return m_internalSettings.get()
; } | 122 InternalSettings* internalSettings() const { return m_internalSettings.get()
; } |
115 | 123 |
116 virtual void trace(Visitor*) OVERRIDE { } | 124 virtual void trace(Visitor*) OVERRIDE { } |
117 | 125 |
118 private: | 126 private: |
119 RefPtrWillBePersistent<InternalSettings> m_internalSettings; | 127 RefPtr<InternalSettings> m_internalSettings; |
120 }; | 128 }; |
121 | 129 |
122 const char* InternalSettings::supplementName() | |
123 { | |
124 return "InternalSettings"; | |
125 } | |
126 | |
127 InternalSettings* InternalSettings::from(Page& page) | 130 InternalSettings* InternalSettings::from(Page& page) |
128 { | 131 { |
129 if (!Supplement<Page>::from(page, supplementName())) | 132 if (!Supplement<Page>::from(page, supplementName())) |
130 Supplement<Page>::provideTo(page, supplementName(), adoptPtr(new Interna
lSettingsWrapper(page))); | 133 Supplement<Page>::provideTo(page, supplementName(), adoptPtr(new Interna
lSettingsWrapper(page))); |
131 return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, su
pplementName()))->internalSettings(); | 134 return static_cast<InternalSettingsWrapper*>(Supplement<Page>::from(page, su
pplementName()))->internalSettings(); |
132 } | 135 } |
| 136 #endif |
| 137 |
| 138 const char* InternalSettings::supplementName() |
| 139 { |
| 140 return "InternalSettings"; |
| 141 } |
133 | 142 |
134 InternalSettings::~InternalSettings() | 143 InternalSettings::~InternalSettings() |
135 { | 144 { |
136 } | 145 } |
137 | 146 |
138 InternalSettings::InternalSettings(Page& page) | 147 InternalSettings::InternalSettings(Page& page) |
139 : InternalSettingsGenerated(&page) | 148 : InternalSettingsGenerated(&page) |
140 , m_page(&page) | 149 , m_page(&page) |
141 , m_backup(&page.settings()) | 150 , m_backup(&page.settings()) |
142 { | 151 { |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 InternalSettingsGuardForSettings(); | 348 InternalSettingsGuardForSettings(); |
340 settings()->setDefaultVideoPosterURL(url); | 349 settings()->setDefaultVideoPosterURL(url); |
341 } | 350 } |
342 | 351 |
343 void InternalSettings::setPasswordGenerationDecorationEnabled(bool enabled, Exce
ptionState& exceptionState) | 352 void InternalSettings::setPasswordGenerationDecorationEnabled(bool enabled, Exce
ptionState& exceptionState) |
344 { | 353 { |
345 InternalSettingsGuardForSettings(); | 354 InternalSettingsGuardForSettings(); |
346 settings()->setPasswordGenerationDecorationEnabled(enabled); | 355 settings()->setPasswordGenerationDecorationEnabled(enabled); |
347 } | 356 } |
348 | 357 |
| 358 void InternalSettings::trace(Visitor* visitor) |
| 359 { |
| 360 visitor->trace(m_page); |
| 361 InternalSettingsGenerated::trace(visitor); |
349 } | 362 } |
| 363 |
| 364 } |
OLD | NEW |