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

Side by Side Diff: Source/core/inspector/InspectorApplicationCacheAgent.cpp

Issue 892693006: Revert of DevTools: use per-LocalFrame instrumenting agents instead of per-Page ones. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010 Google Inc. All rights reserved. 3 * Copyright (C) 2010 Google 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 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 if (m_state->getBoolean(ApplicationCacheAgentState::applicationCacheAgentEna bled)) { 64 if (m_state->getBoolean(ApplicationCacheAgentState::applicationCacheAgentEna bled)) {
65 ErrorString error; 65 ErrorString error;
66 enable(&error); 66 enable(&error);
67 } 67 }
68 } 68 }
69 69
70 void InspectorApplicationCacheAgent::enable(ErrorString*) 70 void InspectorApplicationCacheAgent::enable(ErrorString*)
71 { 71 {
72 m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled , true); 72 m_state->setBoolean(ApplicationCacheAgentState::applicationCacheAgentEnabled , true);
73 m_instrumentingAgents->setInspectorApplicationCacheAgent(this); 73 m_instrumentingAgents->setInspectorApplicationCacheAgent(this);
74 m_frontend->networkStateUpdated(networkStateNotifier().onLine()); 74
75 // We need to pass initial navigator.onOnline.
76 networkStateChanged(networkStateNotifier().onLine());
75 } 77 }
76 78
77 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(LocalFrame* fr ame) 79 void InspectorApplicationCacheAgent::updateApplicationCacheStatus(LocalFrame* fr ame)
78 { 80 {
79 DocumentLoader* documentLoader = frame->loader().documentLoader(); 81 DocumentLoader* documentLoader = frame->loader().documentLoader();
80 if (!documentLoader) 82 if (!documentLoader)
81 return; 83 return;
82 84
83 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); 85 ApplicationCacheHost* host = documentLoader->applicationCacheHost();
84 ApplicationCacheHost::Status status = host->status(); 86 ApplicationCacheHost::Status status = host->status();
85 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); 87 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
86 88
87 String manifestURL = info.m_manifest.string(); 89 String manifestURL = info.m_manifest.string();
88 m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manif estURL, static_cast<int>(status)); 90 m_frontend->applicationCacheStatusUpdated(m_pageAgent->frameId(frame), manif estURL, static_cast<int>(status));
89 } 91 }
90 92
91 void InspectorApplicationCacheAgent::networkStateChanged(LocalFrame* frame, bool online) 93 void InspectorApplicationCacheAgent::networkStateChanged(bool online)
92 { 94 {
93 if (frame == m_pageAgent->inspectedFrame()) 95 m_frontend->networkStateUpdated(online);
94 m_frontend->networkStateUpdated(online);
95 } 96 }
96 97
97 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr <TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result) 98 void InspectorApplicationCacheAgent::getFramesWithManifests(ErrorString*, RefPtr <TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest> >& result)
98 { 99 {
99 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest >::create(); 100 result = TypeBuilder::Array<TypeBuilder::ApplicationCache::FrameWithManifest >::create();
100 101
101 LocalFrame* inspectedFrame = m_pageAgent->inspectedFrame(); 102 LocalFrame* mainFrame = m_pageAgent->mainFrame();
102 for (Frame* frame = inspectedFrame; frame; frame = frame->tree().traverseNex t(inspectedFrame)) { 103 for (Frame* frame = mainFrame; frame; frame = frame->tree().traverseNext(mai nFrame)) {
103 if (!frame->isLocalFrame()) 104 if (!frame->isLocalFrame())
104 continue; 105 continue;
105 DocumentLoader* documentLoader = toLocalFrame(frame)->loader().documentL oader(); 106 DocumentLoader* documentLoader = toLocalFrame(frame)->loader().documentL oader();
106 if (!documentLoader) 107 if (!documentLoader)
107 continue; 108 continue;
108 109
109 ApplicationCacheHost* host = documentLoader->applicationCacheHost(); 110 ApplicationCacheHost* host = documentLoader->applicationCacheHost();
110 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo(); 111 ApplicationCacheHost::CacheInfo info = host->applicationCacheInfo();
111 String manifestURL = info.m_manifest.string(); 112 String manifestURL = info.m_manifest.string();
112 if (!manifestURL.isEmpty()) { 113 if (!manifestURL.isEmpty()) {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 } 203 }
203 204
204 void InspectorApplicationCacheAgent::trace(Visitor* visitor) 205 void InspectorApplicationCacheAgent::trace(Visitor* visitor)
205 { 206 {
206 visitor->trace(m_pageAgent); 207 visitor->trace(m_pageAgent);
207 InspectorBaseAgent::trace(visitor); 208 InspectorBaseAgent::trace(visitor);
208 } 209 }
209 210
210 } // namespace blink 211 } // namespace blink
211 212
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorApplicationCacheAgent.h ('k') | Source/core/inspector/InspectorCanvasAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698