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

Side by Side Diff: chrome/browser/extensions/extension_action_runner.cc

Issue 2668083003: Convert ExtensionActionRunner to use the new navigation callbacks. (Closed)
Patch Set: Created 3 years, 10 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 | « chrome/browser/extensions/extension_action_runner.h ('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 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 12 matching lines...) Expand all
23 #include "chrome/browser/extensions/tab_helper.h" 23 #include "chrome/browser/extensions/tab_helper.h"
24 #include "chrome/browser/profiles/profile.h" 24 #include "chrome/browser/profiles/profile.h"
25 #include "chrome/browser/sessions/session_tab_helper.h" 25 #include "chrome/browser/sessions/session_tab_helper.h"
26 #include "chrome/browser/ui/browser_finder.h" 26 #include "chrome/browser/ui/browser_finder.h"
27 #include "chrome/browser/ui/browser_window.h" 27 #include "chrome/browser/ui/browser_window.h"
28 #include "chrome/browser/ui/extensions/blocked_action_bubble_delegate.h" 28 #include "chrome/browser/ui/extensions/blocked_action_bubble_delegate.h"
29 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h" 29 #include "chrome/browser/ui/toolbar/toolbar_actions_bar.h"
30 #include "chrome/common/extensions/api/extension_action/action_info.h" 30 #include "chrome/common/extensions/api/extension_action/action_info.h"
31 #include "components/crx_file/id_util.h" 31 #include "components/crx_file/id_util.h"
32 #include "content/public/browser/navigation_controller.h" 32 #include "content/public/browser/navigation_controller.h"
33 #include "content/public/browser/navigation_details.h"
34 #include "content/public/browser/navigation_entry.h" 33 #include "content/public/browser/navigation_entry.h"
34 #include "content/public/browser/navigation_handle.h"
35 #include "content/public/browser/render_view_host.h" 35 #include "content/public/browser/render_view_host.h"
36 #include "content/public/browser/web_contents.h" 36 #include "content/public/browser/web_contents.h"
37 #include "extensions/browser/extension_registry.h" 37 #include "extensions/browser/extension_registry.h"
38 #include "extensions/common/extension.h" 38 #include "extensions/common/extension.h"
39 #include "extensions/common/extension_messages.h" 39 #include "extensions/common/extension_messages.h"
40 #include "extensions/common/extension_set.h" 40 #include "extensions/common/extension_set.h"
41 #include "extensions/common/manifest.h" 41 #include "extensions/common/manifest.h"
42 #include "extensions/common/permissions/permission_set.h" 42 #include "extensions/common/permissions/permission_set.h"
43 #include "extensions/common/permissions/permissions_data.h" 43 #include "extensions/common/permissions/permissions_data.h"
44 #include "ipc/ipc_message_macros.h" 44 #include "ipc/ipc_message_macros.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 content::RenderFrameHost* render_frame_host) { 392 content::RenderFrameHost* render_frame_host) {
393 bool handled = true; 393 bool handled = true;
394 IPC_BEGIN_MESSAGE_MAP(ExtensionActionRunner, message) 394 IPC_BEGIN_MESSAGE_MAP(ExtensionActionRunner, message)
395 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RequestScriptInjectionPermission, 395 IPC_MESSAGE_HANDLER(ExtensionHostMsg_RequestScriptInjectionPermission,
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::DidNavigateMainFrame( 402 void ExtensionActionRunner::DidFinishNavigation(
403 const content::LoadCommittedDetails& details, 403 content::NavigationHandle* navigation_handle) {
404 const content::FrameNavigateParams& params) { 404 if (!navigation_handle->IsInMainFrame() ||
405 if (details.is_in_page) 405 !navigation_handle->HasCommitted() ||
406 navigation_handle->IsSamePage()) {
406 return; 407 return;
408 }
407 409
408 LogUMA(); 410 LogUMA();
409 num_page_requests_ = 0; 411 num_page_requests_ = 0;
410 permitted_extensions_.clear(); 412 permitted_extensions_.clear();
411 pending_scripts_.clear(); 413 pending_scripts_.clear();
412 web_request_blocked_.clear(); 414 web_request_blocked_.clear();
413 was_used_on_page_ = false; 415 was_used_on_page_ = false;
414 weak_factory_.InvalidateWeakPtrs(); 416 weak_factory_.InvalidateWeakPtrs();
415 } 417 }
416 418
417 void ExtensionActionRunner::OnExtensionUnloaded( 419 void ExtensionActionRunner::OnExtensionUnloaded(
418 content::BrowserContext* browser_context, 420 content::BrowserContext* browser_context,
419 const Extension* extension, 421 const Extension* extension,
420 UnloadedExtensionInfo::Reason reason) { 422 UnloadedExtensionInfo::Reason reason) {
421 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id()); 423 PendingScriptMap::iterator iter = pending_scripts_.find(extension->id());
422 if (iter != pending_scripts_.end()) { 424 if (iter != pending_scripts_.end()) {
423 pending_scripts_.erase(iter); 425 pending_scripts_.erase(iter);
424 ExtensionActionAPI::Get(browser_context_) 426 ExtensionActionAPI::Get(browser_context_)
425 ->NotifyPageActionsChanged(web_contents()); 427 ->NotifyPageActionsChanged(web_contents());
426 } 428 }
427 } 429 }
428 430
429 } // namespace extensions 431 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_action_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698