164 , m_group(0) |
164 , m_group(0) |
165 , m_debugger(0) |
165 , m_debugger(0) |
166 , m_customHTMLTokenizerTimeDelay(-1) |
166 , m_customHTMLTokenizerTimeDelay(-1) |
167 , m_customHTMLTokenizerChunkSize(-1) |
167 , m_customHTMLTokenizerChunkSize(-1) |
168 , m_canStartMedia(true) |
168 , m_canStartMedia(true) |
|
169 , m_viewMode(ViewModeWindowed) |
169 { |
170 { |
170 #if !ENABLE(CONTEXT_MENUS) |
171 #if !ENABLE(CONTEXT_MENUS) |
171 UNUSED_PARAM(contextMenuClient); |
172 UNUSED_PARAM(contextMenuClient); |
172 #endif |
173 #endif |
173 #if !ENABLE(DRAG_SUPPORT) |
174 #if !ENABLE(DRAG_SUPPORT) |
228 // Cancel keepAlive timers, to ensure we release all Frames before exiting. |
229 // Cancel keepAlive timers, to ensure we release all Frames before exiting. |
229 // It's safe to do this because we prohibit closing a Page while JavaScript |
230 // It's safe to do this because we prohibit closing a Page while JavaScript |
230 // is executing. |
231 // is executing. |
231 Frame::cancelAllKeepAlive(); |
232 Frame::cancelAllKeepAlive(); |
232 #endif |
233 #endif |
|
234 } |
|
235 |
|
236 struct ViewModeInfo { |
|
237 const char* name; |
|
238 Page::ViewMode type; |
|
239 }; |
|
240 static const int viewModeMapSize = 5; |
|
241 static ViewModeInfo viewModeMap[viewModeMapSize] = { |
|
242 {"windowed", Page::ViewModeWindowed}, |
|
243 {"floating", Page::ViewModeFloating}, |
|
244 {"fullscreen", Page::ViewModeFullscreen}, |
|
245 {"maximized", Page::ViewModeMaximized}, |
|
246 {"minimized", Page::ViewModeMinimized} |
|
247 }; |
|
248 |
|
249 Page::ViewMode Page::stringToViewMode(const String& text) |
|
250 { |
|
251 for (int i = 0; i < viewModeMapSize; ++i) { |
|
252 if (text == viewModeMap[i].name) |
|
253 return viewModeMap[i].type; |
|
254 } |
|
255 return Page::ViewModeInvalid; |
|
256 } |
|
257 |
|
258 void Page::setViewMode(ViewMode viewMode) |
|
259 { |
|
260 if (viewMode == m_viewMode || viewMode == ViewModeInvalid) |
|
261 return; |
|
262 |
|
263 m_viewMode = viewMode; |
|
264 |
|
265 if (!m_mainFrame) |
|
266 return; |
|
267 |
|
268 if (m_mainFrame->view()) |
|
269 m_mainFrame->view()->forceLayout(); |
|
270 |
|
271 if (m_mainFrame->document()) |
|
272 m_mainFrame->document()->updateStyleSelector(); |
233 } |
273 } |
234 |
274 |
235 void Page::setMainFrame(PassRefPtr<Frame> mainFrame) |
275 void Page::setMainFrame(PassRefPtr<Frame> mainFrame) |
236 { |
276 { |
237 ASSERT(!m_mainFrame); // Should only be called during initialization |
277 ASSERT(!m_mainFrame); // Should only be called during initialization |