| 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/event_router.h" | 5 #include "extensions/browser/event_router.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <tuple> | 9 #include <tuple> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 391 const std::string& extension_id, | 391 const std::string& extension_id, |
| 392 const DictionaryValue* filter) { | 392 const DictionaryValue* filter) { |
| 393 ExtensionPrefs::ScopedDictionaryUpdate update( | 393 ExtensionPrefs::ScopedDictionaryUpdate update( |
| 394 extension_prefs_, extension_id, kFilteredEvents); | 394 extension_prefs_, extension_id, kFilteredEvents); |
| 395 DictionaryValue* filtered_events = update.Get(); | 395 DictionaryValue* filtered_events = update.Get(); |
| 396 if (!filtered_events) | 396 if (!filtered_events) |
| 397 filtered_events = update.Create(); | 397 filtered_events = update.Create(); |
| 398 | 398 |
| 399 ListValue* filter_list = nullptr; | 399 ListValue* filter_list = nullptr; |
| 400 if (!filtered_events->GetListWithoutPathExpansion(event_name, &filter_list)) { | 400 if (!filtered_events->GetListWithoutPathExpansion(event_name, &filter_list)) { |
| 401 filter_list = new ListValue; | 401 filtered_events->SetWithoutPathExpansion( |
| 402 filtered_events->SetWithoutPathExpansion(event_name, | 402 event_name, base::MakeUnique<base::ListValue>()); |
| 403 base::WrapUnique(filter_list)); | 403 filtered_events->GetListWithoutPathExpansion(event_name, &filter_list); |
| 404 } | 404 } |
| 405 | 405 |
| 406 filter_list->Append(filter->CreateDeepCopy()); | 406 filter_list->Append(filter->CreateDeepCopy()); |
| 407 } | 407 } |
| 408 | 408 |
| 409 void EventRouter::RemoveFilterFromEvent(const std::string& event_name, | 409 void EventRouter::RemoveFilterFromEvent(const std::string& event_name, |
| 410 const std::string& extension_id, | 410 const std::string& extension_id, |
| 411 const DictionaryValue* filter) { | 411 const DictionaryValue* filter) { |
| 412 ExtensionPrefs::ScopedDictionaryUpdate update( | 412 ExtensionPrefs::ScopedDictionaryUpdate update( |
| 413 extension_prefs_, extension_id, kFilteredEvents); | 413 extension_prefs_, extension_id, kFilteredEvents); |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 883 const std::string& extension_id, | 883 const std::string& extension_id, |
| 884 const GURL& listener_url, | 884 const GURL& listener_url, |
| 885 content::BrowserContext* browser_context) | 885 content::BrowserContext* browser_context) |
| 886 : event_name(event_name), | 886 : event_name(event_name), |
| 887 extension_id(extension_id), | 887 extension_id(extension_id), |
| 888 listener_url(listener_url), | 888 listener_url(listener_url), |
| 889 browser_context(browser_context) { | 889 browser_context(browser_context) { |
| 890 } | 890 } |
| 891 | 891 |
| 892 } // namespace extensions | 892 } // namespace extensions |
| OLD | NEW |