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

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

Issue 101026: Change chrome-ui to chrome. I didn't go too far in converting existing string... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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/debugger/devtools_view.cc ('k') | chrome/browser/dom_ui/downloads_ui.cc » ('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"
(...skipping 12 matching lines...) Expand all
23 // TODO(timsteele): Remove all CHROME_PERSONALIZATION code in this file. 23 // TODO(timsteele): Remove all CHROME_PERSONALIZATION code in this file.
24 // It is only temporarily needed to configure some personalization data sources 24 // It is only temporarily needed to configure some personalization data sources
25 // that will go away soon. 25 // that will go away soon.
26 #include "chrome/personalization/personalization.h" 26 #include "chrome/personalization/personalization.h"
27 #endif 27 #endif
28 28
29 #include "grit/locale_settings.h" 29 #include "grit/locale_settings.h"
30 30
31 // The URL scheme used for internal chrome resources. 31 // The URL scheme used for internal chrome resources.
32 // TODO(glen): Choose a better location for this. 32 // TODO(glen): Choose a better location for this.
33 static const char kChromeURLScheme[] = "chrome-ui"; 33 static const char kChromeURLScheme[] = "chrome";
34 34
35 // The single global instance of ChromeURLDataManager. 35 // The single global instance of ChromeURLDataManager.
36 ChromeURLDataManager chrome_url_data_manager; 36 ChromeURLDataManager chrome_url_data_manager;
37 37
38 // URLRequestChromeJob is a URLRequestJob that manages running chrome-internal 38 // URLRequestChromeJob is a URLRequestJob that manages running chrome-internal
39 // resource requests asynchronously. 39 // resource requests asynchronously.
40 // It hands off URL requests to ChromeURLDataManager, which asynchronously 40 // It hands off URL requests to ChromeURLDataManager, which asynchronously
41 // calls back once the data is available. 41 // calls back once the data is available.
42 class URLRequestChromeJob : public URLRequestJob { 42 class URLRequestChromeJob : public URLRequestJob {
43 public: 43 public:
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 url_parse::Component url_scheme_component(0, arraysize(kChromeURLScheme) - 1); 98 url_parse::Component url_scheme_component(0, arraysize(kChromeURLScheme) - 1);
99 if (!url_util::IsStandard(kChromeURLScheme, arraysize(kChromeURLScheme) - 1, 99 if (!url_util::IsStandard(kChromeURLScheme, arraysize(kChromeURLScheme) - 1,
100 url_scheme_component)) { 100 url_scheme_component)) {
101 url_util::AddStandardScheme(kChromeURLScheme); 101 url_util::AddStandardScheme(kChromeURLScheme);
102 } 102 }
103 103
104 std::wstring inspector_dir; 104 std::wstring inspector_dir;
105 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) { 105 if (PathService::Get(chrome::DIR_INSPECTOR, &inspector_dir)) {
106 // TODO(yurys): remove "inspector" source when new developer tools support 106 // TODO(yurys): remove "inspector" source when new developer tools support
107 // all features of in-process Web Inspector and Console Debugger. For the 107 // all features of in-process Web Inspector and Console Debugger. For the
108 // time being we need to serve the same content from chrome-ui://inspector 108 // time being we need to serve the same content from chrome://inspector
109 // for the Console Debugger and in-process Web Inspector. 109 // for the Console Debugger and in-process Web Inspector.
110 chrome_url_data_manager.AddFileSource("inspector", inspector_dir); 110 chrome_url_data_manager.AddFileSource("inspector", inspector_dir);
111 chrome_url_data_manager.AddFileSource(chrome::kChromeUIDevToolsHost, 111 chrome_url_data_manager.AddFileSource(chrome::kChromeUIDevToolsHost,
112 inspector_dir); 112 inspector_dir);
113 } 113 }
114 114
115 URLRequest::RegisterProtocolFactory(kChromeURLScheme, 115 URLRequest::RegisterProtocolFactory(kChromeURLScheme,
116 &ChromeURLDataManager::Factory); 116 &ChromeURLDataManager::Factory);
117 #ifdef CHROME_PERSONALIZATION 117 #ifdef CHROME_PERSONALIZATION
118 url_util::AddStandardScheme(kPersonalizationScheme); 118 url_util::AddStandardScheme(kPersonalizationScheme);
(...skipping 19 matching lines...) Expand all
138 url.SchemeIs(kPersonalizationScheme)); 138 url.SchemeIs(kPersonalizationScheme));
139 #else 139 #else
140 DCHECK(url.SchemeIs(kChromeURLScheme)); 140 DCHECK(url.SchemeIs(kChromeURLScheme));
141 #endif 141 #endif
142 142
143 if (!url.is_valid()) { 143 if (!url.is_valid()) {
144 NOTREACHED(); 144 NOTREACHED();
145 return; 145 return;
146 } 146 }
147 147
148 // Our input looks like: chrome-ui://source_name/extra_bits?foo . 148 // Our input looks like: chrome://source_name/extra_bits?foo .
149 // So the url's "host" is our source, and everything after the host is 149 // So the url's "host" is our source, and everything after the host is
150 // the path. 150 // the path.
151 source_name->assign(url.host()); 151 source_name->assign(url.host());
152 152
153 const std::string& spec = url.possibly_invalid_spec(); 153 const std::string& spec = url.possibly_invalid_spec();
154 const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec(); 154 const url_parse::Parsed& parsed = url.parsed_for_possibly_invalid_spec();
155 int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false); 155 int offset = parsed.CountCharactersBefore(url_parse::Parsed::PATH, false);
156 ++offset; // Skip the slash at the beginning of the path. 156 ++offset; // Skip the slash at the beginning of the path.
157 if (offset < static_cast<int>(spec.size())) 157 if (offset < static_cast<int>(spec.size()))
158 path->assign(spec.substr(offset)); 158 path->assign(spec.substr(offset));
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 net::ERR_INVALID_URL)); 366 net::ERR_INVALID_URL));
367 } 367 }
368 } 368 }
369 369
370 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request, 370 URLRequestChromeFileJob::URLRequestChromeFileJob(URLRequest* request,
371 const FilePath& path) 371 const FilePath& path)
372 : URLRequestFileJob(request, path) { 372 : URLRequestFileJob(request, path) {
373 } 373 }
374 374
375 URLRequestChromeFileJob::~URLRequestChromeFileJob() { } 375 URLRequestChromeFileJob::~URLRequestChromeFileJob() { }
OLDNEW
« no previous file with comments | « chrome/browser/debugger/devtools_view.cc ('k') | chrome/browser/dom_ui/downloads_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698