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/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/browser/ui/app_modal_dialogs/message_box_handler.h" | 9 #include "chrome/browser/ui/app_modal_dialogs/message_box_handler.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 | 99 |
100 void SidebarContainer::SetIcon(const SkBitmap& bitmap) { | 100 void SidebarContainer::SetIcon(const SkBitmap& bitmap) { |
101 use_default_icon_ = false; | 101 use_default_icon_ = false; |
102 *icon_ = bitmap; | 102 *icon_ = bitmap; |
103 } | 103 } |
104 | 104 |
105 void SidebarContainer::SetTitle(const string16& title) { | 105 void SidebarContainer::SetTitle(const string16& title) { |
106 title_ = title; | 106 title_ = title; |
107 } | 107 } |
108 | 108 |
109 bool SidebarContainer::IsPopup(const TabContents* source) const { | |
110 return false; | |
111 } | |
112 | |
113 content::JavaScriptDialogCreator* | 109 content::JavaScriptDialogCreator* |
114 SidebarContainer::GetJavaScriptDialogCreator() { | 110 SidebarContainer::GetJavaScriptDialogCreator() { |
115 return GetJavaScriptDialogCreatorInstance(); | 111 return GetJavaScriptDialogCreatorInstance(); |
116 } | 112 } |
117 | 113 |
118 void SidebarContainer::OnImageLoaded(SkBitmap* image, | 114 void SidebarContainer::OnImageLoaded(SkBitmap* image, |
119 const ExtensionResource& resource, | 115 const ExtensionResource& resource, |
120 int index) { | 116 int index) { |
121 if (image && use_default_icon_) { | 117 if (image && use_default_icon_) { |
122 *icon_ = *image; | 118 *icon_ = *image; |
123 delegate_->UpdateSidebar(this); | 119 delegate_->UpdateSidebar(this); |
124 } | 120 } |
125 } | 121 } |
126 | 122 |
127 const Extension* SidebarContainer::GetExtension() const { | 123 const Extension* SidebarContainer::GetExtension() const { |
128 Profile* profile = | 124 Profile* profile = |
129 Profile::FromBrowserContext(sidebar_contents_->browser_context()); | 125 Profile::FromBrowserContext(sidebar_contents_->browser_context()); |
130 ExtensionService* service = profile->GetExtensionService(); | 126 ExtensionService* service = profile->GetExtensionService(); |
131 if (!service) | 127 if (!service) |
132 return NULL; | 128 return NULL; |
133 return service->GetExtensionById( | 129 return service->GetExtensionById( |
134 extension_sidebar_utils::GetExtensionIdByContentId(content_id_), false); | 130 extension_sidebar_utils::GetExtensionIdByContentId(content_id_), false); |
135 } | 131 } |
OLD | NEW |