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

Side by Side Diff: chrome/browser/ui/webui/crashes_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
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/crashes_ui.h" 5 #include "chrome/browser/ui/webui/crashes_ui.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h"
10 #include "base/bind_helpers.h"
9 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
10 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
11 #include "base/utf_string_conversions.h" 13 #include "base/utf_string_conversions.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "chrome/browser/browser_process.h" 15 #include "chrome/browser/browser_process.h"
14 #include "chrome/browser/crash_upload_list.h" 16 #include "chrome/browser/crash_upload_list.h"
15 #include "chrome/browser/prefs/pref_service.h" 17 #include "chrome/browser/prefs/pref_service.h"
16 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
17 #include "chrome/browser/ui/webui/chrome_url_data_manager.h" 19 #include "chrome/browser/ui/webui/chrome_url_data_manager.h"
18 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h" 20 #include "chrome/browser/ui/webui/chrome_web_ui_data_source.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 upload_list_->ClearDelegate(); 100 upload_list_->ClearDelegate();
99 } 101 }
100 102
101 WebUIMessageHandler* CrashesDOMHandler::Attach(WebUI* web_ui) { 103 WebUIMessageHandler* CrashesDOMHandler::Attach(WebUI* web_ui) {
102 upload_list_->LoadCrashListAsynchronously(); 104 upload_list_->LoadCrashListAsynchronously();
103 return WebUIMessageHandler::Attach(web_ui); 105 return WebUIMessageHandler::Attach(web_ui);
104 } 106 }
105 107
106 void CrashesDOMHandler::RegisterMessages() { 108 void CrashesDOMHandler::RegisterMessages() {
107 web_ui_->RegisterMessageCallback("requestCrashList", 109 web_ui_->RegisterMessageCallback("requestCrashList",
108 NewCallback(this, &CrashesDOMHandler::HandleRequestCrashes)); 110 base::Bind(&CrashesDOMHandler::HandleRequestCrashes,
111 base::Unretained(this)));
109 } 112 }
110 113
111 void CrashesDOMHandler::HandleRequestCrashes(const ListValue* args) { 114 void CrashesDOMHandler::HandleRequestCrashes(const ListValue* args) {
112 if (!CrashesUI::CrashReportingEnabled() || list_available_) 115 if (!CrashesUI::CrashReportingEnabled() || list_available_)
113 UpdateUI(); 116 UpdateUI();
114 else 117 else
115 js_request_pending_ = true; 118 js_request_pending_ = true;
116 } 119 }
117 120
118 void CrashesDOMHandler::OnCrashListAvailable() { 121 void CrashesDOMHandler::OnCrashListAvailable() {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 bool CrashesUI::CrashReportingEnabled() { 178 bool CrashesUI::CrashReportingEnabled() {
176 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS) 179 #if defined(GOOGLE_CHROME_BUILD) && !defined(OS_CHROMEOS)
177 PrefService* prefs = g_browser_process->local_state(); 180 PrefService* prefs = g_browser_process->local_state();
178 return prefs->GetBoolean(prefs::kMetricsReportingEnabled); 181 return prefs->GetBoolean(prefs::kMetricsReportingEnabled);
179 #elif defined(GOOGLE_CHROME_BUILD) && defined(OS_CHROMEOS) 182 #elif defined(GOOGLE_CHROME_BUILD) && defined(OS_CHROMEOS)
180 return chromeos::UserCrosSettingsProvider::cached_reporting_enabled(); 183 return chromeos::UserCrosSettingsProvider::cached_reporting_enabled();
181 #else 184 #else
182 return false; 185 return false;
183 #endif 186 #endif
184 } 187 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/cookies_tree_model_adapter.cc ('k') | chrome/browser/ui/webui/downloads_dom_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698