| OLD | NEW |
| 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 "extensions/browser/api/alarms/alarms_api.h" | 5 #include "extensions/browser/api/alarms/alarms_api.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 | 173 |
| 174 std::string name = params->name.get() ? *params->name : kDefaultAlarmName; | 174 std::string name = params->name.get() ? *params->name : kDefaultAlarmName; |
| 175 AlarmManager::Get(browser_context()) | 175 AlarmManager::Get(browser_context()) |
| 176 ->RemoveAlarm(extension_id(), name, | 176 ->RemoveAlarm(extension_id(), name, |
| 177 base::Bind(&AlarmsClearFunction::Callback, this, name)); | 177 base::Bind(&AlarmsClearFunction::Callback, this, name)); |
| 178 | 178 |
| 179 return true; | 179 return true; |
| 180 } | 180 } |
| 181 | 181 |
| 182 void AlarmsClearFunction::Callback(const std::string& name, bool success) { | 182 void AlarmsClearFunction::Callback(const std::string& name, bool success) { |
| 183 SetResult(base::MakeUnique<base::FundamentalValue>(success)); | 183 SetResult(base::MakeUnique<base::Value>(success)); |
| 184 SendResponse(true); | 184 SendResponse(true); |
| 185 } | 185 } |
| 186 | 186 |
| 187 bool AlarmsClearAllFunction::RunAsync() { | 187 bool AlarmsClearAllFunction::RunAsync() { |
| 188 AlarmManager::Get(browser_context()) | 188 AlarmManager::Get(browser_context()) |
| 189 ->RemoveAllAlarms(extension_id(), | 189 ->RemoveAllAlarms(extension_id(), |
| 190 base::Bind(&AlarmsClearAllFunction::Callback, this)); | 190 base::Bind(&AlarmsClearAllFunction::Callback, this)); |
| 191 return true; | 191 return true; |
| 192 } | 192 } |
| 193 | 193 |
| 194 void AlarmsClearAllFunction::Callback() { | 194 void AlarmsClearAllFunction::Callback() { |
| 195 SetResult(base::MakeUnique<base::FundamentalValue>(true)); | 195 SetResult(base::MakeUnique<base::Value>(true)); |
| 196 SendResponse(true); | 196 SendResponse(true); |
| 197 } | 197 } |
| 198 | 198 |
| 199 } // namespace extensions | 199 } // namespace extensions |
| OLD | NEW |