| 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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 extension->HasAPIPermission( | 180 extension->HasAPIPermission( |
| 181 ExtensionAPIPermission::kExperimental) && | 181 ExtensionAPIPermission::kExperimental) && |
| 182 (extension->is_hosted_app() || | 182 (extension->is_hosted_app() || |
| 183 process_manager->GetExtensionProcess(requestor_url) == process); | 183 process_manager->GetExtensionProcess(requestor_url) == process); |
| 184 if (!allowed) { | 184 if (!allowed) { |
| 185 AppNotifyChannelSetupComplete("", "permission_error", return_route_id, | 185 AppNotifyChannelSetupComplete("", "permission_error", return_route_id, |
| 186 callback_id); | 186 callback_id); |
| 187 return; | 187 return; |
| 188 } | 188 } |
| 189 | 189 |
| 190 AppNotifyChannelUI* ui = new AppNotifyChannelUIImpl( |
| 191 GetBrowser(), tab_contents_wrapper(), extension->name()); |
| 192 |
| 190 scoped_refptr<AppNotifyChannelSetup> channel_setup( | 193 scoped_refptr<AppNotifyChannelSetup> channel_setup( |
| 191 new AppNotifyChannelSetup(profile, | 194 new AppNotifyChannelSetup(profile, |
| 192 client_id, | 195 client_id, |
| 193 requestor_url, | 196 requestor_url, |
| 194 return_route_id, | 197 return_route_id, |
| 195 callback_id, | 198 callback_id, |
| 199 ui, |
| 196 this->AsWeakPtr())); | 200 this->AsWeakPtr())); |
| 197 channel_setup->Start(); | 201 channel_setup->Start(); |
| 198 // We'll get called back in AppNotifyChannelSetupComplete. | 202 // We'll get called back in AppNotifyChannelSetupComplete. |
| 199 } | 203 } |
| 200 | 204 |
| 201 void ExtensionTabHelper::AppNotifyChannelSetupComplete( | 205 void ExtensionTabHelper::AppNotifyChannelSetupComplete( |
| 202 const std::string& client_id, const std::string& error, int return_route_id, | 206 const std::string& client_id, const std::string& error, int return_route_id, |
| 203 int callback_id) { | 207 int callback_id) { |
| 204 Send(new ExtensionMsg_GetAppNotifyChannelResponse( | 208 Send(new ExtensionMsg_GetAppNotifyChannelResponse( |
| 205 return_route_id, client_id, error, callback_id)); | 209 return_route_id, client_id, error, callback_id)); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 } | 269 } |
| 266 | 270 |
| 267 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { | 271 TabContents* ExtensionTabHelper::GetAssociatedTabContents() const { |
| 268 return tab_contents(); | 272 return tab_contents(); |
| 269 } | 273 } |
| 270 | 274 |
| 271 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { | 275 gfx::NativeView ExtensionTabHelper::GetNativeViewOfHost() { |
| 272 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); | 276 RenderWidgetHostView* rwhv = tab_contents()->GetRenderWidgetHostView(); |
| 273 return rwhv ? rwhv->GetNativeView() : NULL; | 277 return rwhv ? rwhv->GetNativeView() : NULL; |
| 274 } | 278 } |
| OLD | NEW |