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" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
12 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" | 12 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" |
13 #include "chrome/browser/ui/webui/metrics_handler.h" | 13 #include "chrome/browser/ui/webui/metrics_handler.h" |
14 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 14 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
15 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" | 15 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" |
16 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" | 16 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" |
17 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" | |
18 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" | 17 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
19 #include "chrome/browser/ui/webui/theme_handler.h" | 18 #include "chrome/browser/ui/webui/theme_handler.h" |
20 #include "chrome/common/url_constants.h" | 19 #include "chrome/common/url_constants.h" |
21 #include "chrome/grit/generated_resources.h" | 20 #include "chrome/grit/generated_resources.h" |
22 #include "chrome/grit/theme_resources.h" | 21 #include "chrome/grit/theme_resources.h" |
23 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
24 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
25 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
26 #include "content/public/browser/web_ui.h" | 25 #include "content/public/browser/web_ui.h" |
27 #include "extensions/browser/extension_system.h" | 26 #include "extensions/browser/extension_system.h" |
(...skipping 11 matching lines...) Expand all Loading... |
39 : content::WebUIController(web_ui) { | 38 : content::WebUIController(web_ui) { |
40 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_APP_LAUNCHER_TAB_TITLE)); | 39 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_APP_LAUNCHER_TAB_TITLE)); |
41 | 40 |
42 if (!GetProfile()->IsOffTheRecord()) { | 41 if (!GetProfile()->IsOffTheRecord()) { |
43 ExtensionService* service = | 42 ExtensionService* service = |
44 extensions::ExtensionSystem::Get(GetProfile())->extension_service(); | 43 extensions::ExtensionSystem::Get(GetProfile())->extension_service(); |
45 // We should not be launched without an ExtensionService. | 44 // We should not be launched without an ExtensionService. |
46 DCHECK(service); | 45 DCHECK(service); |
47 web_ui->AddMessageHandler(new AppLauncherHandler(service)); | 46 web_ui->AddMessageHandler(new AppLauncherHandler(service)); |
48 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); | 47 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); |
49 web_ui->AddMessageHandler(new FaviconWebUIHandler()); | |
50 web_ui->AddMessageHandler(new MetricsHandler()); | 48 web_ui->AddMessageHandler(new MetricsHandler()); |
51 } | 49 } |
52 | 50 |
53 // The theme handler can require some CPU, so do it after hooking up the most | 51 // The theme handler can require some CPU, so do it after hooking up the most |
54 // visited handler. This allows the DB query for the new tab thumbs to happen | 52 // visited handler. This allows the DB query for the new tab thumbs to happen |
55 // earlier. | 53 // earlier. |
56 web_ui->AddMessageHandler(new ThemeHandler()); | 54 web_ui->AddMessageHandler(new ThemeHandler()); |
57 | 55 |
58 std::unique_ptr<HTMLSource> html_source( | 56 std::unique_ptr<HTMLSource> html_source( |
59 new HTMLSource(GetProfile()->GetOriginalProfile())); | 57 new HTMLSource(GetProfile()->GetOriginalProfile())); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 return "style-src 'self' chrome://resources chrome://theme 'unsafe-inline';"; | 136 return "style-src 'self' chrome://resources chrome://theme 'unsafe-inline';"; |
139 } | 137 } |
140 | 138 |
141 std::string AppLauncherPageUI::HTMLSource::GetContentSecurityPolicyImgSrc() | 139 std::string AppLauncherPageUI::HTMLSource::GetContentSecurityPolicyImgSrc() |
142 const { | 140 const { |
143 return "img-src chrome://extension-icon chrome://theme chrome://resources " | 141 return "img-src chrome://extension-icon chrome://theme chrome://resources " |
144 "data:;"; | 142 "data:;"; |
145 } | 143 } |
146 | 144 |
147 AppLauncherPageUI::HTMLSource::~HTMLSource() {} | 145 AppLauncherPageUI::HTMLSource::~HTMLSource() {} |
OLD | NEW |