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

Side by Side Diff: chrome/browser/web_resource/web_resource_service.cc

Issue 8392001: Fix crasher due to const-ref to non-existing variable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: removed const-ness Created 9 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/web_resource/web_resource_service.h" 5 #include "chrome/browser/web_resource/web_resource_service.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #include "base/string_number_conversions.h" 9 #include "base/string_number_conversions.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 WebResourceUnpacker unpacker(json_data_); 139 WebResourceUnpacker unpacker(json_data_);
140 if (unpacker.Run()) { 140 if (unpacker.Run()) {
141 OnUnpackWebResourceSucceeded(*unpacker.parsed_json()); 141 OnUnpackWebResourceSucceeded(*unpacker.parsed_json());
142 } else { 142 } else {
143 OnUnpackWebResourceFailed(unpacker.error_message()); 143 OnUnpackWebResourceFailed(unpacker.error_message());
144 } 144 }
145 } 145 }
146 } 146 }
147 147
148 private: 148 private:
149 ~UnpackerClient() {} 149 virtual ~UnpackerClient() {}
150 150
151 // UtilityProcessHost::Client 151 // UtilityProcessHost::Client
152 virtual bool OnMessageReceived(const IPC::Message& message) { 152 virtual bool OnMessageReceived(const IPC::Message& message) {
153 bool msg_is_ok = true; 153 bool msg_is_ok = true;
154 bool handled = true; 154 bool handled = true;
155 IPC_BEGIN_MESSAGE_MAP_EX(WebResourceService::UnpackerClient, message, 155 IPC_BEGIN_MESSAGE_MAP_EX(WebResourceService::UnpackerClient, message,
156 msg_is_ok) 156 msg_is_ok)
157 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackWebResource_Succeeded, 157 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackWebResource_Succeeded,
158 OnUnpackWebResourceSucceeded) 158 OnUnpackWebResourceSucceeded)
159 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackWebResource_Failed, 159 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_UnpackWebResource_Failed,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 void StartProcessOnIOThread(BrowserThread::ID thread_id) { 194 void StartProcessOnIOThread(BrowserThread::ID thread_id) {
195 UtilityProcessHost* host = new UtilityProcessHost(this, thread_id); 195 UtilityProcessHost* host = new UtilityProcessHost(this, thread_id);
196 // TODO(mrc): get proper file path when we start using web resources 196 // TODO(mrc): get proper file path when we start using web resources
197 // that need to be unpacked. 197 // that need to be unpacked.
198 host->Send(new ChromeUtilityMsg_UnpackWebResource(json_data_)); 198 host->Send(new ChromeUtilityMsg_UnpackWebResource(json_data_));
199 } 199 }
200 200
201 scoped_refptr<WebResourceService> web_resource_service_; 201 scoped_refptr<WebResourceService> web_resource_service_;
202 202
203 // Holds raw JSON string. 203 // Holds raw JSON string.
204 const std::string& json_data_; 204 std::string json_data_;
205 205
206 // True if we got a response from the utility process and have cleaned up 206 // True if we got a response from the utility process and have cleaned up
207 // already. 207 // already.
208 bool got_response_; 208 bool got_response_;
209 }; 209 };
210 210
211 WebResourceService::WebResourceService( 211 WebResourceService::WebResourceService(
212 PrefService* prefs, 212 PrefService* prefs,
213 const char* web_resource_server, 213 const char* web_resource_server,
214 bool apply_locale_to_url, 214 bool apply_locale_to_url,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 } 293 }
294 294
295 void WebResourceService::UpdateResourceCache(const std::string& json_data) { 295 void WebResourceService::UpdateResourceCache(const std::string& json_data) {
296 UnpackerClient* client = new UnpackerClient(this, json_data); 296 UnpackerClient* client = new UnpackerClient(this, json_data);
297 client->Start(); 297 client->Start();
298 298
299 // Set cache update time in preferences. 299 // Set cache update time in preferences.
300 prefs_->SetString(last_update_time_pref_name_, 300 prefs_->SetString(last_update_time_pref_name_,
301 base::DoubleToString(base::Time::Now().ToDoubleT())); 301 base::DoubleToString(base::Time::Now().ToDoubleT()));
302 } 302 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698