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 "apps/app_launcher.h" | |
8 #include "apps/metrics_names.h" | |
7 #include "base/memory/ref_counted_memory.h" | 9 #include "base/memory/ref_counted_memory.h" |
10 #include "base/metrics/histogram.h" | |
8 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 12 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
10 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" | 13 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" |
11 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | 14 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
12 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" | 15 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
13 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
14 #include "content/public/browser/browser_thread.h" | 17 #include "content/public/browser/browser_thread.h" |
15 #include "content/public/browser/render_process_host.h" | 18 #include "content/public/browser/render_process_host.h" |
16 #include "content/public/browser/web_ui.h" | 19 #include "content/public/browser/web_ui.h" |
17 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
102 resource->set_should_show_most_visited_page(false); | 105 resource->set_should_show_most_visited_page(false); |
103 resource->set_should_show_other_devices_menu(false); | 106 resource->set_should_show_other_devices_menu(false); |
104 resource->set_should_show_recently_closed_menu(false); | 107 resource->set_should_show_recently_closed_menu(false); |
105 | 108 |
106 content::RenderProcessHost* render_host = | 109 content::RenderProcessHost* render_host = |
107 content::RenderProcessHost::FromID(render_process_id); | 110 content::RenderProcessHost::FromID(render_process_id); |
108 bool is_incognito = render_host->GetBrowserContext()->IsOffTheRecord(); | 111 bool is_incognito = render_host->GetBrowserContext()->IsOffTheRecord(); |
109 scoped_refptr<base::RefCountedMemory> html_bytes( | 112 scoped_refptr<base::RefCountedMemory> html_bytes( |
110 resource->GetNewTabHTML(is_incognito)); | 113 resource->GetNewTabHTML(is_incognito)); |
111 | 114 |
115 if (!is_incognito && apps::ShouldShowAppLauncherPromo()) { | |
116 if (apps::IsAppLauncherEnabled()) { | |
117 UMA_HISTOGRAM_ENUMERATION(apps::kAppLauncherPromoHistogram, | |
118 apps::APP_LAUNCHER_PROMO_ALREADY_INSTALLED, | |
119 apps::APP_LAUNCHER_PROMO_MAX); | |
120 } else { | |
121 UMA_HISTOGRAM_ENUMERATION(apps::kAppLauncherPromoHistogram, | |
122 apps::APP_LAUNCHER_PROMO_SHOWN, | |
123 apps::APP_LAUNCHER_PROMO_MAX); | |
124 } | |
125 } | |
126 | |
miket_OOO
2013/06/25 15:57:25
Extra whitespace not needed.
MAD
2013/06/26 03:33:40
Done.
| |
127 | |
112 callback.Run(html_bytes.get()); | 128 callback.Run(html_bytes.get()); |
113 } | 129 } |
114 | 130 |
115 std::string AppLauncherPageUI::HTMLSource::GetMimeType( | 131 std::string AppLauncherPageUI::HTMLSource::GetMimeType( |
116 const std::string& resource) const { | 132 const std::string& resource) const { |
117 return "text/html"; | 133 return "text/html"; |
118 } | 134 } |
119 | 135 |
120 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { | 136 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { |
121 return false; | 137 return false; |
122 } | 138 } |
123 | 139 |
124 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { | 140 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { |
125 return false; | 141 return false; |
126 } | 142 } |
127 | 143 |
128 AppLauncherPageUI::HTMLSource::~HTMLSource() {} | 144 AppLauncherPageUI::HTMLSource::~HTMLSource() {} |
OLD | NEW |