| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/extension_action_runner.h" | 5 #include "chrome/browser/extensions/extension_action_runner.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 OnRequestScriptInjectionPermission) | 396 OnRequestScriptInjectionPermission) |
| 397 IPC_MESSAGE_UNHANDLED(handled = false) | 397 IPC_MESSAGE_UNHANDLED(handled = false) |
| 398 IPC_END_MESSAGE_MAP() | 398 IPC_END_MESSAGE_MAP() |
| 399 return handled; | 399 return handled; |
| 400 } | 400 } |
| 401 | 401 |
| 402 void ExtensionActionRunner::DidFinishNavigation( | 402 void ExtensionActionRunner::DidFinishNavigation( |
| 403 content::NavigationHandle* navigation_handle) { | 403 content::NavigationHandle* navigation_handle) { |
| 404 if (!navigation_handle->IsInMainFrame() || | 404 if (!navigation_handle->IsInMainFrame() || |
| 405 !navigation_handle->HasCommitted() || | 405 !navigation_handle->HasCommitted() || |
| 406 navigation_handle->IsSamePage()) { | 406 navigation_handle->IsSameDocument()) { |
| 407 return; | 407 return; |
| 408 } | 408 } |
| 409 | 409 |
| 410 LogUMA(); | 410 LogUMA(); |
| 411 num_page_requests_ = 0; | 411 num_page_requests_ = 0; |
| 412 permitted_extensions_.clear(); | 412 permitted_extensions_.clear(); |
| 413 pending_scripts_.clear(); | 413 pending_scripts_.clear(); |
| 414 web_request_blocked_.clear(); | 414 web_request_blocked_.clear(); |
| 415 was_used_on_page_ = false; | 415 was_used_on_page_ = false; |
| 416 weak_factory_.InvalidateWeakPtrs(); | 416 weak_factory_.InvalidateWeakPtrs(); |
| 417 } | 417 } |
| 418 | 418 |
| 419 void ExtensionActionRunner::OnExtensionUnloaded( | 419 void ExtensionActionRunner::OnExtensionUnloaded( |
| 420 content::BrowserContext* browser_context, | 420 content::BrowserContext* browser_context, |
| 421 const Extension* extension, | 421 const Extension* extension, |
| 422 UnloadedExtensionInfo::Reason reason) { | 422 UnloadedExtensionInfo::Reason reason) { |
| 423 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); | 423 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); |
| 424 if (iter != pending_scripts_.end()) { | 424 if (iter != pending_scripts_.end()) { |
| 425 pending_scripts_.erase(iter); | 425 pending_scripts_.erase(iter); |
| 426 ExtensionActionAPI::Get(browser_context_) | 426 ExtensionActionAPI::Get(browser_context_) |
| 427 ->NotifyPageActionsChanged(web_contents()); | 427 ->NotifyPageActionsChanged(web_contents()); |
| 428 } | 428 } |
| 429 } | 429 } |
| 430 | 430 |
| 431 } // namespace extensions | 431 } // namespace extensions |
| OLD | NEW |