OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_tab_helper.h" | 5 #include "chrome/browser/extensions/extension_tab_helper.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/extensions/webstore_inline_installer.h" | 8 #include "chrome/browser/extensions/webstore_inline_installer.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/sessions/restore_tab_helper.h" | 10 #include "chrome/browser/sessions/restore_tab_helper.h" |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 const content::FrameNavigateParams& params) { | 91 const content::FrameNavigateParams& params) { |
92 if (details.is_in_page) | 92 if (details.is_in_page) |
93 return; | 93 return; |
94 | 94 |
95 Profile* profile = | 95 Profile* profile = |
96 Profile::FromBrowserContext(tab_contents()->browser_context()); | 96 Profile::FromBrowserContext(tab_contents()->browser_context()); |
97 ExtensionService* service = profile->GetExtensionService(); | 97 ExtensionService* service = profile->GetExtensionService(); |
98 if (!service) | 98 if (!service) |
99 return; | 99 return; |
100 | 100 |
101 for (size_t i = 0; i < service->extensions()->size(); ++i) { | 101 for (ExtensionSet::const_iterator it = service->extensions()->begin(); |
102 ExtensionAction* browser_action = | 102 it != service->extensions()->end(); ++it) { |
103 service->extensions()->at(i)->browser_action(); | 103 ExtensionAction* browser_action = (*it)->browser_action(); |
104 if (browser_action) { | 104 if (browser_action) { |
105 browser_action->ClearAllValuesForTab( | 105 browser_action->ClearAllValuesForTab( |
106 wrapper_->restore_tab_helper()->session_id().id()); | 106 wrapper_->restore_tab_helper()->session_id().id()); |
107 content::NotificationService::current()->Notify( | 107 content::NotificationService::current()->Notify( |
108 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, | 108 chrome::NOTIFICATION_EXTENSION_BROWSER_ACTION_UPDATED, |
109 content::Source<ExtensionAction>(browser_action), | 109 content::Source<ExtensionAction>(browser_action), |
110 content::NotificationService::NoDetails()); | 110 content::NotificationService::NoDetails()); |
111 } | 111 } |
112 | 112 |
113 ExtensionAction* page_action = | 113 ExtensionAction* page_action = (*it)->page_action(); |
114 service->extensions()->at(i)->page_action(); | |
115 if (page_action) { | 114 if (page_action) { |
116 page_action->ClearAllValuesForTab( | 115 page_action->ClearAllValuesForTab( |
117 wrapper_->restore_tab_helper()->session_id().id()); | 116 wrapper_->restore_tab_helper()->session_id().id()); |
118 PageActionStateChanged(); | 117 PageActionStateChanged(); |
119 } | 118 } |
120 } | 119 } |
121 } | 120 } |
122 | 121 |
123 bool ExtensionTabHelper::OnMessageReceived(const IPC::Message& message) { | 122 bool ExtensionTabHelper::OnMessageReceived(const IPC::Message& message) { |
124 bool handled = true; | 123 bool handled = true; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 } | 280 } |
282 | 281 |
283 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { | 282 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { |
284 return tab_contents(); | 283 return tab_contents(); |
285 } | 284 } |
286 | 285 |
287 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { | 286 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { |
288 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); | 287 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); |
289 return rwhv ? rwhv->GetNativeView() : NULL; | 288 return rwhv ? rwhv->GetNativeView() : NULL; |
290 } | 289 } |
OLD | NEW |