Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: chrome/browser/ui/webui/ntp/new_tab_ui.cc

Issue 1143963002: Split NTPLoginHandler across chrome://apps and chrome://history. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp fixes Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/browser/ui/webui/ntp/ntp_login_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <set> 7 #include <set>
8 8
9 #include "base/i18n/rtl.h" 9 #include "base/i18n/rtl.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/metrics/histogram.h" 12 #include "base/metrics/histogram.h"
13 #include "base/prefs/pref_service.h" 13 #include "base/prefs/pref_service.h"
14 #include "base/strings/utf_string_conversions.h" 14 #include "base/strings/utf_string_conversions.h"
15 #include "chrome/browser/chrome_notification_types.h" 15 #include "chrome/browser/chrome_notification_types.h"
16 #include "chrome/browser/profiles/profile.h" 16 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/webui/metrics_handler.h" 17 #include "chrome/browser/ui/webui/metrics_handler.h"
18 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" 18 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h"
19 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h" 19 #include "chrome/browser/ui/webui/ntp/core_app_launcher_handler.h"
20 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h" 20 #include "chrome/browser/ui/webui/ntp/favicon_webui_handler.h"
21 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h" 21 #include "chrome/browser/ui/webui/ntp/most_visited_handler.h"
22 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" 22 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h"
23 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" 23 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h"
24 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h"
25 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" 24 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
26 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h" 25 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache_factory.h"
27 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h" 26 #include "chrome/browser/ui/webui/ntp/ntp_user_data_logger.h"
28 #include "chrome/common/pref_names.h" 27 #include "chrome/common/pref_names.h"
29 #include "chrome/common/url_constants.h" 28 #include "chrome/common/url_constants.h"
30 #include "chrome/grit/generated_resources.h" 29 #include "chrome/grit/generated_resources.h"
31 #include "components/pref_registry/pref_registry_syncable.h" 30 #include "components/pref_registry/pref_registry_syncable.h"
32 #include "content/public/browser/browser_thread.h" 31 #include "content/public/browser/browser_thread.h"
33 #include "content/public/browser/notification_service.h" 32 #include "content/public/browser/notification_service.h"
34 #include "content/public/browser/render_process_host.h" 33 #include "content/public/browser/render_process_host.h"
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 web_ui->AddMessageHandler(new NewTabPageSyncHandler()); 99 web_ui->AddMessageHandler(new NewTabPageSyncHandler());
101 100
102 ExtensionService* service = 101 ExtensionService* service =
103 extensions::ExtensionSystem::Get(profile)->extension_service(); 102 extensions::ExtensionSystem::Get(profile)->extension_service();
104 // We might not have an ExtensionService (on ChromeOS when not logged in 103 // We might not have an ExtensionService (on ChromeOS when not logged in
105 // for example). 104 // for example).
106 if (service) 105 if (service)
107 web_ui->AddMessageHandler(new AppLauncherHandler(service)); 106 web_ui->AddMessageHandler(new AppLauncherHandler(service));
108 } 107 }
109 108
110 if (NTPLoginHandler::ShouldShow(profile))
111 web_ui->AddMessageHandler(new NTPLoginHandler());
112
113 #if defined(ENABLE_THEMES) 109 #if defined(ENABLE_THEMES)
114 // The theme handler can require some CPU, so do it after hooking up the most 110 // The theme handler can require some CPU, so do it after hooking up the most
115 // visited handler. This allows the DB query for the new tab thumbs to happen 111 // visited handler. This allows the DB query for the new tab thumbs to happen
116 // earlier. 112 // earlier.
117 web_ui->AddMessageHandler(new ThemeHandler()); 113 web_ui->AddMessageHandler(new ThemeHandler());
118 #endif 114 #endif
119 115
120 scoped_ptr<NewTabHTMLSource> html_source( 116 scoped_ptr<NewTabHTMLSource> html_source(
121 new NewTabHTMLSource(profile->GetOriginalProfile())); 117 new NewTabHTMLSource(profile->GetOriginalProfile()));
122 118
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 343 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
348 const char* mime_type, 344 const char* mime_type,
349 int resource_id) { 345 int resource_id) {
350 DCHECK(resource); 346 DCHECK(resource);
351 DCHECK(mime_type); 347 DCHECK(mime_type);
352 resource_map_[std::string(resource)] = 348 resource_map_[std::string(resource)] =
353 std::make_pair(std::string(mime_type), resource_id); 349 std::make_pair(std::string(mime_type), resource_id);
354 } 350 }
355 351
356 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} 352 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/history_ui.cc ('k') | chrome/browser/ui/webui/ntp/ntp_login_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698