| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bookmark_app_helper.h" | 5 #include "chrome/browser/extensions/bookmark_app_helper.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cctype> | 9 #include <cctype> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 #include "base/command_line.h" | 65 #include "base/command_line.h" |
| 66 #include "chrome/browser/web_applications/web_app_mac.h" | 66 #include "chrome/browser/web_applications/web_app_mac.h" |
| 67 #include "chrome/common/chrome_switches.h" | 67 #include "chrome/common/chrome_switches.h" |
| 68 #endif | 68 #endif |
| 69 | 69 |
| 70 #if defined(OS_WIN) | 70 #if defined(OS_WIN) |
| 71 #include "base/win/shortcut.h" | 71 #include "base/win/shortcut.h" |
| 72 #endif // defined(OS_WIN) | 72 #endif // defined(OS_WIN) |
| 73 | 73 |
| 74 #if defined(USE_ASH) | 74 #if defined(USE_ASH) |
| 75 #include "ash/shelf/shelf_delegate.h" | 75 #include "ash/common/shelf/shelf_delegate.h" |
| 76 #include "ash/shell.h" | 76 #include "ash/common/wm_shell.h" |
| 77 #endif | 77 #endif |
| 78 | 78 |
| 79 namespace { | 79 namespace { |
| 80 | 80 |
| 81 using extensions::BookmarkAppHelper; | 81 using extensions::BookmarkAppHelper; |
| 82 | 82 |
| 83 // Overlays a shortcut icon over the bottom left corner of a given image. | 83 // Overlays a shortcut icon over the bottom left corner of a given image. |
| 84 class GeneratedIconImageSource : public gfx::CanvasImageSource { | 84 class GeneratedIconImageSource : public gfx::CanvasImageSource { |
| 85 public: | 85 public: |
| 86 explicit GeneratedIconImageSource(char letter, SkColor color, int output_size) | 86 explicit GeneratedIconImageSource(char letter, SkColor color, int output_size) |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 711 creation_locations.on_desktop = true; | 711 creation_locations.on_desktop = true; |
| 712 #else | 712 #else |
| 713 creation_locations.on_desktop = false; | 713 creation_locations.on_desktop = false; |
| 714 #endif | 714 #endif |
| 715 creation_locations.applications_menu_location = | 715 creation_locations.applications_menu_location = |
| 716 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; | 716 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; |
| 717 creation_locations.in_quick_launch_bar = false; | 717 creation_locations.in_quick_launch_bar = false; |
| 718 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER, | 718 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER, |
| 719 creation_locations, current_profile, extension); | 719 creation_locations, current_profile, extension); |
| 720 #else | 720 #else |
| 721 ash::Shell::GetInstance()->GetShelfDelegate()->PinAppWithID(extension->id()); | 721 ash::ShelfDelegate* shelf_delegate = ash::WmShell::Get()->shelf_delegate(); |
| 722 DCHECK(shelf_delegate); |
| 723 shelf_delegate->PinAppWithID(extension->id()); |
| 722 #endif // !defined(USE_ASH) | 724 #endif // !defined(USE_ASH) |
| 723 #endif // !defined(OS_MACOSX) | 725 #endif // !defined(OS_MACOSX) |
| 724 | 726 |
| 725 #if defined(OS_MACOSX) | 727 #if defined(OS_MACOSX) |
| 726 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 728 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 727 switches::kDisableHostedAppShimCreation)) { | 729 switches::kDisableHostedAppShimCreation)) { |
| 728 web_app::RevealAppShimInFinderForApp(current_profile, extension); | 730 web_app::RevealAppShimInFinderForApp(current_profile, extension); |
| 729 } | 731 } |
| 730 #endif | 732 #endif |
| 731 | 733 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); | 799 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); |
| 798 } | 800 } |
| 799 | 801 |
| 800 bool IsValidBookmarkAppUrl(const GURL& url) { | 802 bool IsValidBookmarkAppUrl(const GURL& url) { |
| 801 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); | 803 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); |
| 802 origin_only_pattern.SetMatchAllURLs(true); | 804 origin_only_pattern.SetMatchAllURLs(true); |
| 803 return url.is_valid() && origin_only_pattern.MatchesURL(url); | 805 return url.is_valid() && origin_only_pattern.MatchesURL(url); |
| 804 } | 806 } |
| 805 | 807 |
| 806 } // namespace extensions | 808 } // namespace extensions |
| OLD | NEW |