| OLD | NEW |
| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 64 |
| 65 GcmInternalsUIMessageHandler::~GcmInternalsUIMessageHandler() {} | 65 GcmInternalsUIMessageHandler::~GcmInternalsUIMessageHandler() {} |
| 66 | 66 |
| 67 void GcmInternalsUIMessageHandler::ReturnResults( | 67 void GcmInternalsUIMessageHandler::ReturnResults( |
| 68 Profile* profile, | 68 Profile* profile, |
| 69 gcm::GCMProfileService* profile_service, | 69 gcm::GCMProfileService* profile_service, |
| 70 const gcm::GCMClient::GCMStatistics* stats) const { | 70 const gcm::GCMClient::GCMStatistics* stats) const { |
| 71 base::DictionaryValue results; | 71 base::DictionaryValue results; |
| 72 gcm_driver::SetGCMInternalsInfo(stats, profile_service, profile->GetPrefs(), | 72 gcm_driver::SetGCMInternalsInfo(stats, profile_service, profile->GetPrefs(), |
| 73 &results); | 73 &results); |
| 74 web_ui()->CallJavascriptFunction(gcm_driver::kSetGcmInternalsInfo, results); | 74 web_ui()->CallJavascriptFunctionUnsafe(gcm_driver::kSetGcmInternalsInfo, |
| 75 results); |
| 75 } | 76 } |
| 76 | 77 |
| 77 void GcmInternalsUIMessageHandler::RequestAllInfo( | 78 void GcmInternalsUIMessageHandler::RequestAllInfo( |
| 78 const base::ListValue* args) { | 79 const base::ListValue* args) { |
| 79 if (args->GetSize() != 1) { | 80 if (args->GetSize() != 1) { |
| 80 NOTREACHED(); | 81 NOTREACHED(); |
| 81 return; | 82 return; |
| 82 } | 83 } |
| 83 bool clear_logs = false; | 84 bool clear_logs = false; |
| 84 if (!args->GetBoolean(0, &clear_logs)) { | 85 if (!args->GetBoolean(0, &clear_logs)) { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 IDR_GCM_DRIVER_GCM_INTERNALS_JS); | 169 IDR_GCM_DRIVER_GCM_INTERNALS_JS); |
| 169 html_source->SetDefaultResource(IDR_GCM_DRIVER_GCM_INTERNALS_HTML); | 170 html_source->SetDefaultResource(IDR_GCM_DRIVER_GCM_INTERNALS_HTML); |
| 170 | 171 |
| 171 Profile* profile = Profile::FromWebUI(web_ui); | 172 Profile* profile = Profile::FromWebUI(web_ui); |
| 172 content::WebUIDataSource::Add(profile, html_source); | 173 content::WebUIDataSource::Add(profile, html_source); |
| 173 | 174 |
| 174 web_ui->AddMessageHandler(new GcmInternalsUIMessageHandler()); | 175 web_ui->AddMessageHandler(new GcmInternalsUIMessageHandler()); |
| 175 } | 176 } |
| 176 | 177 |
| 177 GCMInternalsUI::~GCMInternalsUI() {} | 178 GCMInternalsUI::~GCMInternalsUI() {} |
| OLD | NEW |