| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 7 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 #include "ui/base/layout.h" | 54 #include "ui/base/layout.h" |
| 55 #include "ui/base/resource/resource_bundle.h" | 55 #include "ui/base/resource/resource_bundle.h" |
| 56 | 56 |
| 57 #if !defined(OS_ANDROID) | 57 #if !defined(OS_ANDROID) |
| 58 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" | 58 #include "chrome/browser/ui/webui/ntp/app_launcher_handler.h" |
| 59 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" | 59 #include "chrome/browser/ui/webui/ntp/new_tab_page_sync_handler.h" |
| 60 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | 60 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" |
| 61 #include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h" | 61 #include "chrome/browser/ui/webui/ntp/suggestions_page_handler.h" |
| 62 #else | 62 #else |
| 63 #include "chrome/browser/ui/webui/ntp/android/bookmarks_handler.h" | 63 #include "chrome/browser/ui/webui/ntp/android/bookmarks_handler.h" |
| 64 #include "chrome/browser/ui/webui/ntp/android/context_menu_handler.h" |
| 64 #endif | 65 #endif |
| 65 | 66 |
| 66 using content::BrowserThread; | 67 using content::BrowserThread; |
| 67 using content::RenderViewHost; | 68 using content::RenderViewHost; |
| 68 using content::UserMetricsAction; | 69 using content::UserMetricsAction; |
| 69 using content::WebContents; | 70 using content::WebContents; |
| 70 using content::WebUIController; | 71 using content::WebUIController; |
| 71 | 72 |
| 72 namespace { | 73 namespace { |
| 73 | 74 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 } | 126 } |
| 126 #endif | 127 #endif |
| 127 | 128 |
| 128 web_ui->AddMessageHandler(new NewTabPageHandler()); | 129 web_ui->AddMessageHandler(new NewTabPageHandler()); |
| 129 web_ui->AddMessageHandler(new FaviconWebUIHandler()); | 130 web_ui->AddMessageHandler(new FaviconWebUIHandler()); |
| 130 } | 131 } |
| 131 | 132 |
| 132 #if defined(OS_ANDROID) | 133 #if defined(OS_ANDROID) |
| 133 // These handlers are specific to the Android NTP page. | 134 // These handlers are specific to the Android NTP page. |
| 134 web_ui->AddMessageHandler((new BookmarksHandler())); | 135 web_ui->AddMessageHandler((new BookmarksHandler())); |
| 136 web_ui->AddMessageHandler((new ContextMenuHandler())); |
| 135 #else | 137 #else |
| 136 // Android uses native UI for sync setup. | 138 // Android uses native UI for sync setup. |
| 137 if (NTPLoginHandler::ShouldShow(GetProfile())) | 139 if (NTPLoginHandler::ShouldShow(GetProfile())) |
| 138 web_ui->AddMessageHandler(new NTPLoginHandler()); | 140 web_ui->AddMessageHandler(new NTPLoginHandler()); |
| 139 #endif | 141 #endif |
| 140 | 142 |
| 141 // Initializing the CSS and HTML can require some CPU, so do it after | 143 // Initializing the CSS and HTML can require some CPU, so do it after |
| 142 // we've hooked up the most visited handler. This allows the DB query | 144 // we've hooked up the most visited handler. This allows the DB query |
| 143 // for the new tab thumbs to happen earlier. | 145 // for the new tab thumbs to happen earlier. |
| 144 InitializeCSSCaches(); | 146 InitializeCSSCaches(); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, | 402 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, |
| 401 const char* mime_type, | 403 const char* mime_type, |
| 402 int resource_id) { | 404 int resource_id) { |
| 403 DCHECK(resource); | 405 DCHECK(resource); |
| 404 DCHECK(mime_type); | 406 DCHECK(mime_type); |
| 405 resource_map_[std::string(resource)] = | 407 resource_map_[std::string(resource)] = |
| 406 std::make_pair(std::string(mime_type), resource_id); | 408 std::make_pair(std::string(mime_type), resource_id); |
| 407 } | 409 } |
| 408 | 410 |
| 409 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} | 411 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} |
| OLD | NEW |