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

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

Issue 10834184: Copy the !details.is_in_page restriction from TabHelper to PageActionController::DidNavigateMainFra… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | 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 #include "chrome/browser/extensions/page_action_controller.h" 5 #include "chrome/browser/extensions/page_action_controller.h"
6 6
7 #include "chrome/browser/extensions/browser_event_router.h" 7 #include "chrome/browser/extensions/browser_event_router.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/extensions/tab_helper.h" 10 #include "chrome/browser/extensions/tab_helper.h"
11 #include "chrome/browser/extensions/extension_tab_util.h" 11 #include "chrome/browser/extensions/extension_tab_util.h"
12 #include "chrome/browser/sessions/session_id.h" 12 #include "chrome/browser/sessions/session_id.h"
13 #include "chrome/browser/ui/tab_contents/tab_contents.h" 13 #include "chrome/browser/ui/tab_contents/tab_contents.h"
14 #include "chrome/common/extensions/extension_set.h" 14 #include "chrome/common/extensions/extension_set.h"
15 #include "chrome/common/chrome_notification_types.h" 15 #include "chrome/common/chrome_notification_types.h"
16 #include "content/public/browser/invalidate_type.h" 16 #include "content/public/browser/invalidate_type.h"
17 #include "content/public/browser/navigation_details.h"
17 #include "content/public/browser/notification_service.h" 18 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/web_contents.h" 19 #include "content/public/browser/web_contents.h"
19 20
20 namespace extensions { 21 namespace extensions {
21 22
22 PageActionController::PageActionController(TabContents* tab_contents) 23 PageActionController::PageActionController(TabContents* tab_contents)
23 : content::WebContentsObserver(tab_contents->web_contents()), 24 : content::WebContentsObserver(tab_contents->web_contents()),
24 tab_contents_(tab_contents) {} 25 tab_contents_(tab_contents) {}
25 26
26 PageActionController::~PageActionController() {} 27 PageActionController::~PageActionController() {}
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 } 80 }
80 81
81 void PageActionController::NotifyChange() { 82 void PageActionController::NotifyChange() {
82 tab_contents_->web_contents()->NotifyNavigationStateChanged( 83 tab_contents_->web_contents()->NotifyNavigationStateChanged(
83 content::INVALIDATE_TYPE_PAGE_ACTIONS); 84 content::INVALIDATE_TYPE_PAGE_ACTIONS);
84 } 85 }
85 86
86 void PageActionController::DidNavigateMainFrame( 87 void PageActionController::DidNavigateMainFrame(
87 const content::LoadCommittedDetails& details, 88 const content::LoadCommittedDetails& details,
88 const content::FrameNavigateParams& params) { 89 const content::FrameNavigateParams& params) {
90 if (details.is_in_page)
91 return;
92
89 const std::vector<ExtensionAction*> current_actions = GetCurrentActions(); 93 const std::vector<ExtensionAction*> current_actions = GetCurrentActions();
not at google - send to devlin 2012/08/06 22:09:19 remind me why we clear page actions on navigation?
Jeffrey Yasskin 2012/08/06 22:24:25 I believe a page action is a statement that an ext
90 94
91 if (current_actions.empty()) 95 if (current_actions.empty())
92 return; 96 return;
93 97
94 for (size_t i = 0; i < current_actions.size(); ++i) { 98 for (size_t i = 0; i < current_actions.size(); ++i) {
95 current_actions[i]->ClearAllValuesForTab( 99 current_actions[i]->ClearAllValuesForTab(
96 SessionID::IdForTab(tab_contents_)); 100 SessionID::IdForTab(tab_contents_));
97 } 101 }
98 102
99 NotifyChange(); 103 NotifyChange();
100 } 104 }
101 105
102 ExtensionService* PageActionController::GetExtensionService() const { 106 ExtensionService* PageActionController::GetExtensionService() const {
103 return ExtensionSystem::Get(tab_contents_->profile())->extension_service(); 107 return ExtensionSystem::Get(tab_contents_->profile())->extension_service();
104 } 108 }
105 109
106 } // namespace extensions 110 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698