summaryrefslogtreecommitdiffstats
path: root/chrome/browser
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 20:19:25 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-04-09 20:19:25 +0000
commit8f24f0d6752f811905c182a85181f456c7656817 (patch)
treec798391dae7df771665bfc8d268053b317220940 /chrome/browser
parent1351b6a03c4bd8b19b36a39afb37b0f34d34708f (diff)
downloadchromium_src-8f24f0d6752f811905c182a85181f456c7656817.zip
chromium_src-8f24f0d6752f811905c182a85181f456c7656817.tar.gz
chromium_src-8f24f0d6752f811905c182a85181f456c7656817.tar.bz2
Fix empty title for worker process host when running the worker from a url without domain.
Review URL: http://codereview.chromium.org/63147 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13451 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r--chrome/browser/worker_host/worker_process_host.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/chrome/browser/worker_host/worker_process_host.cc b/chrome/browser/worker_host/worker_process_host.cc
index 88b4a23..4bb11ae 100644
--- a/chrome/browser/worker_host/worker_process_host.cc
+++ b/chrome/browser/worker_host/worker_process_host.cc
@@ -147,19 +147,26 @@ void WorkerProcessHost::RendererShutdown(ResourceMessageFilter* filter) {
}
void WorkerProcessHost::UpdateTitle() {
- std::set<std::string> worker_domains;
+ std::set<std::string> titles;
for (Instances::iterator i = instances_.begin(); i != instances_.end(); ++i) {
- worker_domains.insert(
- net::RegistryControlledDomainService::GetDomainAndRegistry(i->url));
+ std::string title =
+ net::RegistryControlledDomainService::GetDomainAndRegistry(i->url);
+ // Use the host name if the domain is empty, i.e. localhost or IP address.
+ if (title.empty())
+ title = i->url.host();
+ // If the host name is empty, i.e. file url, use the path.
+ if (title.empty())
+ title = i->url.path();
+ titles.insert(title);
}
- std::string title;
- for (std::set<std::string>::iterator i = worker_domains.begin();
- i != worker_domains.end(); ++i) {
- if (!title.empty())
- title += ", ";
- title += *i;
+ std::string display_title;
+ for (std::set<std::string>::iterator i = titles.begin();
+ i != titles.end(); ++i) {
+ if (!display_title.empty())
+ display_title += ", ";
+ display_title += *i;
}
- set_name(ASCIIToWide(title));
+ set_name(ASCIIToWide(display_title));
}