| 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 struct RunnableMethodTraits<CreateShortcutCommand> { | 229 void RunnableMethodTraits<CreateShortcutCommand>::RetainCallee( |
| 230 void RetainCallee(CreateShortcutCommand*) {} | 230 CreateShortcutCommand* remover) { |
| 231 void ReleaseCallee(CreateShortcutCommand*) {} | 231 } |
| 232 }; | 232 template<> |
| 233 void RunnableMethodTraits<CreateShortcutCommand>::ReleaseCallee( |
| 234 CreateShortcutCommand* remover) { |
| 235 } |
| 233 | 236 |
| 234 void GearsCreateShortcut( | 237 void GearsCreateShortcut( |
| 235 const webkit_glue::WebApplicationInfo& app_info, | 238 const webkit_glue::WebApplicationInfo& app_info, |
| 236 const std::wstring& fallback_name, | 239 const std::wstring& fallback_name, |
| 237 const GURL& fallback_url, | 240 const GURL& fallback_url, |
| 238 const SkBitmap& fallback_icon, | 241 const SkBitmap& fallback_icon, |
| 239 GearsCreateShortcutCallback* callback) { | 242 GearsCreateShortcutCallback* callback) { |
| 240 std::wstring name = | 243 std::wstring name = |
| 241 !app_info.title.empty() ? app_info.title : fallback_name; | 244 !app_info.title.empty() ? app_info.title : fallback_name; |
| 242 std::string orig_name_utf8 = WideToUTF8(name); | 245 std::string orig_name_utf8 = WideToUTF8(name); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 CPB_Free(shortcut_list_.shortcuts); | 292 CPB_Free(shortcut_list_.shortcuts); |
| 290 } | 293 } |
| 291 | 294 |
| 292 GearsShortcutList shortcut_list_; | 295 GearsShortcutList shortcut_list_; |
| 293 scoped_ptr<GearsQueryShortcutsCallback> callback_; | 296 scoped_ptr<GearsQueryShortcutsCallback> callback_; |
| 294 MessageLoop* calling_loop_; | 297 MessageLoop* calling_loop_; |
| 295 }; | 298 }; |
| 296 | 299 |
| 297 // Allows InvokeLater without adding refcounting. The object is only deleted | 300 // Allows InvokeLater without adding refcounting. The object is only deleted |
| 298 // when its last InvokeLater is run anyway. | 301 // when its last InvokeLater is run anyway. |
| 299 template <> | 302 template<> |
| 300 struct RunnableMethodTraits<QueryShortcutsCommand> { | 303 void RunnableMethodTraits<QueryShortcutsCommand>::RetainCallee( |
| 301 void RetainCallee(QueryShortcutsCommand*) {} | 304 QueryShortcutsCommand* remover) { |
| 302 void ReleaseCallee(QueryShortcutsCommand*) {} | 305 } |
| 303 }; | 306 template<> |
| 307 void RunnableMethodTraits<QueryShortcutsCommand>::ReleaseCallee( |
| 308 QueryShortcutsCommand* remover) { |
| 309 } |
| 304 | 310 |
| 305 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback) { | 311 void GearsQueryShortcuts(GearsQueryShortcutsCallback* callback) { |
| 306 CPHandleCommand(GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST, | 312 CPHandleCommand(GEARSPLUGINCOMMAND_GET_SHORTCUT_LIST, |
| 307 new QueryShortcutsCommand(callback), | 313 new QueryShortcutsCommand(callback), |
| 308 NULL); | 314 NULL); |
| 309 } | 315 } |
| OLD | NEW |