OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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/gears_integration.h" | 5 #include "chrome/browser/gears_integration.h" |
6 | 6 |
7 #include "base/gfx/png_encoder.h" | 7 #include "base/gfx/png_encoder.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 std::string url_; | 218 std::string url_; |
219 std::string description_; | 219 std::string description_; |
220 std::string icon_urls_[NUM_GEARS_ICONS]; | 220 std::string icon_urls_[NUM_GEARS_ICONS]; |
221 std::string orig_name_; | 221 std::string orig_name_; |
222 scoped_ptr<GearsCreateShortcutCallback> callback_; | 222 scoped_ptr<GearsCreateShortcutCallback> callback_; |
223 MessageLoop* calling_loop_; | 223 MessageLoop* calling_loop_; |
224 }; | 224 }; |
225 | 225 |
226 // Allows InvokeLater without adding refcounting. The object is only deleted | 226 // Allows InvokeLater without adding refcounting. The object is only deleted |
227 // when its last InvokeLater is run anyway. | 227 // when its last InvokeLater is run anyway. |
228 template<> | 228 template <> |
229 void RunnableMethodTraits<CreateShortcutCommand>::RetainCallee( | 229 struct RunnableMethodTraits<CreateShortcutCommand> { |
230 CreateShortcutCommand* remover) { | 230 void RetainCallee(CreateShortcutCommand*) {} |
231 } | 231 void ReleaseCallee(CreateShortcutCommand*) {} |
232 template<> | 232 }; |
233 void RunnableMethodTraits<CreateShortcutCommand>::ReleaseCallee( | |
234 CreateShortcutCommand* remover) { | |
235 } | |
236 | 233 |
237 void GearsCreateShortcut( | 234 void GearsCreateShortcut( |
238 const webkit_glue::WebApplicationInfo& app_info, | 235 const webkit_glue::WebApplicationInfo& app_info, |
239 const std::wstring& fallback_name, | 236 const std::wstring& fallback_name, |
240 const GURL& fallback_url, | 237 const GURL& fallback_url, |
241 const SkBitmap& fallback_icon, | 238 const SkBitmap& fallback_icon, |
242 GearsCreateShortcutCallback* callback) { | 239 GearsCreateShortcutCallback* callback) { |
243 std::wstring name = | 240 std::wstring name = |
244 !app_info.title.empty() ? app_info.title : fallback_name; | 241 !app_info.title.empty() ? app_info.title : fallback_name; |
245 std::string orig_name_utf8 = WideToUTF8(name); | 242 std::string orig_name_utf8 = WideToUTF8(name); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 CPB_Free(shortcut_list_.shortcuts); | 289 CPB_Free(shortcut_list_.shortcuts); |
293 } | 290 } |
294 | 291 |
295 GearsShortcutList shortcut_list_; | 292 GearsShortcutList shortcut_list_; |
296 scoped_ptr<GearsQueryShortcutsCallback> callback_; | 293 scoped_ptr<GearsQueryShortcutsCallback> callback_; |
297 MessageLoop* calling_loop_; | 294 MessageLoop* calling_loop_; |
298 }; | 295 }; |
299 | 296 |
300 // Allows InvokeLater without adding refcounting. The object is only deleted | 297 // Allows InvokeLater without adding refcounting. The object is only deleted |
301 // when its last InvokeLater is run anyway. | 298 // when its last InvokeLater is run anyway. |
302 template<> | 299 template <> |
303 void RunnableMethodTraits<QueryShortcutsCommand>::RetainCallee( | 300 struct RunnableMethodTraits<QueryShortcutsCommand> { |
304 QueryShortcutsCommand* remover) { | 301 void RetainCallee(QueryShortcutsCommand*) {} |
305 } | 302 void ReleaseCallee(QueryShortcutsCommand*) {} |
306 template<> | 303 }; |
307 void RunnableMethodTraits<QueryShortcutsCommand>::ReleaseCallee( | |
308 QueryShortcutsCommand* remover) { | |
309 } | |
310 | 304 |
311 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback) { | 305 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback) { |
312 CPHandleCommand(GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST, | 306 CPHandleCommand(GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST, |
313 new QueryShortcutsCommand(callback), | 307 new QueryShortcutsCommand(callback), |
314 NULL); | 308 NULL); |
315 } | 309 } |
OLD | NEW |