OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ntp/new_tab_ui.h" | 5 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chrome/browser/ui/webui/metrics_handler.h" | 14 #include "chrome/browser/ui/webui/metrics_handler.h" |
15 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 15 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.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/ntp/ntp_resource_cache_factory.h" | 18 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" |
20 #include "chrome/browser/ui/webui/theme_handler.h" | 19 #include "chrome/browser/ui/webui/theme_handler.h" |
21 #include "chrome/common/url_constants.h" | 20 #include "chrome/common/url_constants.h" |
22 #include "components/bookmarks/common/bookmark_pref_names.h" | 21 #include "components/bookmarks/common/bookmark_pref_names.h" |
23 #include "components/prefs/pref_service.h" | 22 #include "components/prefs/pref_service.h" |
24 #include "components/strings/grit/components_strings.h" | 23 #include "components/strings/grit/components_strings.h" |
25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/render_process_host.h" | 25 #include "content/public/browser/render_process_host.h" |
27 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
(...skipping 25 matching lines...) Expand all Loading... |
53 /////////////////////////////////////////////////////////////////////////////// | 52 /////////////////////////////////////////////////////////////////////////////// |
54 // NewTabUI | 53 // NewTabUI |
55 | 54 |
56 NewTabUI::NewTabUI(content::WebUI* web_ui) | 55 NewTabUI::NewTabUI(content::WebUI* web_ui) |
57 : WebUIController(web_ui) { | 56 : WebUIController(web_ui) { |
58 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 57 web_ui->OverrideTitle(l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
59 | 58 |
60 Profile* profile = GetProfile(); | 59 Profile* profile = GetProfile(); |
61 if (!profile->IsOffTheRecord()) { | 60 if (!profile->IsOffTheRecord()) { |
62 web_ui->AddMessageHandler(new MetricsHandler()); | 61 web_ui->AddMessageHandler(new MetricsHandler()); |
63 web_ui->AddMessageHandler(new FaviconWebUIHandler()); | |
64 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); | 62 web_ui->AddMessageHandler(new CoreAppLauncherHandler()); |
65 | 63 |
66 ExtensionService* service = | 64 ExtensionService* service = |
67 extensions::ExtensionSystem::Get(profile)->extension_service(); | 65 extensions::ExtensionSystem::Get(profile)->extension_service(); |
68 // We might not have an ExtensionService (on ChromeOS when not logged in | 66 // We might not have an ExtensionService (on ChromeOS when not logged in |
69 // for example). | 67 // for example). |
70 if (service) | 68 if (service) |
71 web_ui->AddMessageHandler(new AppLauncherHandler(service)); | 69 web_ui->AddMessageHandler(new AppLauncherHandler(service)); |
72 } | 70 } |
73 | 71 |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 249 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
252 const char* mime_type, | 250 const char* mime_type, |
253 int resource_id) { | 251 int resource_id) { |
254 DCHECK(resource); | 252 DCHECK(resource); |
255 DCHECK(mime_type); | 253 DCHECK(mime_type); |
256 resource_map_[std::string(resource)] = | 254 resource_map_[std::string(resource)] = |
257 std::make_pair(std::string(mime_type), resource_id); | 255 std::make_pair(std::string(mime_type), resource_id); |
258 } | 256 } |
259 | 257 |
260 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} | 258 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} |
OLD | NEW |