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

Side by Side Diff: chrome/browser/dom_ui/chrome_url_data_manager.cc

Issue 12418: Implement History as HTML and add/change a bunch of stuff to make it easier t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 12 years 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/chrome_url_data_manager.h ('k') | chrome/browser/dom_ui/dom_ui.h » ('j') | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/dom_ui/chrome_url_data_manager.h" 5 #include "chrome/browser/dom_ui/chrome_url_data_manager.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/string_util.h" 10 #include "base/string_util.h"
11 #include "base/thread.h" 11 #include "base/thread.h"
12 #include "chrome/browser/browser_process.h" 12 #include "chrome/browser/browser_process.h"
13 #include "chrome/common/chrome_paths.h" 13 #include "chrome/common/chrome_paths.h"
14 #include "chrome/common/ref_counted_util.h" 14 #include "chrome/common/ref_counted_util.h"
15 #include "googleurl/src/url_util.h" 15 #include "googleurl/src/url_util.h"
16 #include "net/url_request/url_request.h" 16 #include "net/url_request/url_request.h"
17 #include "net/url_request/url_request_file_job.h" 17 #include "net/url_request/url_request_file_job.h"
18 #include "net/url_request/url_request_job.h" 18 #include "net/url_request/url_request_job.h"
19 #ifdef CHROME_PERSONALIZATION 19 #ifdef CHROME_PERSONALIZATION
20 // TODO(timsteele): Remove all CHROME_PERSONALIZATION code in this file. 20 // TODO(timsteele): Remove all CHROME_PERSONALIZATION code in this file.
21 // It is only temporarily needed to configure some personalization data sources 21 // It is only temporarily needed to configure some personalization data sources
22 // that will go away soon. 22 // that will go away soon.
23 #include "chrome/personalization/personalization.h" 23 #include "chrome/personalization/personalization.h"
24 #endif 24 #endif
25 25
26 // The URL scheme used for internal chrome resources. 26 // The URL scheme used for internal chrome resources.
27 // This URL scheme is never needed by code external to this module. 27 // TODO(glen): Choose a better location for this.
28 static const char kChromeURLScheme[] = "chrome-resource"; 28 static const char kChromeURLScheme[] = "chrome";
29 29
30 // The single global instance of ChromeURLDataManager. 30 // The single global instance of ChromeURLDataManager.
31 ChromeURLDataManager chrome_url_data_manager; 31 ChromeURLDataManager chrome_url_data_manager;
32 32
33 // The ProtocolFactory for creating URLRequestChromeJobs. 33 // The ProtocolFactory for creating URLRequestChromeJobs.
34 static URLRequest::ProtocolFactory Factory; 34 static URLRequest::ProtocolFactory Factory;
35 35
36 // URLRequestChromeJob is a URLRequestJob that manages running chrome-internal 36 // URLRequestChromeJob is a URLRequestJob that manages running chrome-internal
37 // resource requests asynchronously. 37 // resource requests asynchronously.
38 // It hands off URL requests to ChromeURLDataManager, which asynchronously 38 // It hands off URL requests to ChromeURLDataManager, which asynchronously
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 url.SchemeIs(kPersonalizationScheme)); 116 url.SchemeIs(kPersonalizationScheme));
117 #else 117 #else
118 DCHECK(url.SchemeIs(kChromeURLScheme)); 118 DCHECK(url.SchemeIs(kChromeURLScheme));
119 #endif 119 #endif
120 120
121 if (!url.is_valid()) { 121 if (!url.is_valid()) {
122 NOTREACHED(); 122 NOTREACHED();
123 return; 123 return;
124 } 124 }
125 125
126 // Our input looks like: chrome-resource://source_name/extra_bits?foo . 126 // Our input looks like: chrome://source_name/extra_bits?foo .
127 // So the url's "host" is our source, and everything after the host is 127 // So the url's "host" is our source, and everything after the host is
128 // the path. 128 // the path.
129 source_name->assign(url.host()); 129 source_name->assign(url.host());
130 130
131 const std::string& spec = url.possibly_invalid_spec(); 131 const std::string& spec = url.possibly_invalid_spec();
132 const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); 132 const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec();
133 int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false); 133 int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false);
134 ++offset; // Skip the slash at the beginning of the path. 134 ++offset; // Skip the slash at the beginning of the path.
135 if (offset < static_cast<int>(spec.size())) 135 if (offset < static_cast<int>(spec.size()))
136 path->assign(spec.substr(offset)); 136 path->assign(spec.substr(offset));
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 330
331 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, 331 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request,
332 const std::wstring& path) 332 const std::wstring& path)
333 : URLRequestFileJob(request) { 333 : URLRequestFileJob(request) {
334 // set URLRequestFileJob::file_path_ 334 // set URLRequestFileJob::file_path_
335 this->file_path_ = FilePath::FromWStringHack(path); 335 this->file_path_ = FilePath::FromWStringHack(path);
336 } 336 }
337 337
338 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } 338 URLRequestChromeFileJob::~URLRequestChromeFileJob() { }
339 339
OLDNEW
« no previous file with comments | « chrome/browser/dom_ui/chrome_url_data_manager.h ('k') | chrome/browser/dom_ui/dom_ui.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698