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" |
11 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | 11 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
12 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" | 12 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
13 #include "chrome/common/url_constants.h" | 13 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/render_process_host.h" | |
15 #include "content/public/browser/web_ui.h" | 16 #include "content/public/browser/web_ui.h" |
16 #include "grit/generated_resources.h" | 17 #include "grit/generated_resources.h" |
17 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
18 #include "ui/base/l10n/l10n_util.h" | 19 #include "ui/base/l10n/l10n_util.h" |
19 #include "ui/base/resource/resource_bundle.h" | 20 #include "ui/base/resource/resource_bundle.h" |
20 | 21 |
21 #if defined(ENABLE_THEMES) | 22 #if defined(ENABLE_THEMES) |
22 #include "chrome/browser/ui/webui/theme_handler.h" | 23 #include "chrome/browser/ui/webui/theme_handler.h" |
23 #endif | 24 #endif |
24 | 25 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
85 AppLauncherPageUI::HTMLSource::HTMLSource(Profile* profile) | 86 AppLauncherPageUI::HTMLSource::HTMLSource(Profile* profile) |
86 : profile_(profile) { | 87 : profile_(profile) { |
87 } | 88 } |
88 | 89 |
89 std::string AppLauncherPageUI::HTMLSource::GetSource() { | 90 std::string AppLauncherPageUI::HTMLSource::GetSource() { |
90 return chrome::kChromeUIAppLauncherPageHost; | 91 return chrome::kChromeUIAppLauncherPageHost; |
91 } | 92 } |
92 | 93 |
93 void AppLauncherPageUI::HTMLSource::StartDataRequest( | 94 void AppLauncherPageUI::HTMLSource::StartDataRequest( |
94 const std::string& path, | 95 const std::string& path, |
95 bool is_incognito, | 96 int render_process_id, |
97 int render_view_id, | |
96 const content::URLDataSource::GotDataCallback& callback) { | 98 const content::URLDataSource::GotDataCallback& callback) { |
97 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 99 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
98 | 100 |
99 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); | 101 NTPResourceCache* resource = AppResourceCacheFactory::GetForProfile(profile_); |
100 resource->set_should_show_most_visited_page(false); | 102 resource->set_should_show_most_visited_page(false); |
101 resource->set_should_show_other_devices_menu(false); | 103 resource->set_should_show_other_devices_menu(false); |
102 resource->set_should_show_recently_closed_menu(false); | 104 resource->set_should_show_recently_closed_menu(false); |
103 | 105 |
106 content::RenderProcessHost* render_host = | |
107 content::RenderProcessHost::FromID(render_process_id); | |
108 DCHECK(render_host != NULL); | |
jam
2013/04/17 00:45:09
nit: remove this, it's redundant. in release build
Jered
2013/04/17 01:03:08
Done.
| |
109 const bool is_incognito = render_host->GetBrowserContext()->IsOffTheRecord(); | |
jam
2013/04/17 00:45:09
personally, i think the const is too much. but thi
Jered
2013/04/17 01:03:08
Removed. I have no strong preference, just habit.
| |
104 scoped_refptr<base::RefCountedMemory> html_bytes( | 110 scoped_refptr<base::RefCountedMemory> html_bytes( |
105 resource->GetNewTabHTML(is_incognito)); | 111 resource->GetNewTabHTML(is_incognito)); |
106 | 112 |
107 callback.Run(html_bytes); | 113 callback.Run(html_bytes); |
108 } | 114 } |
109 | 115 |
110 std::string AppLauncherPageUI::HTMLSource::GetMimeType( | 116 std::string AppLauncherPageUI::HTMLSource::GetMimeType( |
111 const std::string& resource) const { | 117 const std::string& resource) const { |
112 return "text/html"; | 118 return "text/html"; |
113 } | 119 } |
114 | 120 |
115 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { | 121 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { |
116 return false; | 122 return false; |
117 } | 123 } |
118 | 124 |
119 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { | 125 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { |
120 return false; | 126 return false; |
121 } | 127 } |
122 | 128 |
123 AppLauncherPageUI::HTMLSource::~HTMLSource() {} | 129 AppLauncherPageUI::HTMLSource::~HTMLSource() {} |
OLD | NEW |