| 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/bindings_policy.h" | 9 #include "chrome/common/bindings_policy.h" |
| 10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 : tab_(tab), | 25 : tab_(tab), |
| 26 content_id_(content_id), | 26 content_id_(content_id), |
| 27 delegate_(delegate), | 27 delegate_(delegate), |
| 28 icon_(new SkBitmap), | 28 icon_(new SkBitmap), |
| 29 navigate_to_default_page_on_expand_(true), | 29 navigate_to_default_page_on_expand_(true), |
| 30 use_default_icon_(true) { | 30 use_default_icon_(true) { |
| 31 // Create TabContents for sidebar. | 31 // Create TabContents for sidebar. |
| 32 sidebar_contents_.reset( | 32 sidebar_contents_.reset( |
| 33 new TabContents(tab->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)); | 33 new TabContents(tab->profile(), NULL, MSG_ROUTING_NONE, NULL, NULL)); |
| 34 sidebar_contents_->render_view_host()->set_is_extension_process(true); | 34 sidebar_contents_->render_view_host()->set_is_extension_process(true); |
| 35 const Extension* extension = GetExtension(); |
| 36 if (extension && extension->is_app()) |
| 37 sidebar_contents_->render_view_host()->set_installed_app(extension); |
| 35 sidebar_contents_->render_view_host()->AllowBindings( | 38 sidebar_contents_->render_view_host()->AllowBindings( |
| 36 BindingsPolicy::EXTENSION); | 39 BindingsPolicy::EXTENSION); |
| 37 sidebar_contents_->set_delegate(this); | 40 sidebar_contents_->set_delegate(this); |
| 38 } | 41 } |
| 39 | 42 |
| 40 SidebarContainer::~SidebarContainer() { | 43 SidebarContainer::~SidebarContainer() { |
| 41 } | 44 } |
| 42 | 45 |
| 43 void SidebarContainer::SidebarClosing() { | 46 void SidebarContainer::SidebarClosing() { |
| 44 delegate_->UpdateSidebar(this); | 47 delegate_->UpdateSidebar(this); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 124 } |
| 122 | 125 |
| 123 const Extension* SidebarContainer::GetExtension() const { | 126 const Extension* SidebarContainer::GetExtension() const { |
| 124 ExtensionService* service = | 127 ExtensionService* service = |
| 125 sidebar_contents_->profile()->GetExtensionService(); | 128 sidebar_contents_->profile()->GetExtensionService(); |
| 126 if (!service) | 129 if (!service) |
| 127 return NULL; | 130 return NULL; |
| 128 return service->GetExtensionById( | 131 return service->GetExtensionById( |
| 129 extension_sidebar_utils::GetExtensionIdByContentId(content_id_), false); | 132 extension_sidebar_utils::GetExtensionIdByContentId(content_id_), false); |
| 130 } | 133 } |
| OLD | NEW |