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

Side by Side Diff: Source/web/WebLocalFrameImpl.cpp

Issue 471503002: Cleanup namespace usage in Source/web/Web[I-Z]*.cpp (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 | « Source/web/WebLeakDetector.cpp ('k') | Source/web/WebMIDIClientMock.cpp » ('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) 2009 Google Inc. All rights reserved. 2 * Copyright (C) 2009 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 #include "web/SharedWorkerRepositoryClientImpl.h" 188 #include "web/SharedWorkerRepositoryClientImpl.h"
189 #include "web/TextFinder.h" 189 #include "web/TextFinder.h"
190 #include "web/WebDataSourceImpl.h" 190 #include "web/WebDataSourceImpl.h"
191 #include "web/WebDevToolsAgentPrivate.h" 191 #include "web/WebDevToolsAgentPrivate.h"
192 #include "web/WebPluginContainerImpl.h" 192 #include "web/WebPluginContainerImpl.h"
193 #include "web/WebViewImpl.h" 193 #include "web/WebViewImpl.h"
194 #include "wtf/CurrentTime.h" 194 #include "wtf/CurrentTime.h"
195 #include "wtf/HashMap.h" 195 #include "wtf/HashMap.h"
196 #include <algorithm> 196 #include <algorithm>
197 197
198 using namespace blink;
199
200 namespace blink { 198 namespace blink {
201 199
202 static int frameCount = 0; 200 static int frameCount = 0;
203 201
204 // Key for a StatsCounter tracking how many WebFrames are active. 202 // Key for a StatsCounter tracking how many WebFrames are active.
205 static const char webFrameActiveCount[] = "WebFrameActiveCount"; 203 static const char webFrameActiveCount[] = "WebFrameActiveCount";
206 204
207 static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBu ilder& output) 205 static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBu ilder& output)
208 { 206 {
209 Document* document = frame->document(); 207 Document* document = frame->document();
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
267 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame) 265 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromFrame(LocalFrame* frame)
268 { 266 {
269 if (!frame) 267 if (!frame)
270 return 0; 268 return 0;
271 if (!frame->document() || !frame->document()->isPluginDocument()) 269 if (!frame->document() || !frame->document()->isPluginDocument())
272 return 0; 270 return 0;
273 PluginDocument* pluginDocument = toPluginDocument(frame->document()); 271 PluginDocument* pluginDocument = toPluginDocument(frame->document());
274 return toWebPluginContainerImpl(pluginDocument->pluginWidget()); 272 return toWebPluginContainerImpl(pluginDocument->pluginWidget());
275 } 273 }
276 274
277 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromNode(blink::LocalF rame* frame, const WebNode& node) 275 WebPluginContainerImpl* WebLocalFrameImpl::pluginContainerFromNode(LocalFrame* f rame, const WebNode& node)
278 { 276 {
279 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame); 277 WebPluginContainerImpl* pluginContainer = pluginContainerFromFrame(frame);
280 if (pluginContainer) 278 if (pluginContainer)
281 return pluginContainer; 279 return pluginContainer;
282 return toWebPluginContainerImpl(node.pluginContainer()); 280 return toWebPluginContainerImpl(node.pluginContainer());
283 } 281 }
284 282
285 // Simple class to override some of PrintContext behavior. Some of the methods 283 // Simple class to override some of PrintContext behavior. Some of the methods
286 // made virtual so that they can be overridden by ChromePluginPrintContext. 284 // made virtual so that they can be overridden by ChromePluginPrintContext.
287 class ChromePrintContext : public PrintContext { 285 class ChromePrintContext : public PrintContext {
(...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 858
861 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR L, const WebURL& unreachableURL, bool replace) 859 void WebLocalFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseUR L, const WebURL& unreachableURL, bool replace)
862 { 860 {
863 ASSERT(frame()); 861 ASSERT(frame());
864 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8" ), baseURL, unreachableURL, replace); 862 loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8" ), baseURL, unreachableURL, replace);
865 } 863 }
866 864
867 void WebLocalFrameImpl::sendPings(const WebNode& linkNode, const WebURL& destina tionURL) 865 void WebLocalFrameImpl::sendPings(const WebNode& linkNode, const WebURL& destina tionURL)
868 { 866 {
869 ASSERT(frame()); 867 ASSERT(frame());
870 const blink::Node* node = linkNode.constUnwrap<Node>(); 868 const Node* node = linkNode.constUnwrap<Node>();
871 if (isHTMLAnchorElement(node)) 869 if (isHTMLAnchorElement(node))
872 toHTMLAnchorElement(node)->sendPings(destinationURL); 870 toHTMLAnchorElement(node)->sendPings(destinationURL);
873 } 871 }
874 872
875 bool WebLocalFrameImpl::isLoading() const 873 bool WebLocalFrameImpl::isLoading() const
876 { 874 {
877 if (!frame()) 875 if (!frame())
878 return false; 876 return false;
879 return frame()->loader().isLoading(); 877 return frame()->loader().isLoading();
880 } 878 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1150 } 1148 }
1151 1149
1152 void WebLocalFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent ) 1150 void WebLocalFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent )
1153 { 1151 {
1154 moveRangeSelection(base, extent); 1152 moveRangeSelection(base, extent);
1155 } 1153 }
1156 1154
1157 void WebLocalFrameImpl::selectRange(const WebRange& webRange) 1155 void WebLocalFrameImpl::selectRange(const WebRange& webRange)
1158 { 1156 {
1159 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge> >(webRange)) 1157 if (RefPtrWillBeRawPtr<Range> range = static_cast<PassRefPtrWillBeRawPtr<Ran ge> >(webRange))
1160 frame()->selection().setSelectedRange(range.get(), blink::VP_DEFAULT_AFF INITY, FrameSelection::NonDirectional, NotUserTriggered); 1158 frame()->selection().setSelectedRange(range.get(), VP_DEFAULT_AFFINITY, FrameSelection::NonDirectional, NotUserTriggered);
1161 } 1159 }
1162 1160
1163 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint& extent) 1161 void WebLocalFrameImpl::moveRangeSelection(const WebPoint& base, const WebPoint& extent)
1164 { 1162 {
1165 VisiblePosition basePosition = visiblePositionForWindowPoint(base); 1163 VisiblePosition basePosition = visiblePositionForWindowPoint(base);
1166 VisiblePosition extentPosition = visiblePositionForWindowPoint(extent); 1164 VisiblePosition extentPosition = visiblePositionForWindowPoint(extent);
1167 VisibleSelection newSelection = VisibleSelection(basePosition, extentPositio n); 1165 VisibleSelection newSelection = VisibleSelection(basePosition, extentPositio n);
1168 frame()->selection().setSelection(newSelection, CharacterGranularity); 1166 frame()->selection().setSelection(newSelection, CharacterGranularity);
1169 } 1167 }
1170 1168
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1518 } 1516 }
1519 1517
1520 WebLocalFrameImpl::WebLocalFrameImpl(WebFrameClient* client) 1518 WebLocalFrameImpl::WebLocalFrameImpl(WebFrameClient* client)
1521 : m_frameLoaderClientImpl(this) 1519 : m_frameLoaderClientImpl(this)
1522 , m_client(client) 1520 , m_client(client)
1523 , m_permissionClient(0) 1521 , m_permissionClient(0)
1524 , m_inputEventsScaleFactorForEmulation(1) 1522 , m_inputEventsScaleFactorForEmulation(1)
1525 , m_userMediaClientImpl(this) 1523 , m_userMediaClientImpl(this)
1526 , m_geolocationClientProxy(adoptPtr(new GeolocationClientProxy(client ? clie nt->geolocationClient() : 0))) 1524 , m_geolocationClientProxy(adoptPtr(new GeolocationClientProxy(client ? clie nt->geolocationClient() : 0)))
1527 { 1525 {
1528 blink::Platform::current()->incrementStatsCounter(webFrameActiveCount); 1526 Platform::current()->incrementStatsCounter(webFrameActiveCount);
1529 frameCount++; 1527 frameCount++;
1530 } 1528 }
1531 1529
1532 WebLocalFrameImpl::~WebLocalFrameImpl() 1530 WebLocalFrameImpl::~WebLocalFrameImpl()
1533 { 1531 {
1534 blink::Platform::current()->decrementStatsCounter(webFrameActiveCount); 1532 Platform::current()->decrementStatsCounter(webFrameActiveCount);
1535 frameCount--; 1533 frameCount--;
1536 1534
1537 cancelPendingScopingEffort(); 1535 cancelPendingScopingEffort();
1538 } 1536 }
1539 1537
1540 void WebLocalFrameImpl::setWebCoreFrame(PassRefPtr<blink::LocalFrame> frame) 1538 void WebLocalFrameImpl::setWebCoreFrame(PassRefPtr<LocalFrame> frame)
1541 { 1539 {
1542 m_frame = frame; 1540 m_frame = frame;
1543 1541
1544 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used. 1542 // FIXME: we shouldn't add overhead to every frame by registering these obje cts when they're not used.
1545 if (m_frame) { 1543 if (m_frame) {
1546 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N otificationPresenterImpl()); 1544 OwnPtr<NotificationPresenterImpl> notificationPresenter = adoptPtr(new N otificationPresenterImpl());
1547 if (m_client) 1545 if (m_client)
1548 notificationPresenter->initialize(m_client->notificationPresenter()) ; 1546 notificationPresenter->initialize(m_client->notificationPresenter()) ;
1549 1547
1550 provideNotification(*m_frame, notificationPresenter.release()); 1548 provideNotification(*m_frame, notificationPresenter.release());
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1826 1824
1827 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const 1825 WebLocalFrameImpl* WebLocalFrameImpl::activeMatchFrame() const
1828 { 1826 {
1829 ASSERT(!parent()); 1827 ASSERT(!parent());
1830 1828
1831 if (m_textFinder) 1829 if (m_textFinder)
1832 return m_textFinder->activeMatchFrame(); 1830 return m_textFinder->activeMatchFrame();
1833 return 0; 1831 return 0;
1834 } 1832 }
1835 1833
1836 blink::Range* WebLocalFrameImpl::activeMatch() const 1834 Range* WebLocalFrameImpl::activeMatch() const
1837 { 1835 {
1838 if (m_textFinder) 1836 if (m_textFinder)
1839 return m_textFinder->activeMatch(); 1837 return m_textFinder->activeMatch();
1840 return 0; 1838 return 0;
1841 } 1839 }
1842 1840
1843 TextFinder& WebLocalFrameImpl::ensureTextFinder() 1841 TextFinder& WebLocalFrameImpl::ensureTextFinder()
1844 { 1842 {
1845 if (!m_textFinder) 1843 if (!m_textFinder)
1846 m_textFinder = TextFinder::create(*this); 1844 m_textFinder = TextFinder::create(*this);
(...skipping 13 matching lines...) Expand all
1860 1858
1861 void WebLocalFrameImpl::invalidateAll() const 1859 void WebLocalFrameImpl::invalidateAll() const
1862 { 1860 {
1863 ASSERT(frame() && frame()->view()); 1861 ASSERT(frame() && frame()->view());
1864 FrameView* view = frame()->view(); 1862 FrameView* view = frame()->view();
1865 view->invalidateRect(view->frameRect()); 1863 view->invalidateRect(view->frameRect());
1866 invalidateScrollbar(); 1864 invalidateScrollbar();
1867 } 1865 }
1868 1866
1869 } // namespace blink 1867 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/WebLeakDetector.cpp ('k') | Source/web/WebMIDIClientMock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698