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 "chrome/browser/extensions/api/web_request/web_request_api.h" | 5 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 event_router->RegisterObserver(this, event_name); | 414 event_router->RegisterObserver(this, event_name); |
415 } | 415 } |
416 } | 416 } |
417 | 417 |
418 WebRequestAPI::~WebRequestAPI() { | 418 WebRequestAPI::~WebRequestAPI() { |
419 ExtensionSystem::Get(browser_context_) | 419 ExtensionSystem::Get(browser_context_) |
420 ->event_router() | 420 ->event_router() |
421 ->UnregisterObserver(this); | 421 ->UnregisterObserver(this); |
422 } | 422 } |
423 | 423 |
424 static base::LazyInstance<ProfileKeyedAPIFactory<WebRequestAPI> > | 424 static base::LazyInstance<BrowserContextKeyedAPIFactory<WebRequestAPI> > |
425 g_factory = LAZY_INSTANCE_INITIALIZER; | 425 g_factory = LAZY_INSTANCE_INITIALIZER; |
426 | 426 |
427 // static | 427 // static |
428 ProfileKeyedAPIFactory<WebRequestAPI>* WebRequestAPI::GetFactoryInstance() { | 428 BrowserContextKeyedAPIFactory<WebRequestAPI>* |
| 429 WebRequestAPI::GetFactoryInstance() { |
429 return g_factory.Pointer(); | 430 return g_factory.Pointer(); |
430 } | 431 } |
431 | 432 |
432 void WebRequestAPI::OnListenerRemoved(const EventListenerInfo& details) { | 433 void WebRequestAPI::OnListenerRemoved(const EventListenerInfo& details) { |
433 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 434 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
434 // Note that details.event_name includes the sub-event details (e.g. "/123"). | 435 // Note that details.event_name includes the sub-event details (e.g. "/123"). |
435 BrowserThread::PostTask(BrowserThread::IO, | 436 BrowserThread::PostTask(BrowserThread::IO, |
436 FROM_HERE, | 437 FROM_HERE, |
437 base::Bind(&RemoveEventListenerOnIOThread, | 438 base::Bind(&RemoveEventListenerOnIOThread, |
438 details.browser_context, | 439 details.browser_context, |
(...skipping 1941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2380 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 2381 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
2381 adblock = true; | 2382 adblock = true; |
2382 } else { | 2383 } else { |
2383 other = true; | 2384 other = true; |
2384 } | 2385 } |
2385 } | 2386 } |
2386 } | 2387 } |
2387 | 2388 |
2388 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 2389 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
2389 } | 2390 } |
OLD | NEW |