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 "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/webui/metrics_handler.h" | 10 #include "chrome/browser/ui/webui/metrics_handler.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 } | 92 } |
93 | 93 |
94 void AppLauncherPageUI::HTMLSource::StartDataRequest( | 94 void AppLauncherPageUI::HTMLSource::StartDataRequest( |
95 const std::string& path, | 95 const std::string& path, |
96 int render_process_id, | 96 int render_process_id, |
97 int render_frame_id, | 97 int render_frame_id, |
98 const content::URLDataSource::GotDataCallback& callback) { | 98 const content::URLDataSource::GotDataCallback& callback) { |
99 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 99 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
100 | 100 |
101 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); | 101 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); |
102 resource->set_should_show_most_visited_page(false); | |
103 resource->set_should_show_other_devices_menu(false); | 102 resource->set_should_show_other_devices_menu(false); |
104 | 103 |
105 content::RenderProcessHost* render_host = | 104 content::RenderProcessHost* render_host = |
106 content::RenderProcessHost::FromID(render_process_id); | 105 content::RenderProcessHost::FromID(render_process_id); |
107 NTPResourceCache::WindowType win_type = NTPResourceCache::GetWindowType( | 106 NTPResourceCache::WindowType win_type = NTPResourceCache::GetWindowType( |
108 profile_, render_host); | 107 profile_, render_host); |
109 scoped_refptr<base::RefCountedMemory> html_bytes( | 108 scoped_refptr<base::RefCountedMemory> html_bytes( |
110 resource->GetNewTabHTML(win_type)); | 109 resource->GetNewTabHTML(win_type)); |
111 | 110 |
112 callback.Run(html_bytes.get()); | 111 callback.Run(html_bytes.get()); |
113 } | 112 } |
114 | 113 |
115 std::string AppLauncherPageUI::HTMLSource::GetMimeType( | 114 std::string AppLauncherPageUI::HTMLSource::GetMimeType( |
116 const std::string& resource) const { | 115 const std::string& resource) const { |
117 return "text/html"; | 116 return "text/html"; |
118 } | 117 } |
119 | 118 |
120 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { | 119 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { |
121 return false; | 120 return false; |
122 } | 121 } |
123 | 122 |
124 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { | 123 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { |
125 return false; | 124 return false; |
126 } | 125 } |
127 | 126 |
128 AppLauncherPageUI::HTMLSource::~HTMLSource() {} | 127 AppLauncherPageUI::HTMLSource::~HTMLSource() {} |
OLD | NEW |