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 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 DictionaryValue* filtered_events = update.Get(); | 407 DictionaryValue* filtered_events = update.Get(); |
408 if (!filtered_events) | 408 if (!filtered_events) |
409 filtered_events = update.Create(); | 409 filtered_events = update.Create(); |
410 | 410 |
411 ListValue* filter_list = NULL; | 411 ListValue* filter_list = NULL; |
412 if (!filtered_events->GetList(event_name, &filter_list)) { | 412 if (!filtered_events->GetList(event_name, &filter_list)) { |
413 filter_list = new ListValue; | 413 filter_list = new ListValue; |
414 filtered_events->SetWithoutPathExpansion(event_name, filter_list); | 414 filtered_events->SetWithoutPathExpansion(event_name, filter_list); |
415 } | 415 } |
416 | 416 |
417 filter_list->Append(filter->DeepCopy()); | 417 filter_list->Append(filter->CreateDeepCopy()); |
418 } | 418 } |
419 | 419 |
420 void EventRouter::RemoveFilterFromEvent(const std::string& event_name, | 420 void EventRouter::RemoveFilterFromEvent(const std::string& event_name, |
421 const std::string& extension_id, | 421 const std::string& extension_id, |
422 const DictionaryValue* filter) { | 422 const DictionaryValue* filter) { |
423 ExtensionPrefs::ScopedDictionaryUpdate update( | 423 ExtensionPrefs::ScopedDictionaryUpdate update( |
424 extension_prefs_, extension_id, kFilteredEvents); | 424 extension_prefs_, extension_id, kFilteredEvents); |
425 DictionaryValue* filtered_events = update.Get(); | 425 DictionaryValue* filtered_events = update.Get(); |
426 ListValue* filter_list = NULL; | 426 ListValue* filter_list = NULL; |
427 if (!filtered_events || | 427 if (!filtered_events || |
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 const std::string& extension_id, | 893 const std::string& extension_id, |
894 const GURL& listener_url, | 894 const GURL& listener_url, |
895 content::BrowserContext* browser_context) | 895 content::BrowserContext* browser_context) |
896 : event_name(event_name), | 896 : event_name(event_name), |
897 extension_id(extension_id), | 897 extension_id(extension_id), |
898 listener_url(listener_url), | 898 listener_url(listener_url), |
899 browser_context(browser_context) { | 899 browser_context(browser_context) { |
900 } | 900 } |
901 | 901 |
902 } // namespace extensions | 902 } // namespace extensions |
OLD | NEW |