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

Side by Side Diff: ios/chrome/browser/ui/webui/gcm/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 4 years, 12 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
« no previous file with comments | « components/resources/gcm_driver_resources.grdp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "ios/chrome/browser/ui/webui/gcm/gcm_internals_ui.h" 5 #include "ios/chrome/browser/ui/webui/gcm/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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 if (args->GetSize() != 1) { 75 if (args->GetSize() != 1) {
76 NOTREACHED(); 76 NOTREACHED();
77 return; 77 return;
78 } 78 }
79 bool clear_logs = false; 79 bool clear_logs = false;
80 if (!args->GetBoolean(0, &clear_logs)) { 80 if (!args->GetBoolean(0, &clear_logs)) {
81 NOTREACHED(); 81 NOTREACHED();
82 return; 82 return;
83 } 83 }
84 84
85 gcm::GCMDriver::ClearActivityLogs clear_activity_logs =
86 clear_logs ? gcm::GCMDriver::CLEAR_LOGS : gcm::GCMDriver::KEEP_LOGS;
87
85 ios::ChromeBrowserState* browser_state = 88 ios::ChromeBrowserState* browser_state =
86 ios::ChromeBrowserState::FromWebUIIOS(web_ui()); 89 ios::ChromeBrowserState::FromWebUIIOS(web_ui());
87 gcm::GCMProfileService* profile_service = 90 gcm::GCMProfileService* profile_service =
88 IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state); 91 IOSChromeGCMProfileServiceFactory::GetForBrowserState(browser_state);
89 92
90 if (!profile_service || !profile_service->driver()) { 93 if (!profile_service || !profile_service->driver()) {
91 ReturnResults(browser_state->GetPrefs(), nullptr, nullptr); 94 ReturnResults(browser_state->GetPrefs(), nullptr, nullptr);
92 } else { 95 } else {
93 profile_service->driver()->GetGCMStatistics( 96 profile_service->driver()->GetGCMStatistics(
94 base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished, 97 base::Bind(&GcmInternalsUIMessageHandler::RequestGCMStatisticsFinished,
95 weak_ptr_factory_.GetWeakPtr()), 98 weak_ptr_factory_.GetWeakPtr()),
96 clear_logs); 99 clear_activity_logs);
97 } 100 }
98 } 101 }
99 102
100 void GcmInternalsUIMessageHandler::SetRecording(const base::ListValue* args) { 103 void GcmInternalsUIMessageHandler::SetRecording(const base::ListValue* args) {
101 if (args->GetSize() != 1) { 104 if (args->GetSize() != 1) {
102 NOTREACHED(); 105 NOTREACHED();
103 return; 106 return;
104 } 107 }
105 bool recording = false; 108 bool recording = false;
106 if (!args->GetBoolean(0, &recording)) { 109 if (!args->GetBoolean(0, &recording)) {
(...skipping 57 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 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui), 170 web::WebUIIOSDataSource::Add(ios::ChromeBrowserState::FromWebUIIOS(web_ui),
168 html_source); 171 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 | « components/resources/gcm_driver_resources.grdp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698