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

Side by Side Diff: Source/core/testing/Internals.cpp

Issue 765903002: Remove internals.setEnableMockPagePopup(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 #include "core/inspector/InspectorOverlay.h" 101 #include "core/inspector/InspectorOverlay.h"
102 #include "core/inspector/InstrumentingAgents.h" 102 #include "core/inspector/InstrumentingAgents.h"
103 #include "core/loader/FrameLoader.h" 103 #include "core/loader/FrameLoader.h"
104 #include "core/loader/HistoryItem.h" 104 #include "core/loader/HistoryItem.h"
105 #include "core/page/Chrome.h" 105 #include "core/page/Chrome.h"
106 #include "core/page/ChromeClient.h" 106 #include "core/page/ChromeClient.h"
107 #include "core/page/EventHandler.h" 107 #include "core/page/EventHandler.h"
108 #include "core/page/FocusController.h" 108 #include "core/page/FocusController.h"
109 #include "core/page/NetworkStateNotifier.h" 109 #include "core/page/NetworkStateNotifier.h"
110 #include "core/page/Page.h" 110 #include "core/page/Page.h"
111 #include "core/page/PagePopupController.h"
112 #include "core/page/PrintContext.h" 111 #include "core/page/PrintContext.h"
113 #include "core/plugins/testing/DictionaryPluginPlaceholder.h" 112 #include "core/plugins/testing/DictionaryPluginPlaceholder.h"
114 #include "core/plugins/testing/DocumentFragmentPluginPlaceholder.h" 113 #include "core/plugins/testing/DocumentFragmentPluginPlaceholder.h"
115 #include "core/rendering/RenderLayer.h" 114 #include "core/rendering/RenderLayer.h"
116 #include "core/rendering/RenderMenuList.h" 115 #include "core/rendering/RenderMenuList.h"
117 #include "core/rendering/RenderObject.h" 116 #include "core/rendering/RenderObject.h"
118 #include "core/rendering/RenderTreeAsText.h" 117 #include "core/rendering/RenderTreeAsText.h"
119 #include "core/rendering/RenderView.h" 118 #include "core/rendering/RenderView.h"
120 #include "core/rendering/compositing/CompositedLayerMapping.h" 119 #include "core/rendering/compositing/CompositedLayerMapping.h"
121 #include "core/rendering/compositing/RenderLayerCompositor.h" 120 #include "core/rendering/compositing/RenderLayerCompositor.h"
122 #include "core/testing/DictionaryTest.h" 121 #include "core/testing/DictionaryTest.h"
123 #include "core/testing/GCObservation.h" 122 #include "core/testing/GCObservation.h"
124 #include "core/testing/InternalSettings.h" 123 #include "core/testing/InternalSettings.h"
125 #include "core/testing/LayerRect.h" 124 #include "core/testing/LayerRect.h"
126 #include "core/testing/LayerRectList.h" 125 #include "core/testing/LayerRectList.h"
127 #include "core/testing/MockPagePopupDriver.h"
128 #include "core/testing/PluginPlaceholderOptions.h" 126 #include "core/testing/PluginPlaceholderOptions.h"
129 #include "core/testing/PrivateScriptTest.h" 127 #include "core/testing/PrivateScriptTest.h"
130 #include "core/testing/TypeConversions.h" 128 #include "core/testing/TypeConversions.h"
131 #include "core/testing/UnionTypesTest.h" 129 #include "core/testing/UnionTypesTest.h"
132 #include "core/workers/WorkerThread.h" 130 #include "core/workers/WorkerThread.h"
133 #include "platform/Cursor.h" 131 #include "platform/Cursor.h"
134 #include "platform/Language.h" 132 #include "platform/Language.h"
135 #include "platform/RuntimeEnabledFeatures.h" 133 #include "platform/RuntimeEnabledFeatures.h"
136 #include "platform/TraceEvent.h" 134 #include "platform/TraceEvent.h"
137 #include "platform/geometry/IntRect.h" 135 #include "platform/geometry/IntRect.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 exceptionState.throwTypeError("Not implemented"); 171 exceptionState.throwTypeError("Not implemented");
174 return ScriptValue(); 172 return ScriptValue();
175 } 173 }
176 174
177 private: 175 private:
178 int m_current; 176 int m_current;
179 }; 177 };
180 178
181 } // namespace 179 } // namespace
182 180
183 // FIXME: oilpan: These will be removed soon.
184 static MockPagePopupDriver* s_pagePopupDriver = 0;
185
186 using namespace HTMLNames; 181 using namespace HTMLNames;
187 182
188 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result) 183 static bool markerTypesFrom(const String& markerType, DocumentMarker::MarkerType s& result)
189 { 184 {
190 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all")) 185 if (markerType.isEmpty() || equalIgnoringCase(markerType, "all"))
191 result = DocumentMarker::AllMarkers(); 186 result = DocumentMarker::AllMarkers();
192 else if (equalIgnoringCase(markerType, "Spelling")) 187 else if (equalIgnoringCase(markerType, "Spelling"))
193 result = DocumentMarker::Spelling; 188 result = DocumentMarker::Spelling;
194 else if (equalIgnoringCase(markerType, "Grammar")) 189 else if (equalIgnoringCase(markerType, "Grammar"))
195 result = DocumentMarker::Grammar; 190 result = DocumentMarker::Grammar;
(...skipping 24 matching lines...) Expand all
220 } 215 }
221 216
222 void Internals::resetToConsistentState(Page* page) 217 void Internals::resetToConsistentState(Page* page)
223 { 218 {
224 ASSERT(page); 219 ASSERT(page);
225 220
226 page->setDeviceScaleFactor(1); 221 page->setDeviceScaleFactor(1);
227 page->setIsCursorVisible(true); 222 page->setIsCursorVisible(true);
228 page->setPageScaleFactor(1, IntPoint(0, 0)); 223 page->setPageScaleFactor(1, IntPoint(0, 0));
229 blink::overrideUserPreferredLanguages(Vector<AtomicString>()); 224 blink::overrideUserPreferredLanguages(Vector<AtomicString>());
230 delete s_pagePopupDriver;
231 s_pagePopupDriver = 0;
232 page->chrome().client().resetPagePopupDriver();
233 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck ingEnabled()) 225 if (!page->deprecatedLocalMainFrame()->spellChecker().isContinuousSpellCheck ingEnabled())
234 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh ecking(); 226 page->deprecatedLocalMainFrame()->spellChecker().toggleContinuousSpellCh ecking();
235 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled()) 227 if (page->deprecatedLocalMainFrame()->editor().isOverwriteModeEnabled())
236 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled(); 228 page->deprecatedLocalMainFrame()->editor().toggleOverwriteModeEnabled();
237 229
238 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( )) 230 if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator( ))
239 scrollingCoordinator->reset(); 231 scrollingCoordinator->reset();
240 232
241 page->deprecatedLocalMainFrame()->view()->clear(); 233 page->deprecatedLocalMainFrame()->view()->clear();
242 } 234 }
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 { 643 {
652 HistoryItem* mainItem = frame()->loader().currentItem(); 644 HistoryItem* mainItem = frame()->loader().currentItem();
653 if (!mainItem) { 645 if (!mainItem) {
654 exceptionState.throwDOMException(InvalidAccessError, "No history item is available."); 646 exceptionState.throwDOMException(InvalidAccessError, "No history item is available.");
655 return; 647 return;
656 } 648 }
657 mainItem->clearDocumentState(); 649 mainItem->clearDocumentState();
658 mainItem->setDocumentState(state); 650 mainItem->setDocumentState(state);
659 } 651 }
660 652
661 void Internals::setEnableMockPagePopup(bool enabled, ExceptionState& exceptionSt ate)
662 {
663 Document* document = contextDocument();
664 if (!document || !document->page())
665 return;
666 Page* page = document->page();
667 if (!enabled) {
668 page->chrome().client().resetPagePopupDriver();
669 return;
670 }
671 if (!s_pagePopupDriver)
672 s_pagePopupDriver = MockPagePopupDriver::create(page->deprecatedLocalMai nFrame()).leakPtr();
673 page->chrome().client().setPagePopupDriver(s_pagePopupDriver);
674 }
675
676 PassRefPtrWillBeRawPtr<PagePopupController> Internals::pagePopupController()
677 {
678 return s_pagePopupDriver ? s_pagePopupDriver->pagePopupController() : 0;
679 }
680
681 DOMWindow* Internals::pagePopupWindow() const 653 DOMWindow* Internals::pagePopupWindow() const
682 { 654 {
683 Document* document = contextDocument(); 655 Document* document = contextDocument();
684 if (!document) 656 if (!document)
685 return nullptr; 657 return nullptr;
686 Page* page = document->page(); 658 if (Page* page = document->page())
687 if (!page) 659 return page->chrome().client().pagePopupWindowForTesting();
688 return nullptr; 660 return nullptr;
689 PagePopupDriver* pagePopupDriver = page->chrome().client().pagePopupDriver() ;
690 if (!pagePopupDriver)
691 return nullptr;
692 return pagePopupDriver->pagePopupWindow();
693 } 661 }
694 662
695 PassRefPtrWillBeRawPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState & exceptionState) 663 PassRefPtrWillBeRawPtr<ClientRect> Internals::absoluteCaretBounds(ExceptionState & exceptionState)
696 { 664 {
697 Document* document = contextDocument(); 665 Document* document = contextDocument();
698 if (!document || !document->frame()) { 666 if (!document || !document->frame()) {
699 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "No context document can be obtained."); 667 exceptionState.throwDOMException(InvalidAccessError, document ? "The doc ument's frame cannot be retrieved." : "No context document can be obtained.");
700 return ClientRect::create(); 668 return ClientRect::create();
701 } 669 }
702 670
(...skipping 1637 matching lines...) Expand 10 before | Expand all | Expand 10 after
2340 } 2308 }
2341 toHTMLPlugInElement(element)->setPlaceholder(DictionaryPluginPlaceholder::cr eate(element->document(), options)); 2309 toHTMLPlugInElement(element)->setPlaceholder(DictionaryPluginPlaceholder::cr eate(element->document(), options));
2342 } 2310 }
2343 2311
2344 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState) 2312 Iterator* Internals::iterator(ScriptState* scriptState, ExceptionState& exceptio nState)
2345 { 2313 {
2346 return new InternalsIterator; 2314 return new InternalsIterator;
2347 } 2315 }
2348 2316
2349 } // namespace blink 2317 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698