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

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

Issue 8113018: [web-ui] Migrate RegisterMessageCallback usage to base::bind(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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/gpu_internals_ui.cc ('k') | chrome/browser/ui/webui/history_ui.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/history2_ui.h" 5 #include "chrome/browser/ui/webui/history2_ui.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/callback.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h"
11 #include "base/callback_old.h"
10 #include "base/i18n/time_formatting.h" 12 #include "base/i18n/time_formatting.h"
11 #include "base/memory/singleton.h" 13 #include "base/memory/singleton.h"
12 #include "base/message_loop.h" 14 #include "base/message_loop.h"
13 #include "base/string16.h" 15 #include "base/string16.h"
14 #include "base/string_number_conversions.h" 16 #include "base/string_number_conversions.h"
15 #include "base/string_piece.h" 17 #include "base/string_piece.h"
16 #include "base/threading/thread.h" 18 #include "base/threading/thread.h"
17 #include "base/time.h" 19 #include "base/time.h"
18 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
19 #include "base/values.h" 21 #include "base/values.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 new FaviconSource(profile, FaviconSource::FAVICON)); 107 new FaviconSource(profile, FaviconSource::FAVICON));
106 108
107 // Get notifications when history is cleared. 109 // Get notifications when history is cleared.
108 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED, 110 registrar_.Add(this, chrome::NOTIFICATION_HISTORY_URLS_DELETED,
109 Source<Profile>(profile->GetOriginalProfile())); 111 Source<Profile>(profile->GetOriginalProfile()));
110 return WebUIMessageHandler::Attach(web_ui); 112 return WebUIMessageHandler::Attach(web_ui);
111 } 113 }
112 114
113 void BrowsingHistoryHandler2::RegisterMessages() { 115 void BrowsingHistoryHandler2::RegisterMessages() {
114 web_ui_->RegisterMessageCallback("getHistory", 116 web_ui_->RegisterMessageCallback("getHistory",
115 NewCallback(this, &BrowsingHistoryHandler2::HandleGetHistory)); 117 base::Bind(&BrowsingHistoryHandler2::HandleGetHistory,
118 base::Unretained(this)));
116 web_ui_->RegisterMessageCallback("searchHistory", 119 web_ui_->RegisterMessageCallback("searchHistory",
117 NewCallback(this, &BrowsingHistoryHandler2::HandleSearchHistory)); 120 base::Bind(&BrowsingHistoryHandler2::HandleSearchHistory,
121 base::Unretained(this)));
118 web_ui_->RegisterMessageCallback("removeURLsOnOneDay", 122 web_ui_->RegisterMessageCallback("removeURLsOnOneDay",
119 NewCallback(this, &BrowsingHistoryHandler2::HandleRemoveURLsOnOneDay)); 123 base::Bind(&BrowsingHistoryHandler2::HandleRemoveURLsOnOneDay,
124 base::Unretained(this)));
120 web_ui_->RegisterMessageCallback("clearBrowsingData", 125 web_ui_->RegisterMessageCallback("clearBrowsingData",
121 NewCallback(this, &BrowsingHistoryHandler2::HandleClearBrowsingData)); 126 base::Bind(&BrowsingHistoryHandler2::HandleClearBrowsingData,
127 base::Unretained(this)));
122 } 128 }
123 129
124 void BrowsingHistoryHandler2::HandleGetHistory(const ListValue* args) { 130 void BrowsingHistoryHandler2::HandleGetHistory(const ListValue* args) {
125 // Anything in-flight is invalid. 131 // Anything in-flight is invalid.
126 cancelable_search_consumer_.CancelAllRequests(); 132 cancelable_search_consumer_.CancelAllRequests();
127 133
128 // Get arguments (if any). 134 // Get arguments (if any).
129 int day = 0; 135 int day = 0;
130 ExtractIntegerValue(args, &day); 136 ExtractIntegerValue(args, &day);
131 137
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) { 393 const GURL HistoryUI2::GetHistoryURLWithSearchText(const string16& text) {
388 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" + 394 return GURL(std::string(chrome::kChromeUIHistory2URL) + "#q=" +
389 net::EscapeQueryParamValue(UTF16ToUTF8(text), true)); 395 net::EscapeQueryParamValue(UTF16ToUTF8(text), true));
390 } 396 }
391 397
392 // static 398 // static
393 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() { 399 RefCountedMemory* HistoryUI2::GetFaviconResourceBytes() {
394 return ResourceBundle::GetSharedInstance(). 400 return ResourceBundle::GetSharedInstance().
395 LoadDataResourceBytes(IDR_HISTORY_FAVICON); 401 LoadDataResourceBytes(IDR_HISTORY_FAVICON);
396 } 402 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/gpu_internals_ui.cc ('k') | chrome/browser/ui/webui/history_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698