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

Side by Side Diff: extensions/browser/event_router.cc

Issue 2523913003: Fix bugs in filtered event removal code (Closed)
Patch Set: Created 4 years 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 | « no previous file | 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 (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 401 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 ExtensionPrefs::ScopedDictionaryUpdate update( 412 ExtensionPrefs::ScopedDictionaryUpdate update(
413 extension_prefs_, extension_id, kFilteredEvents); 413 extension_prefs_, extension_id, kFilteredEvents);
414 DictionaryValue* filtered_events = update.Get(); 414 DictionaryValue* filtered_events = update.Get();
415 ListValue* filter_list = NULL; 415 ListValue* filter_list = NULL;
416 if (!filtered_events || 416 if (!filtered_events ||
417 !filtered_events->GetListWithoutPathExpansion(event_name, &filter_list)) { 417 !filtered_events->GetListWithoutPathExpansion(event_name, &filter_list)) {
418 return; 418 return;
419 } 419 }
420 420
421 for (size_t i = 0; i < filter_list->GetSize(); i++) { 421 for (size_t i = 0; i < filter_list->GetSize(); i++) {
422 DictionaryValue* filter = NULL; 422 DictionaryValue* filter_value = NULL;
423 CHECK(filter_list->GetDictionary(i, &filter)); 423 CHECK(filter_list->GetDictionary(i, &filter_value));
424 if (filter->Equals(filter)) { 424 if (filter_value->Equals(filter)) {
Devlin 2016/11/24 01:21:32 ... so this meant we were always removing the fir
lazyboy 2016/12/02 21:13:28 *Almost*. The fact that we had bug in writing thos
425 filter_list->Remove(i, NULL); 425 filter_list->Remove(i, NULL);
426 break; 426 break;
427 } 427 }
428 } 428 }
429 } 429 }
430 430
431 const DictionaryValue* EventRouter::GetFilteredEvents( 431 const DictionaryValue* EventRouter::GetFilteredEvents(
432 const std::string& extension_id) { 432 const std::string& extension_id) {
433 const DictionaryValue* events = NULL; 433 const DictionaryValue* events = NULL;
434 extension_prefs_->ReadPrefAsDictionary( 434 extension_prefs_->ReadPrefAsDictionary(
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 const std::string& extension_id, 882 const std::string& extension_id,
883 const GURL& listener_url, 883 const GURL& listener_url,
884 content::BrowserContext* browser_context) 884 content::BrowserContext* browser_context)
885 : event_name(event_name), 885 : event_name(event_name),
886 extension_id(extension_id), 886 extension_id(extension_id),
887 listener_url(listener_url), 887 listener_url(listener_url),
888 browser_context(browser_context) { 888 browser_context(browser_context) {
889 } 889 }
890 890
891 } // namespace extensions 891 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698