| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/ui/webui/app_launcher_page_ui.h" | 5 #include "chrome/browser/ui/webui/app_launcher_page_ui.h" |
| 6 | 6 |
| 7 #include "base/memory/ref_counted_memory.h" | 7 #include "base/memory/ref_counted_memory.h" |
| 8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
| 9 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 9 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 10 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" | 10 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 AppLauncherPageUI::HTMLSource::HTMLSource(Profile* profile) | 85 AppLauncherPageUI::HTMLSource::HTMLSource(Profile* profile) |
| 86 : profile_(profile) { | 86 : profile_(profile) { |
| 87 } | 87 } |
| 88 | 88 |
| 89 std::string AppLauncherPageUI::HTMLSource::GetSource() { | 89 std::string AppLauncherPageUI::HTMLSource::GetSource() { |
| 90 return chrome::kChromeUIAppLauncherPageHost; | 90 return chrome::kChromeUIAppLauncherPageHost; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void AppLauncherPageUI::HTMLSource::StartDataRequest( | 93 void AppLauncherPageUI::HTMLSource::StartDataRequest( |
| 94 const std::string& path, | 94 const std::string& path, |
| 95 bool is_incognito, | 95 const content::URLDataSource::ExtraRequestInfo& info, |
| 96 const content::URLDataSource::GotDataCallback& callback) { | 96 const content::URLDataSource::GotDataCallback& callback) { |
| 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 98 | 98 |
| 99 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); | 99 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); |
| 100 resource->set_should_show_most_visited_page(false); | 100 resource->set_should_show_most_visited_page(false); |
| 101 resource->set_should_show_other_devices_menu(false); | 101 resource->set_should_show_other_devices_menu(false); |
| 102 resource->set_should_show_recently_closed_menu(false); | 102 resource->set_should_show_recently_closed_menu(false); |
| 103 | 103 |
| 104 scoped_refptr<base::RefCountedMemory> html_bytes( | 104 scoped_refptr<base::RefCountedMemory> html_bytes( |
| 105 resource->GetNewTabHTML(is_incognito)); | 105 resource->GetNewTabHTML(info.is_incognito)); |
| 106 | 106 |
| 107 callback.Run(html_bytes); | 107 callback.Run(html_bytes); |
| 108 } | 108 } |
| 109 | 109 |
| 110 std::string AppLauncherPageUI::HTMLSource::GetMimeType( | 110 std::string AppLauncherPageUI::HTMLSource::GetMimeType( |
| 111 const std::string& resource) const { | 111 const std::string& resource) const { |
| 112 return "text/html"; | 112 return "text/html"; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { | 115 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { |
| 116 return false; | 116 return false; |
| 117 } | 117 } |
| 118 | 118 |
| 119 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { | 119 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { |
| 120 return false; | 120 return false; |
| 121 } | 121 } |
| 122 | 122 |
| 123 AppLauncherPageUI::HTMLSource::~HTMLSource() {} | 123 AppLauncherPageUI::HTMLSource::~HTMLSource() {} |
| OLD | NEW |