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/extensions/extension_sidebar_api.h" | 5 #include "chrome/browser/extensions/extension_sidebar_api.h" |
6 | 6 |
7 #include "base/json/json_writer.h" | 7 #include "base/json/json_writer.h" |
8 #include "base/string_number_conversions.h" | 8 #include "base/string_number_conversions.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/string16.h" | 10 #include "base/string16.h" |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 string16 badge_text; | 222 string16 badge_text; |
223 EXTENSION_FUNCTION_VALIDATE(details.GetString(kBadgeTextKey, &badge_text)); | 223 EXTENSION_FUNCTION_VALIDATE(details.GetString(kBadgeTextKey, &badge_text)); |
224 SidebarManager::GetInstance()->SetSidebarBadgeText( | 224 SidebarManager::GetInstance()->SetSidebarBadgeText( |
225 tab, content_id, badge_text); | 225 tab, content_id, badge_text); |
226 return true; | 226 return true; |
227 } | 227 } |
228 | 228 |
229 bool SetIconSidebarFunction::RunImpl(TabContents* tab, | 229 bool SetIconSidebarFunction::RunImpl(TabContents* tab, |
230 const std::string& content_id, | 230 const std::string& content_id, |
231 const DictionaryValue& details) { | 231 const DictionaryValue& details) { |
232 BinaryValue* binary; | 232 base::BinaryValue* binary; |
233 EXTENSION_FUNCTION_VALIDATE(details.GetBinary(kImageDataKey, &binary)); | 233 EXTENSION_FUNCTION_VALIDATE(details.GetBinary(kImageDataKey, &binary)); |
234 IPC::Message bitmap_pickle(binary->GetBuffer(), binary->GetSize()); | 234 IPC::Message bitmap_pickle(binary->GetBuffer(), binary->GetSize()); |
235 void* iter = NULL; | 235 void* iter = NULL; |
236 scoped_ptr<SkBitmap> bitmap(new SkBitmap); | 236 scoped_ptr<SkBitmap> bitmap(new SkBitmap); |
237 EXTENSION_FUNCTION_VALIDATE( | 237 EXTENSION_FUNCTION_VALIDATE( |
238 IPC::ReadParam(&bitmap_pickle, &iter, bitmap.get())); | 238 IPC::ReadParam(&bitmap_pickle, &iter, bitmap.get())); |
239 SidebarManager::GetInstance()->SetSidebarIcon(tab, content_id, *bitmap); | 239 SidebarManager::GetInstance()->SetSidebarIcon(tab, content_id, *bitmap); |
240 return true; | 240 return true; |
241 } | 241 } |
242 | 242 |
243 bool SetTitleSidebarFunction::RunImpl(TabContents* tab, | 243 bool SetTitleSidebarFunction::RunImpl(TabContents* tab, |
244 const std::string& content_id, | 244 const std::string& content_id, |
245 const DictionaryValue& details) { | 245 const DictionaryValue& details) { |
246 string16 title; | 246 string16 title; |
247 EXTENSION_FUNCTION_VALIDATE(details.GetString(kTitleKey, &title)); | 247 EXTENSION_FUNCTION_VALIDATE(details.GetString(kTitleKey, &title)); |
248 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title); | 248 SidebarManager::GetInstance()->SetSidebarTitle(tab, content_id, title); |
249 return true; | 249 return true; |
250 } | 250 } |
251 | 251 |
252 bool ShowSidebarFunction::RunImpl(TabContents* tab, | 252 bool ShowSidebarFunction::RunImpl(TabContents* tab, |
253 const std::string& content_id, | 253 const std::string& content_id, |
254 const DictionaryValue& details) { | 254 const DictionaryValue& details) { |
255 SidebarManager::GetInstance()->ShowSidebar(tab, content_id); | 255 SidebarManager::GetInstance()->ShowSidebar(tab, content_id); |
256 return true; | 256 return true; |
257 } | 257 } |
OLD | NEW |