OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/sidebar/sidebar_container.h" | 5 #include "chrome/browser/sidebar/sidebar_container.h" |
6 | 6 |
7 #include "chrome/browser/extensions/extension_service.h" | 7 #include "chrome/browser/extensions/extension_service.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/common/extensions/extension.h" | 9 #include "chrome/common/extensions/extension.h" |
10 #include "chrome/common/extensions/extension_resource.h" | 10 #include "chrome/common/extensions/extension_resource.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 delegate_(delegate), | 28 delegate_(delegate), |
29 icon_(new SkBitmap), | 29 icon_(new SkBitmap), |
30 navigate_to_default_page_on_expand_(true), | 30 navigate_to_default_page_on_expand_(true), |
31 use_default_icon_(true) { | 31 use_default_icon_(true) { |
32 // Create TabContents for sidebar. | 32 // Create TabContents for sidebar. |
33 sidebar_contents_.reset( | 33 sidebar_contents_.reset( |
34 new TabContents(tab->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)); | 34 new TabContents(tab->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)); |
35 sidebar_contents_->render_view_host()->set_is_extension_process(true); | 35 sidebar_contents_->render_view_host()->set_is_extension_process(true); |
36 const Extension* extension = GetExtension(); | 36 const Extension* extension = GetExtension(); |
37 if (extension && extension->is_app()) { | 37 if (extension && extension->is_app()) { |
38 BrowserRenderProcessHost* process = static_cast<BrowserRenderProcessHost*>( | 38 ExtensionService* service = tab->profile()->GetExtensionService(); |
39 sidebar_contents_->render_view_host()->process()); | 39 if (service) { |
40 process->set_installed_app(extension); | 40 service->SetInstalledAppForRenderer( |
| 41 sidebar_contents_->render_view_host()->process()->id(), extension); |
| 42 } |
41 } | 43 } |
42 sidebar_contents_->render_view_host()->AllowBindings( | 44 sidebar_contents_->render_view_host()->AllowBindings( |
43 BindingsPolicy::EXTENSION); | 45 BindingsPolicy::EXTENSION); |
44 sidebar_contents_->set_delegate(this); | 46 sidebar_contents_->set_delegate(this); |
45 } | 47 } |
46 | 48 |
47 SidebarContainer::~SidebarContainer() { | 49 SidebarContainer::~SidebarContainer() { |
48 } | 50 } |
49 | 51 |
50 void SidebarContainer::SidebarClosing() { | 52 void SidebarContainer::SidebarClosing() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 130 } |
129 | 131 |
130 const Extension* SidebarContainer::GetExtension() const { | 132 const Extension* SidebarContainer::GetExtension() const { |
131 ExtensionService* service = | 133 ExtensionService* service = |
132 sidebar_contents_->profile()->GetExtensionService(); | 134 sidebar_contents_->profile()->GetExtensionService(); |
133 if (!service) | 135 if (!service) |
134 return NULL; | 136 return NULL; |
135 return service->GetExtensionById( | 137 return service->GetExtensionById( |
136 extension_sidebar_utils::GetExtensionIdByContentId(content_id_), false); | 138 extension_sidebar_utils::GetExtensionIdByContentId(content_id_), false); |
137 } | 139 } |
OLD | NEW |