OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/dom_ui/new_tab_ui.h" | 7 #include "chrome/browser/dom_ui/new_tab_ui.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 NewTabUI::NewTabHTMLSource::NewTabHTMLSource(Profile* profile) | 613 NewTabUI::NewTabHTMLSource::NewTabHTMLSource(Profile* profile) |
614 : DataSource(chrome::kChromeUINewTabHost, MessageLoop::current()), | 614 : DataSource(chrome::kChromeUINewTabHost, MessageLoop::current()), |
615 profile_(profile) { | 615 profile_(profile) { |
616 } | 616 } |
617 | 617 |
618 void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path, | 618 void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path, |
619 bool is_off_the_record, | 619 bool is_off_the_record, |
620 int request_id) { | 620 int request_id) { |
621 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 621 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
622 | 622 |
623 if (!path.empty() && path[0] != '#') { | 623 if (AppLauncherHandler::HandlePing(path)) { |
| 624 return; |
| 625 } else if (!path.empty() && path[0] != '#') { |
624 // A path under new-tab was requested; it's likely a bad relative | 626 // A path under new-tab was requested; it's likely a bad relative |
625 // URL from the new tab page, but in any case it's an error. | 627 // URL from the new tab page, but in any case it's an error. |
626 NOTREACHED(); | 628 NOTREACHED(); |
627 return; | 629 return; |
628 } | 630 } |
629 | 631 |
630 scoped_refptr<RefCountedBytes> html_bytes( | 632 scoped_refptr<RefCountedBytes> html_bytes( |
631 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record)); | 633 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record)); |
632 | 634 |
633 SendResponse(request_id, html_bytes); | 635 SendResponse(request_id, html_bytes); |
634 } | 636 } |
635 | 637 |
636 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { | 638 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { |
637 return "text/html"; | 639 return "text/html"; |
638 } | 640 } |
OLD | NEW |