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 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 NewTabUI::NewTabHTMLSource::NewTabHTMLSource(Profile* profile) | 598 NewTabUI::NewTabHTMLSource::NewTabHTMLSource(Profile* profile) |
599 : DataSource(chrome::kChromeUINewTabHost, MessageLoop::current()), | 599 : DataSource(chrome::kChromeUINewTabHost, MessageLoop::current()), |
600 profile_(profile) { | 600 profile_(profile) { |
601 } | 601 } |
602 | 602 |
603 void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path, | 603 void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path, |
604 bool is_off_the_record, | 604 bool is_off_the_record, |
605 int request_id) { | 605 int request_id) { |
606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 606 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
607 | 607 |
608 if (AppLauncherHandler::HandlePing(path)) { | 608 if (AppLauncherHandler::HandlePing(profile_, path)) { |
609 return; | 609 return; |
610 } else if (!path.empty() && path[0] != '#') { | 610 } else if (!path.empty() && path[0] != '#') { |
611 // A path under new-tab was requested; it's likely a bad relative | 611 // A path under new-tab was requested; it's likely a bad relative |
612 // URL from the new tab page, but in any case it's an error. | 612 // URL from the new tab page, but in any case it's an error. |
613 NOTREACHED(); | 613 NOTREACHED(); |
614 return; | 614 return; |
615 } | 615 } |
616 | 616 |
617 scoped_refptr<RefCountedBytes> html_bytes( | 617 scoped_refptr<RefCountedBytes> html_bytes( |
618 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record)); | 618 profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record)); |
619 | 619 |
620 SendResponse(request_id, html_bytes); | 620 SendResponse(request_id, html_bytes); |
621 } | 621 } |
622 | 622 |
623 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { | 623 std::string NewTabUI::NewTabHTMLSource::GetMimeType(const std::string&) const { |
624 return "text/html"; | 624 return "text/html"; |
625 } | 625 } |
OLD | NEW |