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

Side by Side Diff: content/renderer/manifest/manifest_manager.cc

Issue 577673004: Add support for 'start_url' in Manifest. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@manifest_manager_content
Patch Set: oups Created 6 years, 3 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
OLDNEW
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/render_frame.h" 10 #include "content/public/renderer/render_frame.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 ResolveCallbacks(ResolveStateFailure); 96 ResolveCallbacks(ResolveStateFailure);
97 return; 97 return;
98 } 98 }
99 99
100 fetcher_.reset(new ManifestFetcher(url)); 100 fetcher_.reset(new ManifestFetcher(url));
101 101
102 // TODO(mlamouri,kenneth): this is not yet taking into account manifest-src 102 // TODO(mlamouri,kenneth): this is not yet taking into account manifest-src
103 // CSP rule, see http://crbug.com/409996. 103 // CSP rule, see http://crbug.com/409996.
104 fetcher_->Start(render_frame()->GetWebFrame(), 104 fetcher_->Start(render_frame()->GetWebFrame(),
105 base::Bind(&ManifestManager::OnManifestFetchComplete, 105 base::Bind(&ManifestManager::OnManifestFetchComplete,
106 base::Unretained(this))); 106 base::Unretained(this),
107 render_frame()->GetWebFrame()->document().url()));
107 } 108 }
108 109
109 void ManifestManager::OnManifestFetchComplete( 110 void ManifestManager::OnManifestFetchComplete(
111 const GURL& document_url,
110 const blink::WebURLResponse& response, 112 const blink::WebURLResponse& response,
111 const std::string& data) { 113 const std::string& data) {
112 if (response.isNull() && data.empty()) { 114 if (response.isNull() && data.empty()) {
113 ResolveCallbacks(ResolveStateFailure); 115 ResolveCallbacks(ResolveStateFailure);
114 return; 116 return;
115 } 117 }
116 118
117 manifest_ = ManifestParser::Parse(data); 119 manifest_ = ManifestParser::Parse(data, response.url(), document_url);
118 120
119 fetcher_.reset(); 121 fetcher_.reset();
120 ResolveCallbacks(ResolveStateSuccess); 122 ResolveCallbacks(ResolveStateSuccess);
121 } 123 }
122 124
123 void ManifestManager::ResolveCallbacks(ResolveState state) { 125 void ManifestManager::ResolveCallbacks(ResolveState state) {
124 if (state == ResolveStateFailure) 126 if (state == ResolveStateFailure)
125 manifest_ = Manifest(); 127 manifest_ = Manifest();
126 128
127 manifest_dirty_ = state != ResolveStateSuccess; 129 manifest_dirty_ = state != ResolveStateSuccess;
128 130
129 Manifest manifest = manifest_; 131 Manifest manifest = manifest_;
130 std::list<GetManifestCallback> callbacks = pending_callbacks_; 132 std::list<GetManifestCallback> callbacks = pending_callbacks_;
131 133
132 pending_callbacks_.clear(); 134 pending_callbacks_.clear();
133 135
134 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin(); 136 for (std::list<GetManifestCallback>::const_iterator it = callbacks.begin();
135 it != callbacks.end(); ++it) { 137 it != callbacks.end(); ++it) {
136 it->Run(manifest); 138 it->Run(manifest);
137 } 139 }
138 } 140 }
139 141
140 } // namespace content 142 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/manifest/manifest_manager.h ('k') | content/renderer/manifest/manifest_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698