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/app_launcher_login_handler.h" |
10 #include "chrome/browser/ui/webui/metrics_handler.h" | 11 #include "chrome/browser/ui/webui/metrics_handler.h" |
11 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 12 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
12 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" | 13 #include "chrome/browser/ui/webui/ntp/app_resource_cache_factory.h" |
13 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" | 14 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" |
14 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" | 15 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" |
15 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | |
16 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" | 16 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" |
17 #include "chrome/common/url_constants.h" | 17 #include "chrome/common/url_constants.h" |
18 #include "chrome/grit/generated_resources.h" | 18 #include "chrome/grit/generated_resources.h" |
19 #include "content/public/browser/browser_thread.h" | 19 #include "content/public/browser/browser_thread.h" |
20 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
21 #include "content/public/browser/web_ui.h" | 21 #include "content/public/browser/web_ui.h" |
22 #include "extensions/browser/extension_system.h" | 22 #include "extensions/browser/extension_system.h" |
23 #include "grit/theme_resources.h" | 23 #include "grit/theme_resources.h" |
24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
26 | 26 |
27 #if defined(ENABLE_THEMES) | 27 #if defined(ENABLE_THEMES) |
28 #include "chrome/browser/ui/webui/theme_handler.h" | 28 #include "chrome/browser/ui/webui/theme_handler.h" |
29 #endif | 29 #endif |
30 | 30 |
31 class ExtensionService; | 31 class ExtensionService; |
32 | 32 |
33 using content::BrowserThread; | 33 using content::BrowserThread; |
34 | 34 |
35 /////////////////////////////////////////////////////////////////////////////// | 35 /////////////////////////////////////////////////////////////////////////////// |
36 // AppLauncherPageUI | 36 // AppLauncherPageUI |
37 | 37 |
38 AppLauncherPageUI::AppLauncherPageUI(content::WebUI* web_ui) | 38 AppLauncherPageUI::AppLauncherPageUI(content::WebUI* web_ui) |
39 : content::WebUIController(web_ui) { | 39 : content::WebUIController(web_ui) { |
40 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_APP_LAUNCHER_TAB_TITLE)); | 40 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_APP_LAUNCHER_TAB_TITLE)); |
41 | 41 |
42 if (NTPLoginHandler::ShouldShow(GetProfile())) | 42 if (AppLauncherLoginHandler::ShouldShow(GetProfile())) |
43 web_ui->AddMessageHandler(new NTPLoginHandler()); | 43 web_ui->AddMessageHandler(new AppLauncherLoginHandler()); |
44 | 44 |
45 if (!GetProfile()->IsOffTheRecord()) { | 45 if (!GetProfile()->IsOffTheRecord()) { |
46 ExtensionService* service = | 46 ExtensionService* service = |
47 extensions::ExtensionSystem::Get(GetProfile())->extension_service(); | 47 extensions::ExtensionSystem::Get(GetProfile())->extension_service(); |
48 // We should not be launched without an ExtensionService. | 48 // We should not be launched without an ExtensionService. |
49 DCHECK(service); | 49 DCHECK(service); |
50 web_ui->AddMessageHandler(new AppLauncherHandler(service)); | 50 web_ui->AddMessageHandler(new AppLauncherHandler(service)); |
51 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); | 51 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); |
52 web_ui->AddMessageHandler(new FaviconWebUIHandler()); | 52 web_ui->AddMessageHandler(new FaviconWebUIHandler()); |
53 web_ui->AddMessageHandler(new MetricsHandler()); | 53 web_ui->AddMessageHandler(new MetricsHandler()); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 119 |
120 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { | 120 bool AppLauncherPageUI::HTMLSource::ShouldReplaceExistingSource() const { |
121 return false; | 121 return false; |
122 } | 122 } |
123 | 123 |
124 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { | 124 bool AppLauncherPageUI::HTMLSource::ShouldAddContentSecurityPolicy() const { |
125 return false; | 125 return false; |
126 } | 126 } |
127 | 127 |
128 AppLauncherPageUI::HTMLSource::~HTMLSource() {} | 128 AppLauncherPageUI::HTMLSource::~HTMLSource() {} |
OLD | NEW |