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

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

Issue 10829326: Add the webui handler for Android's bookmark section on the NTP. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/webui/ntp/android/bookmarks_handler.cc ('k') | chrome/chrome_browser.gypi » ('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 "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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 #include "grit/theme_resources.h" 52 #include "grit/theme_resources.h"
53 #include "ui/base/l10n/l10n_util.h" 53 #include "ui/base/l10n/l10n_util.h"
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
63 #include "chrome/browser/ui/webui/ntp/android/bookmarks_handler.h"
62 #endif 64 #endif
63 65
64 using content::BrowserThread; 66 using content::BrowserThread;
65 using content::RenderViewHost; 67 using content::RenderViewHost;
66 using content::UserMetricsAction; 68 using content::UserMetricsAction;
67 using content::WebContents; 69 using content::WebContents;
68 using content::WebUIController; 70 using content::WebUIController;
69 71
70 namespace { 72 namespace {
71 73
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // for example). 122 // for example).
121 if (service) 123 if (service)
122 web_ui->AddMessageHandler(new AppLauncherHandler(service)); 124 web_ui->AddMessageHandler(new AppLauncherHandler(service));
123 } 125 }
124 #endif 126 #endif
125 127
126 web_ui->AddMessageHandler(new NewTabPageHandler()); 128 web_ui->AddMessageHandler(new NewTabPageHandler());
127 web_ui->AddMessageHandler(new FaviconWebUIHandler()); 129 web_ui->AddMessageHandler(new FaviconWebUIHandler());
128 } 130 }
129 131
130 #if !defined(OS_ANDROID) 132 #if defined(OS_ANDROID)
133 // These handlers are specific to the Android NTP page.
134 web_ui->AddMessageHandler((new BookmarksHandler()));
135 #else
131 // Android uses native UI for sync setup. 136 // Android uses native UI for sync setup.
132 if (NTPLoginHandler::ShouldShow(GetProfile())) 137 if (NTPLoginHandler::ShouldShow(GetProfile()))
133 web_ui->AddMessageHandler(new NTPLoginHandler()); 138 web_ui->AddMessageHandler(new NTPLoginHandler());
134 #endif 139 #endif
135 140
136 // Initializing the CSS and HTML can require some CPU, so do it after 141 // Initializing the CSS and HTML can require some CPU, so do it after
137 // we've hooked up the most visited handler. This allows the DB query 142 // we've hooked up the most visited handler. This allows the DB query
138 // for the new tab thumbs to happen earlier. 143 // for the new tab thumbs to happen earlier.
139 InitializeCSSCaches(); 144 InitializeCSSCaches();
140 NewTabHTMLSource* html_source = 145 NewTabHTMLSource* html_source =
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource, 400 void NewTabUI::NewTabHTMLSource::AddResource(const char* resource,
396 const char* mime_type, 401 const char* mime_type,
397 int resource_id) { 402 int resource_id) {
398 DCHECK(resource); 403 DCHECK(resource);
399 DCHECK(mime_type); 404 DCHECK(mime_type);
400 resource_map_[std::string(resource)] = 405 resource_map_[std::string(resource)] =
401 std::make_pair(std::string(mime_type), resource_id); 406 std::make_pair(std::string(mime_type), resource_id);
402 } 407 }
403 408
404 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {} 409 NewTabUI::NewTabHTMLSource::~NewTabHTMLSource() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/android/bookmarks_handler.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698