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

Side by Side Diff: chrome/browser/ui/webui/active_downloads_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 | « no previous file | chrome/browser/ui/webui/bug_report_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/active_downloads_ui.h" 5 #include "chrome/browser/ui/webui/active_downloads_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/callback.h" 11 #include "base/bind.h"
12 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 13 #include "base/command_line.h"
13 #include "base/file_util.h" 14 #include "base/file_util.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/memory/singleton.h" 16 #include "base/memory/singleton.h"
16 #include "base/message_loop.h" 17 #include "base/message_loop.h"
17 #include "base/path_service.h" 18 #include "base/path_service.h"
18 #include "base/string_piece.h" 19 #include "base/string_piece.h"
19 #include "base/string_util.h" 20 #include "base/string_util.h"
20 #include "base/threading/thread.h" 21 #include "base/threading/thread.h"
21 #include "base/time.h" 22 #include "base/time.h"
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 return WebUIMessageHandler::Attach(web_ui); 216 return WebUIMessageHandler::Attach(web_ui);
216 } 217 }
217 218
218 void ActiveDownloadsHandler::Init() { 219 void ActiveDownloadsHandler::Init() {
219 download_manager_ = profile_->GetDownloadManager(); 220 download_manager_ = profile_->GetDownloadManager();
220 download_manager_->AddObserver(this); 221 download_manager_->AddObserver(this);
221 } 222 }
222 223
223 void ActiveDownloadsHandler::RegisterMessages() { 224 void ActiveDownloadsHandler::RegisterMessages() {
224 web_ui_->RegisterMessageCallback("getDownloads", 225 web_ui_->RegisterMessageCallback("getDownloads",
225 NewCallback(this, &ActiveDownloadsHandler::HandleGetDownloads)); 226 base::Bind(&ActiveDownloadsHandler::HandleGetDownloads,
227 base::Unretained(this)));
226 web_ui_->RegisterMessageCallback("pauseToggleDownload", 228 web_ui_->RegisterMessageCallback("pauseToggleDownload",
227 NewCallback(this, &ActiveDownloadsHandler::HandlePauseToggleDownload)); 229 base::Bind(&ActiveDownloadsHandler::HandlePauseToggleDownload,
230 base::Unretained(this)));
228 web_ui_->RegisterMessageCallback("cancelDownload", 231 web_ui_->RegisterMessageCallback("cancelDownload",
229 NewCallback(this, &ActiveDownloadsHandler::HandleCancelDownload)); 232 base::Bind(&ActiveDownloadsHandler::HandleCancelDownload,
233 base::Unretained(this)));
230 web_ui_->RegisterMessageCallback("allowDownload", 234 web_ui_->RegisterMessageCallback("allowDownload",
231 NewCallback(this, &ActiveDownloadsHandler::HandleAllowDownload)); 235 base::Bind(&ActiveDownloadsHandler::HandleAllowDownload,
236 base::Unretained(this)));
232 web_ui_->RegisterMessageCallback("openNewFullWindow", 237 web_ui_->RegisterMessageCallback("openNewFullWindow",
233 NewCallback(this, &ActiveDownloadsHandler::OpenNewFullWindow)); 238 base::Bind(&ActiveDownloadsHandler::OpenNewFullWindow,
239 base::Unretained(this)));
234 web_ui_->RegisterMessageCallback("playMediaFile", 240 web_ui_->RegisterMessageCallback("playMediaFile",
235 NewCallback(this, &ActiveDownloadsHandler::PlayMediaFile)); 241 base::Bind(&ActiveDownloadsHandler::PlayMediaFile,
242 base::Unretained(this)));
236 } 243 }
237 244
238 void ActiveDownloadsHandler::PlayMediaFile(const ListValue* args) { 245 void ActiveDownloadsHandler::PlayMediaFile(const ListValue* args) {
239 FilePath file_path(UTF16ToUTF8(ExtractStringValue(args))); 246 FilePath file_path(UTF16ToUTF8(ExtractStringValue(args)));
240 247
241 Browser* browser = Browser::GetBrowserForController( 248 Browser* browser = Browser::GetBrowserForController(
242 &tab_contents_->controller(), NULL); 249 &tab_contents_->controller(), NULL);
243 MediaPlayer* mediaplayer = MediaPlayer::GetInstance(); 250 MediaPlayer* mediaplayer = MediaPlayer::GetInstance();
244 mediaplayer->ForcePlayMediaFile(profile_, file_path, browser); 251 mediaplayer->ForcePlayMediaFile(profile_, file_path, browser);
245 } 252 }
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
457 } 464 }
458 } 465 }
459 } 466 }
460 return NULL; 467 return NULL;
461 } 468 }
462 #endif // defined(TOUCH_UI) 469 #endif // defined(TOUCH_UI)
463 470
464 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const { 471 const ActiveDownloadsUI::DownloadList& ActiveDownloadsUI::GetDownloads() const {
465 return handler_->downloads(); 472 return handler_->downloads();
466 } 473 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/bug_report_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698