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

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

Issue 10912156: Move SessionID, CaptureVisibleTabFunction to WebContents. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase atop the extension tab helper change Created 8 years, 3 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
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/tab_helper.h" 5 #include "chrome/browser/extensions/tab_helper.h"
6 6
7 #include "chrome/browser/extensions/app_notify_channel_ui.h" 7 #include "chrome/browser/extensions/app_notify_channel_ui.h"
8 #include "chrome/browser/extensions/crx_installer.h" 8 #include "chrome/browser/extensions/crx_installer.h"
9 #include "chrome/browser/extensions/extension_service.h" 9 #include "chrome/browser/extensions/extension_service.h"
10 #include "chrome/browser/extensions/extension_tab_util.h" 10 #include "chrome/browser/extensions/extension_tab_util.h"
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 : content::WebContentsObserver(web_contents), 57 : content::WebContentsObserver(web_contents),
58 extension_app_(NULL), 58 extension_app_(NULL),
59 ALLOW_THIS_IN_INITIALIZER_LIST( 59 ALLOW_THIS_IN_INITIALIZER_LIST(
60 extension_function_dispatcher_( 60 extension_function_dispatcher_(
61 Profile::FromBrowserContext(web_contents->GetBrowserContext()), 61 Profile::FromBrowserContext(web_contents->GetBrowserContext()),
62 this)), 62 this)),
63 pending_web_app_action_(NONE), 63 pending_web_app_action_(NONE),
64 script_executor_(web_contents), 64 script_executor_(web_contents),
65 active_tab_permission_manager_( 65 active_tab_permission_manager_(
66 web_contents, 66 web_contents,
67 SessionID::IdForTab(TabContents::FromWebContents(web_contents)), 67 SessionID::IdForTab(web_contents),
68 Profile::FromBrowserContext(web_contents->GetBrowserContext())) { 68 Profile::FromBrowserContext(web_contents->GetBrowserContext())) {
69 if (switch_utils::AreScriptBadgesEnabled()) { 69 if (switch_utils::AreScriptBadgesEnabled()) {
70 location_bar_controller_.reset( 70 location_bar_controller_.reset(
71 new ScriptBadgeController(web_contents, &script_executor_)); 71 new ScriptBadgeController(web_contents, &script_executor_));
72 } else { 72 } else {
73 location_bar_controller_.reset( 73 location_bar_controller_.reset(
74 new PageActionController(web_contents)); 74 new PageActionController(web_contents));
75 } 75 }
76 registrar_.Add(this, 76 registrar_.Add(this,
77 content::NOTIFICATION_LOAD_STOP, 77 content::NOTIFICATION_LOAD_STOP,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 } 130 }
131 131
132 SkBitmap* TabHelper::GetExtensionAppIcon() { 132 SkBitmap* TabHelper::GetExtensionAppIcon() {
133 if (extension_app_icon_.empty()) 133 if (extension_app_icon_.empty())
134 return NULL; 134 return NULL;
135 135
136 return &extension_app_icon_; 136 return &extension_app_icon_;
137 } 137 }
138 138
139 void TabHelper::RenderViewCreated(RenderViewHost* render_view_host) { 139 void TabHelper::RenderViewCreated(RenderViewHost* render_view_host) {
140 TabContents* tab_contents = TabContents::FromWebContents(web_contents());
141 render_view_host->Send( 140 render_view_host->Send(
142 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(), 141 new ExtensionMsg_SetTabId(render_view_host->GetRoutingID(),
143 SessionID::IdForTab(tab_contents))); 142 SessionID::IdForTab(web_contents())));
144 } 143 }
145 144
146 void TabHelper::DidNavigateMainFrame( 145 void TabHelper::DidNavigateMainFrame(
147 const content::LoadCommittedDetails& details, 146 const content::LoadCommittedDetails& details,
148 const content::FrameNavigateParams& params) { 147 const content::FrameNavigateParams& params) {
149 if (details.is_in_page) 148 if (details.is_in_page)
150 return; 149 return;
151 150
152 Profile* profile = 151 Profile* profile =
153 Profile::FromBrowserContext(web_contents()->GetBrowserContext()); 152 Profile::FromBrowserContext(web_contents()->GetBrowserContext());
154 ExtensionService* service = profile->GetExtensionService(); 153 ExtensionService* service = profile->GetExtensionService();
155 if (!service) 154 if (!service)
156 return; 155 return;
157 156
158 TabContents* tab_contents = TabContents::FromWebContents(web_contents());
159 for (ExtensionSet::const_iterator it = service->extensions()->begin(); 157 for (ExtensionSet::const_iterator it = service->extensions()->begin();
160 it != service->extensions()->end(); ++it) { 158 it != service->extensions()->end(); ++it) {
161 ExtensionAction* browser_action = (*it)->browser_action(); 159 ExtensionAction* browser_action = (*it)->browser_action();
162 if (browser_action) { 160 if (browser_action) {
163 browser_action->ClearAllValuesForTab(SessionID::IdForTab(tab_contents)); 161 browser_action->ClearAllValuesForTab(SessionID::IdForTab(web_contents()));
164 content::NotificationService::current()->Notify( 162 content::NotificationService::current()->Notify(
165 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, 163 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED,
166 content::Source<ExtensionAction>(browser_action), 164 content::Source<ExtensionAction>(browser_action),
167 content::NotificationService::NoDetails()); 165 content::NotificationService::NoDetails());
168 } 166 }
169 } 167 }
170 } 168 }
171 169
172 bool TabHelper::OnMessageReceived(const IPC::Message& message) { 170 bool TabHelper::OnMessageReceived(const IPC::Message& message) {
173 bool handled = true; 171 bool handled = true;
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 // malware site etc). When this happens, we abort the shortcut update. 446 // malware site etc). When this happens, we abort the shortcut update.
449 NavigationEntry* entry = controller.GetLastCommittedEntry(); 447 NavigationEntry* entry = controller.GetLastCommittedEntry();
450 if (entry) 448 if (entry)
451 GetApplicationInfo(entry->GetPageID()); 449 GetApplicationInfo(entry->GetPageID());
452 else 450 else
453 pending_web_app_action_ = NONE; 451 pending_web_app_action_ = NONE;
454 } 452 }
455 } 453 }
456 454
457 } // namespace extensions 455 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/script_badge_controller.cc ('k') | chrome/browser/sessions/session_id.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698