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

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

Issue 125052: First draft of web resource service; fetches data from a JSON feed ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fixed typos in a few web resource files.... Created 11 years, 6 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
« no previous file with comments | « chrome/browser/dom_ui/web_resource_handler.cc ('k') | 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) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/browser/web_resource/web_resource_service.h" 4 #include "chrome/browser/web_resource/web_resource_service.h"
5 5
6 #include "base/string_util.h" 6 #include "base/string_util.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/values.h" 8 #include "base/values.h"
9 #include "chrome/browser/browser_process.h" 9 #include "chrome/browser/browser_process.h"
10 #include "chrome/browser/chrome_thread.h" 10 #include "chrome/browser/chrome_thread.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 host->StartWebResourceUnpacker(json_data_); 133 host->StartWebResourceUnpacker(json_data_);
134 } 134 }
135 135
136 scoped_refptr<WebResourceService> web_resource_service_; 136 scoped_refptr<WebResourceService> web_resource_service_;
137 137
138 // Holds raw JSON string. 138 // Holds raw JSON string.
139 const std::string& json_data_; 139 const std::string& json_data_;
140 }; 140 };
141 141
142 const wchar_t* WebResourceService::kDefaultResourceServer = 142 const wchar_t* WebResourceService::kDefaultResourceServer =
143 // L"http://hokiepokie.nyc.corp.google.com:8125/"
144 // L"labs/popgadget/world?view=json";
145 L"http://sites.google.com/a/chromium.org/dev/developers/" 143 L"http://sites.google.com/a/chromium.org/dev/developers/"
146 L"design-documents/web_resources/popgadget_test.json"; 144 L"design-documents/web_resources/popgadget_test.json";
147 145
148 const char* WebResourceService::kResourceDirectoryName = 146 const char* WebResourceService::kResourceDirectoryName =
149 "Resources"; 147 "Resources";
150 148
151 WebResourceService::WebResourceService(Profile* profile, 149 WebResourceService::WebResourceService(Profile* profile,
152 MessageLoop* backend_loop) : 150 MessageLoop* backend_loop) :
153 prefs_(profile->GetPrefs()), 151 prefs_(profile->GetPrefs()),
154 web_resource_dir_(profile->GetPath().AppendASCII(kResourceDirectoryName)), 152 web_resource_dir_(profile->GetPath().AppendASCII(kResourceDirectoryName)),
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 void WebResourceService::UpdateResourceCache(const std::string& json_data) { 257 void WebResourceService::UpdateResourceCache(const std::string& json_data) {
260 UnpackerClient* client = new UnpackerClient(this, json_data); 258 UnpackerClient* client = new UnpackerClient(this, json_data);
261 client->Start(); 259 client->Start();
262 260
263 // Update resource server and cache update time in preferences. 261 // Update resource server and cache update time in preferences.
264 prefs_->SetString(prefs::kNTPWebResourceCacheUpdate, 262 prefs_->SetString(prefs::kNTPWebResourceCacheUpdate,
265 DoubleToWString(base::Time::Now().ToDoubleT())); 263 DoubleToWString(base::Time::Now().ToDoubleT()));
266 prefs_->SetString(prefs::kNTPWebResourceServer, web_resource_server_); 264 prefs_->SetString(prefs::kNTPWebResourceServer, web_resource_server_);
267 } 265 }
268 266
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/web_resource_handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698