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

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

Issue 1515153003: Enable chrome://gcm-internals on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gcm_internals_ui.h" 5 #include "chrome/browser/ui/webui/gcm_internals_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"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (args->GetSize() != 1) { 78 if (args->GetSize() != 1) {
79 NOTREACHED(); 79 NOTREACHED();
80 return; 80 return;
81 } 81 }
82 bool clear_logs = false; 82 bool clear_logs = false;
83 if (!args->GetBoolean(0, &clear_logs)) { 83 if (!args->GetBoolean(0, &clear_logs)) {
84 NOTREACHED(); 84 NOTREACHED();
85 return; 85 return;
86 } 86 }
87 87
88 gcm::GCMDriver::ClearActivityLogs clear_activity_logs =
89 clear_logs ? gcm::GCMDriver::CLEAR_LOGS : gcm::GCMDriver::KEEP_LOGS;
90
88 Profile* profile = Profile::FromWebUI(web_ui()); 91 Profile* profile = Profile::FromWebUI(web_ui());
89 gcm::GCMProfileService* profile_service = 92 gcm::GCMProfileService* profile_service =
90 gcm::GCMProfileServiceFactory::GetForProfile(profile); 93 gcm::GCMProfileServiceFactory::GetForProfile(profile);
91 94
92 if (!profile_service || !profile_service->driver()) { 95 if (!profile_service || !profile_service->driver()) {
93 ReturnResults(profile, NULL, NULL); 96 ReturnResults(profile, NULL, NULL);
94 } else { 97 } else {
95 profile_service->driver()->GetGCMStatistics( 98 profile_service->driver()->GetGCMStatistics(
96 base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished, 99 base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
97 weak_ptr_factory_.GetWeakPtr()), 100 weak_ptr_factory_.GetWeakPtr()),
98 clear_logs); 101 clear_activity_logs);
99 } 102 }
100 } 103 }
101 104
102 void GcmInternalsUIMessageHandler::SetRecording(const base::ListValue* args) { 105 void GcmInternalsUIMessageHandler::SetRecording(const base::ListValue* args) {
103 if (args->GetSize() != 1) { 106 if (args->GetSize() != 1) {
104 NOTREACHED(); 107 NOTREACHED();
105 return; 108 return;
106 } 109 }
107 bool recording = false; 110 bool recording = false;
108 if (!args->GetBoolean(0, &recording)) { 111 if (!args->GetBoolean(0, &recording)) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
164 IDR_GCM_DRIVER_GCM_INTERNALS_JS); 167 IDR_GCM_DRIVER_GCM_INTERNALS_JS);
165 html_source->SetDefaultResource(IDR_GCM_DRIVER_GCM_INTERNALS_HTML); 168 html_source->SetDefaultResource(IDR_GCM_DRIVER_GCM_INTERNALS_HTML);
166 169
167 Profile* profile = Profile::FromWebUI(web_ui); 170 Profile* profile = Profile::FromWebUI(web_ui);
168 content::WebUIDataSource::Add(profile, html_source); 171 content::WebUIDataSource::Add(profile, html_source);
169 172
170 web_ui->AddMessageHandler(new GcmInternalsUIMessageHandler()); 173 web_ui->AddMessageHandler(new GcmInternalsUIMessageHandler());
171 } 174 }
172 175
173 GCMInternalsUI::~GCMInternalsUI() {} 176 GCMInternalsUI::~GCMInternalsUI() {}
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chrome_web_ui_controller_factory.cc ('k') | chrome/common/url_constants.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698