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

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

Issue 2898383002: [Extensions] Make Event::restrict_to_browser_context const. (Closed)
Patch Set: sync @tott Created 3 years, 6 months 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 | « extensions/browser/api/idle/idle_manager.cc ('k') | 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 #ifndef EXTENSIONS_BROWSER_EVENT_ROUTER_H_ 5 #ifndef EXTENSIONS_BROWSER_EVENT_ROUTER_H_
6 #define EXTENSIONS_BROWSER_EVENT_ROUTER_H_ 6 #define EXTENSIONS_BROWSER_EVENT_ROUTER_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <unordered_map> 10 #include <unordered_map>
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 // correlates 1:1 with |event_name|, in some cases events will generate 359 // correlates 1:1 with |event_name|, in some cases events will generate
360 // their own names, but they cannot generate their own identifier. 360 // their own names, but they cannot generate their own identifier.
361 const events::HistogramValue histogram_value; 361 const events::HistogramValue histogram_value;
362 362
363 // The event to dispatch. 363 // The event to dispatch.
364 const std::string event_name; 364 const std::string event_name;
365 365
366 // Arguments to send to the event listener. 366 // Arguments to send to the event listener.
367 std::unique_ptr<base::ListValue> event_args; 367 std::unique_ptr<base::ListValue> event_args;
368 368
369 // If non-NULL, then the event will not be sent to other BrowserContexts 369 // If non-null, then the event will not be sent to other BrowserContexts
370 // unless the extension has permission (e.g. incognito tab update -> normal 370 // unless the extension has permission (e.g. incognito tab update -> normal
371 // tab only works if extension is allowed incognito access). 371 // tab only works if extension is allowed incognito access).
372 content::BrowserContext* restrict_to_browser_context; 372 content::BrowserContext* const restrict_to_browser_context;
373 373
374 // If not empty, the event is only sent to extensions with host permissions 374 // If not empty, the event is only sent to extensions with host permissions
375 // for this url. 375 // for this url.
376 GURL event_url; 376 GURL event_url;
377 377
378 // Whether a user gesture triggered the event. 378 // Whether a user gesture triggered the event.
379 EventRouter::UserGestureState user_gesture; 379 EventRouter::UserGestureState user_gesture;
380 380
381 // Extra information used to filter which events are sent to the listener. 381 // Extra information used to filter which events are sent to the listener.
382 EventFilteringInfo filter_info; 382 EventFilteringInfo filter_info;
383 383
384 // If specified, this is called before dispatching an event to each 384 // If specified, this is called before dispatching an event to each
385 // extension. The third argument is a mutable reference to event_args, 385 // extension. The third argument is a mutable reference to event_args,
386 // allowing the caller to provide different arguments depending on the 386 // allowing the caller to provide different arguments depending on the
387 // extension and profile. This is guaranteed to be called synchronously with 387 // extension and profile. This is guaranteed to be called synchronously with
388 // DispatchEvent, so callers don't need to worry about lifetime. 388 // DispatchEvent, so callers don't need to worry about lifetime.
389 // 389 //
390 // NOTE: the Extension argument to this may be NULL because it's possible for 390 // NOTE: the Extension argument to this may be NULL because it's possible for
391 // this event to be dispatched to non-extension processes, like WebUI. 391 // this event to be dispatched to non-extension processes, like WebUI.
392 WillDispatchCallback will_dispatch_callback; 392 WillDispatchCallback will_dispatch_callback;
393 393
394 // TODO(lazyboy): This sets |restrict_to_browser_context| to nullptr, this
395 // will dispatch the event to unrelated profiles, not just incognito. Audit
396 // and limit usages of this constructor and introduce "include incognito"
397 // option to a constructor version for clients that need to disptach events to
398 // related browser_contexts. See https://crbug.com/726022.
394 Event(events::HistogramValue histogram_value, 399 Event(events::HistogramValue histogram_value,
395 const std::string& event_name, 400 const std::string& event_name,
396 std::unique_ptr<base::ListValue> event_args); 401 std::unique_ptr<base::ListValue> event_args);
397 402
398 Event(events::HistogramValue histogram_value, 403 Event(events::HistogramValue histogram_value,
399 const std::string& event_name, 404 const std::string& event_name,
400 std::unique_ptr<base::ListValue> event_args, 405 std::unique_ptr<base::ListValue> event_args,
401 content::BrowserContext* restrict_to_browser_context); 406 content::BrowserContext* restrict_to_browser_context);
402 407
403 Event(events::HistogramValue histogram_value, 408 Event(events::HistogramValue histogram_value,
(...skipping 21 matching lines...) Expand all
425 const std::string event_name; 430 const std::string event_name;
426 431
427 const std::string extension_id; 432 const std::string extension_id;
428 const GURL listener_url; 433 const GURL listener_url;
429 content::BrowserContext* const browser_context; 434 content::BrowserContext* const browser_context;
430 }; 435 };
431 436
432 } // namespace extensions 437 } // namespace extensions
433 438
434 #endif // EXTENSIONS_BROWSER_EVENT_ROUTER_H_ 439 #endif // EXTENSIONS_BROWSER_EVENT_ROUTER_H_
OLDNEW
« no previous file with comments | « extensions/browser/api/idle/idle_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698