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

Side by Side Diff: chrome/browser/webui/chrome_url_data_manager_backend.cc

Issue 6546078: Makes a handful of DataSources not replace the existing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 // 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/webui/chrome_url_data_manager_backend.h" 5 #include "chrome/browser/webui/chrome_url_data_manager_backend.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/ref_counted_memory.h" 10 #include "base/ref_counted_memory.h"
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 &ChromeURLDataManagerBackend::Factory); 171 &ChromeURLDataManagerBackend::Factory);
172 net::URLRequest::RegisterProtocolFactory( 172 net::URLRequest::RegisterProtocolFactory(
173 chrome::kChromeUIScheme, 173 chrome::kChromeUIScheme,
174 &ChromeURLDataManagerBackend::Factory); 174 &ChromeURLDataManagerBackend::Factory);
175 } 175 }
176 176
177 void ChromeURLDataManagerBackend::AddDataSource( 177 void ChromeURLDataManagerBackend::AddDataSource(
178 ChromeURLDataManager::DataSource* source) { 178 ChromeURLDataManager::DataSource* source) {
179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); 179 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
180 DataSourceMap::iterator i = data_sources_.find(source->source_name()); 180 DataSourceMap::iterator i = data_sources_.find(source->source_name());
181 if (i != data_sources_.end()) 181 if (i != data_sources_.end()) {
182 if (!source->ShouldReplaceExistingSource())
183 return;
182 i->second->backend_ = NULL; 184 i->second->backend_ = NULL;
185 }
183 data_sources_[source->source_name()] = source; 186 data_sources_[source->source_name()] = source;
184 source->backend_ = this; 187 source->backend_ = this;
185 } 188 }
186 189
187 void ChromeURLDataManagerBackend::AddFileSource(const std::string& source_name, 190 void ChromeURLDataManagerBackend::AddFileSource(const std::string& source_name,
188 const FilePath& file_path) { 191 const FilePath& file_path) {
189 DCHECK(file_sources_.count(source_name) == 0); 192 DCHECK(file_sources_.count(source_name) == 0);
190 file_sources_[source_name] = file_path; 193 file_sources_[source_name] = file_path;
191 } 194 }
192 195
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 net::ERR_INVALID_URL)); 387 net::ERR_INVALID_URL));
385 } 388 }
386 } 389 }
387 390
388 URLRequestChromeFileJob::URLRequestChromeFileJob(net::URLRequest* request, 391 URLRequestChromeFileJob::URLRequestChromeFileJob(net::URLRequest* request,
389 const FilePath& path) 392 const FilePath& path)
390 : net::URLRequestFileJob(request, path) { 393 : net::URLRequestFileJob(request, path) {
391 } 394 }
392 395
393 URLRequestChromeFileJob::~URLRequestChromeFileJob() {} 396 URLRequestChromeFileJob::~URLRequestChromeFileJob() {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698