| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "content/renderer/manifest/manifest_manager.h" | 5 #include "content/renderer/manifest/manifest_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
| 9 #include "content/common/manifest_manager_messages.h" | 9 #include "content/common/manifest_manager_messages.h" |
| 10 #include "content/public/renderer/document_state.h" |
| 11 #include "content/public/renderer/navigation_state.h" |
| 10 #include "content/public/renderer/render_frame.h" | 12 #include "content/public/renderer/render_frame.h" |
| 11 #include "content/renderer/fetchers/manifest_fetcher.h" | 13 #include "content/renderer/fetchers/manifest_fetcher.h" |
| 12 #include "content/renderer/manifest/manifest_parser.h" | 14 #include "content/renderer/manifest/manifest_parser.h" |
| 13 #include "content/renderer/manifest/manifest_uma_util.h" | 15 #include "content/renderer/manifest/manifest_uma_util.h" |
| 14 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 16 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 15 #include "third_party/WebKit/public/web/WebConsoleMessage.h" | 17 #include "third_party/WebKit/public/web/WebConsoleMessage.h" |
| 16 #include "third_party/WebKit/public/web/WebDocument.h" | 18 #include "third_party/WebKit/public/web/WebDocument.h" |
| 17 #include "third_party/WebKit/public/web/WebLocalFrame.h" | 19 #include "third_party/WebKit/public/web/WebLocalFrame.h" |
| 18 | 20 |
| 19 namespace content { | 21 namespace content { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 | 97 |
| 96 FetchManifest(); | 98 FetchManifest(); |
| 97 } | 99 } |
| 98 | 100 |
| 99 void ManifestManager::DidChangeManifest() { | 101 void ManifestManager::DidChangeManifest() { |
| 100 may_have_manifest_ = true; | 102 may_have_manifest_ = true; |
| 101 manifest_dirty_ = true; | 103 manifest_dirty_ = true; |
| 102 } | 104 } |
| 103 | 105 |
| 104 void ManifestManager::DidCommitProvisionalLoad(bool is_new_navigation) { | 106 void ManifestManager::DidCommitProvisionalLoad(bool is_new_navigation) { |
| 107 NavigationState* navigation_state = DocumentState::FromDataSource( |
| 108 render_frame()->GetWebFrame()->dataSource())->navigation_state(); |
| 109 if (navigation_state->was_within_same_page()) |
| 110 return; |
| 111 |
| 105 may_have_manifest_ = false; | 112 may_have_manifest_ = false; |
| 106 manifest_dirty_ = true; | 113 manifest_dirty_ = true; |
| 107 } | 114 } |
| 108 | 115 |
| 109 void ManifestManager::FetchManifest() { | 116 void ManifestManager::FetchManifest() { |
| 110 GURL url(render_frame()->GetWebFrame()->document().manifestURL()); | 117 GURL url(render_frame()->GetWebFrame()->document().manifestURL()); |
| 111 | 118 |
| 112 if (url.is_empty()) { | 119 if (url.is_empty()) { |
| 113 ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_EMPTY_URL); | 120 ManifestUmaUtil::FetchFailed(ManifestUmaUtil::FETCH_EMPTY_URL); |
| 114 ResolveCallbacks(ResolveStateFailure); | 121 ResolveCallbacks(ResolveStateFailure); |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 | 175 |
| 169 pending_callbacks_.clear(); | 176 pending_callbacks_.clear(); |
| 170 | 177 |
| 171 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); | 178 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); |
| 172 it != callbacks.end(); ++it) { | 179 it != callbacks.end(); ++it) { |
| 173 it->Run(manifest); | 180 it->Run(manifest); |
| 174 } | 181 } |
| 175 } | 182 } |
| 176 | 183 |
| 177 } // namespace content | 184 } // namespace content |
| OLD | NEW |