| 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 <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 | 105 |
| 106 void AppLauncherPageUI::HTMLSource::StartDataRequest( | 106 void AppLauncherPageUI::HTMLSource::StartDataRequest( |
| 107 const std::string& path, | 107 const std::string& path, |
| 108 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, | 108 const content::ResourceRequestInfo::WebContentsGetter& wc_getter, |
| 109 const content::URLDataSource::GotDataCallback& callback) { | 109 const content::URLDataSource::GotDataCallback& callback) { |
| 110 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 110 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 111 | 111 |
| 112 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); | 112 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); |
| 113 resource->set_should_show_other_devices_menu(false); | 113 resource->set_should_show_other_devices_menu(false); |
| 114 | 114 |
| 115 content::WebContents* web_contents = wc_getter.Run(); |
| 115 content::RenderProcessHost* render_host = | 116 content::RenderProcessHost* render_host = |
| 116 wc_getter.Run()->GetRenderProcessHost(); | 117 web_contents ? web_contents->GetRenderProcessHost() : nullptr; |
| 117 NTPResourceCache::WindowType win_type = NTPResourceCache::GetWindowType( | 118 NTPResourceCache::WindowType win_type = NTPResourceCache::GetWindowType( |
| 118 profile_, render_host); | 119 profile_, render_host); |
| 119 scoped_refptr<base::RefCountedMemory> html_bytes( | 120 scoped_refptr<base::RefCountedMemory> html_bytes( |
| 120 resource->GetNewTabHTML(win_type)); | 121 resource->GetNewTabHTML(win_type)); |
| 121 | 122 |
| 122 callback.Run(html_bytes.get()); | 123 callback.Run(html_bytes.get()); |
| 123 } | 124 } |
| 124 | 125 |
| 125 std::string AppLauncherPageUI::HTMLSource::GetMimeType( | 126 std::string AppLauncherPageUI::HTMLSource::GetMimeType( |
| 126 const std::string& resource) const { | 127 const std::string& resource) const { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 142 return "style-src 'self' chrome://resources chrome://theme 'unsafe-inline';"; | 143 return "style-src 'self' chrome://resources chrome://theme 'unsafe-inline';"; |
| 143 } | 144 } |
| 144 | 145 |
| 145 std::string AppLauncherPageUI::HTMLSource::GetContentSecurityPolicyImgSrc() | 146 std::string AppLauncherPageUI::HTMLSource::GetContentSecurityPolicyImgSrc() |
| 146 const { | 147 const { |
| 147 return "img-src chrome://extension-icon chrome://theme chrome://resources " | 148 return "img-src chrome://extension-icon chrome://theme chrome://resources " |
| 148 "data:;"; | 149 "data:;"; |
| 149 } | 150 } |
| 150 | 151 |
| 151 AppLauncherPageUI::HTMLSource::~HTMLSource() {} | 152 AppLauncherPageUI::HTMLSource::~HTMLSource() {} |
| OLD | NEW |