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

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

Issue 282093012: Remove dependencies of Metrics{Service,Log} on g_browser_process->local_state() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove cruft Created 6 years, 7 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/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" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
11 #include "base/i18n/time_formatting.h" 11 #include "base/i18n/time_formatting.h"
12 #include "base/memory/ref_counted_memory.h" 12 #include "base/memory/ref_counted_memory.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/browser_process.h"
15 #include "chrome/browser/crash_upload_list.h" 16 #include "chrome/browser/crash_upload_list.h"
16 #include "chrome/browser/metrics/metrics_service.h" 17 #include "chrome/browser/metrics/metrics_service.h"
17 #include "chrome/browser/profiles/profile.h" 18 #include "chrome/browser/profiles/profile.h"
18 #include "chrome/common/chrome_version_info.h" 19 #include "chrome/common/chrome_version_info.h"
19 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
20 #include "content/public/browser/web_contents.h" 21 #include "content/public/browser/web_contents.h"
21 #include "content/public/browser/web_ui.h" 22 #include "content/public/browser/web_ui.h"
22 #include "content/public/browser/web_ui_data_source.h" 23 #include "content/public/browser/web_ui_data_source.h"
23 #include "content/public/browser/web_ui_message_handler.h" 24 #include "content/public/browser/web_ui_message_handler.h"
24 #include "grit/browser_resources.h" 25 #include "grit/browser_resources.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 } 145 }
145 #endif 146 #endif
146 147
147 void CrashesDOMHandler::OnUploadListAvailable() { 148 void CrashesDOMHandler::OnUploadListAvailable() {
148 list_available_ = true; 149 list_available_ = true;
149 if (!first_load_) 150 if (!first_load_)
150 UpdateUI(); 151 UpdateUI();
151 } 152 }
152 153
153 void CrashesDOMHandler::UpdateUI() { 154 void CrashesDOMHandler::UpdateUI() {
154 bool crash_reporting_enabled = 155 bool crash_reporting_enabled = MetricsServiceHelper::IsCrashReportingEnabled(
155 MetricsServiceHelper::IsCrashReportingEnabled(); 156 g_browser_process->local_state());
156 base::ListValue crash_list; 157 base::ListValue crash_list;
157 bool system_crash_reporter = false; 158 bool system_crash_reporter = false;
158 159
159 #if defined(OS_CHROMEOS) 160 #if defined(OS_CHROMEOS)
160 // Chrome OS has a system crash reporter. 161 // Chrome OS has a system crash reporter.
161 system_crash_reporter = true; 162 system_crash_reporter = true;
162 #endif 163 #endif
163 164
164 if (crash_reporting_enabled) { 165 if (crash_reporting_enabled) {
165 std::vector<CrashUploadList::UploadInfo> crashes; 166 std::vector<CrashUploadList::UploadInfo> crashes;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 Profile* profile = Profile::FromWebUI(web_ui); 201 Profile* profile = Profile::FromWebUI(web_ui);
201 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource()); 202 content::WebUIDataSource::Add(profile, CreateCrashesUIHTMLSource());
202 } 203 }
203 204
204 // static 205 // static
205 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes( 206 base::RefCountedMemory* CrashesUI::GetFaviconResourceBytes(
206 ui::ScaleFactor scale_factor) { 207 ui::ScaleFactor scale_factor) {
207 return ResourceBundle::GetSharedInstance(). 208 return ResourceBundle::GetSharedInstance().
208 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor); 209 LoadDataResourceBytesForScale(IDR_SAD_FAVICON, scale_factor);
209 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698