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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/webstore_inline_installer.h" | 9 #include "chrome/browser/extensions/webstore_inline_installer.h" |
10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 if (wrapper_->delegate()) | 142 if (wrapper_->delegate()) |
143 wrapper_->delegate()->OnDidGetApplicationInfo(wrapper_, page_id); | 143 wrapper_->delegate()->OnDidGetApplicationInfo(wrapper_, page_id); |
144 } | 144 } |
145 | 145 |
146 void ExtensionTabHelper::OnInstallApplication(const WebApplicationInfo& info) { | 146 void ExtensionTabHelper::OnInstallApplication(const WebApplicationInfo& info) { |
147 if (wrapper_->delegate()) | 147 if (wrapper_->delegate()) |
148 wrapper_->delegate()->OnInstallApplication(wrapper_, info); | 148 wrapper_->delegate()->OnInstallApplication(wrapper_, info); |
149 } | 149 } |
150 | 150 |
151 void ExtensionTabHelper::OnInlineWebstoreInstall( | 151 void ExtensionTabHelper::OnInlineWebstoreInstall( |
152 const std::string& webstore_item_id) { | 152 int install_id, |
| 153 const std::string& webstore_item_id, |
| 154 const GURL& requestor_url) { |
153 if (!CommandLine::ForCurrentProcess()->HasSwitch( | 155 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
154 switches::kEnableInlineWebstoreInstall)) { | 156 switches::kEnableInlineWebstoreInstall)) { |
155 return; | 157 return; |
156 } | 158 } |
157 | 159 |
158 scoped_refptr<WebstoreInlineInstaller> installer(new WebstoreInlineInstaller( | 160 scoped_refptr<WebstoreInlineInstaller> installer(new WebstoreInlineInstaller( |
159 tab_contents(), webstore_item_id, this)); | 161 tab_contents(), install_id, webstore_item_id, requestor_url, this)); |
160 installer->BeginInstall(); | 162 installer->BeginInstall(); |
161 } | 163 } |
162 | 164 |
163 void ExtensionTabHelper::OnRequest( | 165 void ExtensionTabHelper::OnRequest( |
164 const ExtensionHostMsg_Request_Params& request) { | 166 const ExtensionHostMsg_Request_Params& request) { |
165 extension_function_dispatcher_.Dispatch(request, | 167 extension_function_dispatcher_.Dispatch(request, |
166 tab_contents()->render_view_host()); | 168 tab_contents()->render_view_host()); |
167 } | 169 } |
168 | 170 |
169 void ExtensionTabHelper::UpdateExtensionAppIcon(const Extension* extension) { | 171 void ExtensionTabHelper::UpdateExtensionAppIcon(const Extension* extension) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 TabContents* contents = tab_contents(); | 203 TabContents* contents = tab_contents(); |
202 TabContentsIterator tab_iterator; | 204 TabContentsIterator tab_iterator; |
203 for (; !tab_iterator.done(); ++tab_iterator) { | 205 for (; !tab_iterator.done(); ++tab_iterator) { |
204 if (contents == (*tab_iterator)->tab_contents()) | 206 if (contents == (*tab_iterator)->tab_contents()) |
205 return tab_iterator.browser(); | 207 return tab_iterator.browser(); |
206 } | 208 } |
207 | 209 |
208 return NULL; | 210 return NULL; |
209 } | 211 } |
210 | 212 |
211 void ExtensionTabHelper::OnInlineInstallSuccess() { | 213 void ExtensionTabHelper::OnInlineInstallSuccess(int install_id) { |
212 Send(new ExtensionMsg_InlineWebstoreInstallResponse(routing_id(), true, "")); | 214 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
| 215 routing_id(), install_id, true, "")); |
213 } | 216 } |
214 | 217 |
215 void ExtensionTabHelper::OnInlineInstallFailure(const std::string& error) { | 218 void ExtensionTabHelper::OnInlineInstallFailure(int install_id, |
| 219 const std::string& error) { |
216 Send(new ExtensionMsg_InlineWebstoreInstallResponse( | 220 Send(new ExtensionMsg_InlineWebstoreInstallResponse( |
217 routing_id(), false, error)); | 221 routing_id(), install_id, false, error)); |
218 } | 222 } |
219 | 223 |
220 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { | 224 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { |
221 return tab_contents(); | 225 return tab_contents(); |
222 } | 226 } |
223 | 227 |
224 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { | 228 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { |
225 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); | 229 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); |
226 return rwhv ? rwhv->GetNativeView() : NULL; | 230 return rwhv ? rwhv->GetNativeView() : NULL; |
227 } | 231 } |
OLD | NEW |