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

Side by Side Diff: chrome/browser/ui/webui/history_ui.cc

Issue 11881055: Simplify WebUI data sources. Currently WebUI data sources implement a URLDataSourceDelegate interfa… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: fix issue in about_ui exposed by cros tests Created 7 years, 11 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
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/history_ui.h" 5 #include "chrome/browser/ui/webui/history_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 BrowsingHistoryHandler::BrowsingHistoryHandler() {} 150 BrowsingHistoryHandler::BrowsingHistoryHandler() {}
151 151
152 BrowsingHistoryHandler::~BrowsingHistoryHandler() { 152 BrowsingHistoryHandler::~BrowsingHistoryHandler() {
153 history_request_consumer_.CancelAllRequests(); 153 history_request_consumer_.CancelAllRequests();
154 web_history_request_.reset(); 154 web_history_request_.reset();
155 } 155 }
156 156
157 void BrowsingHistoryHandler::RegisterMessages() { 157 void BrowsingHistoryHandler::RegisterMessages() {
158 // Create our favicon data source. 158 // Create our favicon data source.
159 Profile* profile = Profile::FromWebUI(web_ui()); 159 Profile* profile = Profile::FromWebUI(web_ui());
160 ChromeURLDataManager::AddDataSource(profile, 160 ChromeURLDataManager::AddDataSource(
161 new FaviconSource(profile, FaviconSource::FAVICON)); 161 profile, new FaviconSource(profile, FaviconSource::FAVICON));
162 162
163 // Get notifications when history is cleared. 163 // Get notifications when history is cleared.
164 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, 164 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
165 content::Source<Profile>(profile->GetOriginalProfile())); 165 content::Source<Profile>(profile->GetOriginalProfile()));
166 166
167 web_ui()->RegisterMessageCallback("queryHistory", 167 web_ui()->RegisterMessageCallback("queryHistory",
168 base::Bind(&BrowsingHistoryHandler::HandleQueryHistory, 168 base::Bind(&BrowsingHistoryHandler::HandleQueryHistory,
169 base::Unretained(this))); 169 base::Unretained(this)));
170 web_ui()->RegisterMessageCallback("removeURLsOnOneDay", 170 web_ui()->RegisterMessageCallback("removeURLsOnOneDay",
171 base::Bind(&BrowsingHistoryHandler::HandleRemoveURLsOnOneDay, 171 base::Bind(&BrowsingHistoryHandler::HandleRemoveURLsOnOneDay,
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 //////////////////////////////////////////////////////////////////////////////// 499 ////////////////////////////////////////////////////////////////////////////////
500 // 500 //
501 // HistoryUI 501 // HistoryUI
502 // 502 //
503 //////////////////////////////////////////////////////////////////////////////// 503 ////////////////////////////////////////////////////////////////////////////////
504 504
505 HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) { 505 HistoryUI::HistoryUI(content::WebUI* web_ui) : WebUIController(web_ui) {
506 web_ui->AddMessageHandler(new BrowsingHistoryHandler()); 506 web_ui->AddMessageHandler(new BrowsingHistoryHandler());
507 507
508 // Set up the chrome://history-frame/ source. 508 // Set up the chrome://history-frame/ source.
509 ChromeURLDataManager::AddDataSource(Profile::FromWebUI(web_ui), 509 ChromeURLDataManager::AddDataSourceImpl(Profile::FromWebUI(web_ui),
510 CreateHistoryUIHTMLSource()); 510 CreateHistoryUIHTMLSource());
511 } 511 }
512 512
513 // static 513 // static
514 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) { 514 const GURL HistoryUI::GetHistoryURLWithSearchText(const string16& text) {
515 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" + 515 return GURL(std::string(chrome::kChromeUIHistoryURL) + "#q=" +
516 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 516 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
517 } 517 }
518 518
519 // static 519 // static
520 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes( 520 base::RefCountedMemory* HistoryUI::GetFaviconResourceBytes(
521 ui::ScaleFactor scale_factor) { 521 ui::ScaleFactor scale_factor) {
522 return ResourceBundle::GetSharedInstance(). 522 return ResourceBundle::GetSharedInstance().
523 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor); 523 LoadDataResourceBytesForScale(IDR_HISTORY_FAVICON, scale_factor);
524 } 524 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698