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/web_request/web_request_api.h" | 5 #include "extensions/browser/api/web_request/web_request_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 event_name.replace( | 392 event_name.replace( |
393 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix); | 393 0, sizeof(kWebRequestEventPrefix) - 1, webview::kWebViewEventPrefix); |
394 event_router->RegisterObserver(this, event_name); | 394 event_router->RegisterObserver(this, event_name); |
395 } | 395 } |
396 } | 396 } |
397 | 397 |
398 WebRequestAPI::~WebRequestAPI() { | 398 WebRequestAPI::~WebRequestAPI() { |
399 EventRouter::Get(browser_context_)->UnregisterObserver(this); | 399 EventRouter::Get(browser_context_)->UnregisterObserver(this); |
400 } | 400 } |
401 | 401 |
402 static base::LazyInstance<BrowserContextKeyedAPIFactory<WebRequestAPI> > | 402 static base::LazyInstance< |
403 g_factory = LAZY_INSTANCE_INITIALIZER; | 403 BrowserContextKeyedAPIFactory<WebRequestAPI>>::DestructorAtExit g_factory = |
| 404 LAZY_INSTANCE_INITIALIZER; |
404 | 405 |
405 // static | 406 // static |
406 BrowserContextKeyedAPIFactory<WebRequestAPI>* | 407 BrowserContextKeyedAPIFactory<WebRequestAPI>* |
407 WebRequestAPI::GetFactoryInstance() { | 408 WebRequestAPI::GetFactoryInstance() { |
408 return g_factory.Pointer(); | 409 return g_factory.Pointer(); |
409 } | 410 } |
410 | 411 |
411 void WebRequestAPI::OnListenerRemoved(const EventListenerInfo& details) { | 412 void WebRequestAPI::OnListenerRemoved(const EventListenerInfo& details) { |
412 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 413 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
413 // Note that details.event_name includes the sub-event details (e.g. "/123"). | 414 // Note that details.event_name includes the sub-event details (e.g. "/123"). |
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2431 // Since EventListeners are segmented by browser_context, check that | 2432 // Since EventListeners are segmented by browser_context, check that |
2432 // last, as it is exceedingly unlikely to be different. | 2433 // last, as it is exceedingly unlikely to be different. |
2433 return extension_id == that.extension_id && | 2434 return extension_id == that.extension_id && |
2434 sub_event_name == that.sub_event_name && | 2435 sub_event_name == that.sub_event_name && |
2435 web_view_instance_id == that.web_view_instance_id && | 2436 web_view_instance_id == that.web_view_instance_id && |
2436 embedder_process_id == that.embedder_process_id && | 2437 embedder_process_id == that.embedder_process_id && |
2437 browser_context == that.browser_context; | 2438 browser_context == that.browser_context; |
2438 } | 2439 } |
2439 | 2440 |
2440 } // namespace extensions | 2441 } // namespace extensions |
OLD | NEW |