| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/web_applications/web_app_ui.h" | 5 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| 11 #include "base/string16.h" | 11 #include "base/string16.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/extensions/image_loader.h" | 13 #include "chrome/browser/extensions/image_loader.h" |
| 14 #include "chrome/browser/extensions/tab_helper.h" | 14 #include "chrome/browser/extensions/tab_helper.h" |
| 15 #include "chrome/browser/favicon/favicon_tab_helper.h" | 15 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 16 #include "chrome/browser/favicon/favicon_util.h" | 16 #include "chrome/browser/favicon/favicon_util.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/web_applications/web_app.h" | 18 #include "chrome/browser/web_applications/web_app.h" |
| 19 #include "chrome/common/chrome_notification_types.h" | 19 #include "chrome/common/chrome_notification_types.h" |
| 20 #include "chrome/common/extensions/api/icons/icons_handler.h" | 20 #include "chrome/common/extensions/api/icons/icons_handler.h" |
| 21 #include "chrome/common/extensions/app_launcher_info.h" |
| 21 #include "chrome/common/extensions/extension.h" | 22 #include "chrome/common/extensions/extension.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 23 #include "content/public/browser/notification_details.h" | 24 #include "content/public/browser/notification_details.h" |
| 24 #include "content/public/browser/notification_registrar.h" | 25 #include "content/public/browser/notification_registrar.h" |
| 25 #include "content/public/browser/notification_source.h" | 26 #include "content/public/browser/notification_source.h" |
| 26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
| 27 #include "googleurl/src/gurl.h" | 28 #include "googleurl/src/gurl.h" |
| 28 #include "grit/theme_resources.h" | 29 #include "grit/theme_resources.h" |
| 29 #include "skia/ext/image_operations.h" | 30 #include "skia/ext/image_operations.h" |
| 30 #include "third_party/skia/include/core/SkBitmap.h" | 31 #include "third_party/skia/include/core/SkBitmap.h" |
| (...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); | 382 UpdateShortcutWorker* worker = new UpdateShortcutWorker(web_contents); |
| 382 worker->Run(); | 383 worker->Run(); |
| 383 #endif // defined(OS_WIN) | 384 #endif // defined(OS_WIN) |
| 384 } | 385 } |
| 385 | 386 |
| 386 void UpdateShortcutInfoForApp(const extensions::Extension& app, | 387 void UpdateShortcutInfoForApp(const extensions::Extension& app, |
| 387 Profile* profile, | 388 Profile* profile, |
| 388 ShellIntegration::ShortcutInfo* shortcut_info) { | 389 ShellIntegration::ShortcutInfo* shortcut_info) { |
| 389 shortcut_info->extension_id = app.id(); | 390 shortcut_info->extension_id = app.id(); |
| 390 shortcut_info->is_platform_app = app.is_platform_app(); | 391 shortcut_info->is_platform_app = app.is_platform_app(); |
| 391 shortcut_info->url = GURL(app.launch_web_url()); | 392 shortcut_info->url = GURL(extensions::AppLauncherInfo::GetLaunchWebURL(&app)); |
| 392 shortcut_info->title = UTF8ToUTF16(app.name()); | 393 shortcut_info->title = UTF8ToUTF16(app.name()); |
| 393 shortcut_info->description = UTF8ToUTF16(app.description()); | 394 shortcut_info->description = UTF8ToUTF16(app.description()); |
| 394 shortcut_info->extension_path = app.path(); | 395 shortcut_info->extension_path = app.path(); |
| 395 shortcut_info->profile_path = profile->GetPath(); | 396 shortcut_info->profile_path = profile->GetPath(); |
| 396 } | 397 } |
| 397 | 398 |
| 398 void UpdateShortcutInfoAndIconForApp( | 399 void UpdateShortcutInfoAndIconForApp( |
| 399 const extensions::Extension& extension, | 400 const extensions::Extension& extension, |
| 400 Profile* profile, | 401 Profile* profile, |
| 401 const web_app::ShortcutInfoCallback& callback) { | 402 const web_app::ShortcutInfoCallback& callback) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 437 } | 438 } |
| 438 | 439 |
| 439 // |info_list| may still be empty at this point, in which case LoadImage | 440 // |info_list| may still be empty at this point, in which case LoadImage |
| 440 // will call the OnImageLoaded callback with an empty image and exit | 441 // will call the OnImageLoaded callback with an empty image and exit |
| 441 // immediately. | 442 // immediately. |
| 442 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, | 443 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, |
| 443 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 444 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
| 444 } | 445 } |
| 445 | 446 |
| 446 } // namespace web_app | 447 } // namespace web_app |
| OLD | NEW |