| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 #include "chrome/browser/web_applications/web_app_mac.h" | 70 #include "chrome/browser/web_applications/web_app_mac.h" |
| 71 #include "chrome/common/chrome_switches.h" | 71 #include "chrome/common/chrome_switches.h" |
| 72 #endif | 72 #endif |
| 73 | 73 |
| 74 #if defined(OS_WIN) | 74 #if defined(OS_WIN) |
| 75 #include "base/win/shortcut.h" | 75 #include "base/win/shortcut.h" |
| 76 #endif // defined(OS_WIN) | 76 #endif // defined(OS_WIN) |
| 77 | 77 |
| 78 #if defined(USE_ASH) | 78 #if defined(USE_ASH) |
| 79 #include "ash/common/shelf/shelf_delegate.h" // nogncheck | 79 #include "ash/common/shelf/shelf_delegate.h" // nogncheck |
| 80 #include "ash/common/wm_shell.h" // nogncheck | 80 #include "ash/shell.h" // nogncheck |
| 81 #endif | 81 #endif |
| 82 | 82 |
| 83 namespace { | 83 namespace { |
| 84 | 84 |
| 85 using extensions::BookmarkAppHelper; | 85 using extensions::BookmarkAppHelper; |
| 86 | 86 |
| 87 // Overlays a shortcut icon over the bottom left corner of a given image. | 87 // Overlays a shortcut icon over the bottom left corner of a given image. |
| 88 class GeneratedIconImageSource : public gfx::CanvasImageSource { | 88 class GeneratedIconImageSource : public gfx::CanvasImageSource { |
| 89 public: | 89 public: |
| 90 explicit GeneratedIconImageSource(char letter, SkColor color, int output_size) | 90 explicit GeneratedIconImageSource(char letter, SkColor color, int output_size) |
| (...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 725 creation_locations.on_desktop = true; | 725 creation_locations.on_desktop = true; |
| 726 #else | 726 #else |
| 727 creation_locations.on_desktop = false; | 727 creation_locations.on_desktop = false; |
| 728 #endif | 728 #endif |
| 729 creation_locations.applications_menu_location = | 729 creation_locations.applications_menu_location = |
| 730 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; | 730 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; |
| 731 creation_locations.in_quick_launch_bar = false; | 731 creation_locations.in_quick_launch_bar = false; |
| 732 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER, | 732 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER, |
| 733 creation_locations, current_profile, extension); | 733 creation_locations, current_profile, extension); |
| 734 #else | 734 #else |
| 735 ash::ShelfDelegate* shelf_delegate = ash::WmShell::Get()->shelf_delegate(); | 735 ash::ShelfDelegate* shelf_delegate = ash::Shell::Get()->shelf_delegate(); |
| 736 DCHECK(shelf_delegate); | 736 DCHECK(shelf_delegate); |
| 737 shelf_delegate->PinAppWithID(extension->id()); | 737 shelf_delegate->PinAppWithID(extension->id()); |
| 738 #endif // !defined(USE_ASH) | 738 #endif // !defined(USE_ASH) |
| 739 #endif // !defined(OS_MACOSX) | 739 #endif // !defined(OS_MACOSX) |
| 740 | 740 |
| 741 #if defined(OS_MACOSX) | 741 #if defined(OS_MACOSX) |
| 742 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 742 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 743 switches::kDisableHostedAppShimCreation)) { | 743 switches::kDisableHostedAppShimCreation)) { |
| 744 web_app::RevealAppShimInFinderForApp(current_profile, extension); | 744 web_app::RevealAppShimInFinderForApp(current_profile, extension); |
| 745 } | 745 } |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 813 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); | 813 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); |
| 814 } | 814 } |
| 815 | 815 |
| 816 bool IsValidBookmarkAppUrl(const GURL& url) { | 816 bool IsValidBookmarkAppUrl(const GURL& url) { |
| 817 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); | 817 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); |
| 818 origin_only_pattern.SetMatchAllURLs(true); | 818 origin_only_pattern.SetMatchAllURLs(true); |
| 819 return url.is_valid() && origin_only_pattern.MatchesURL(url); | 819 return url.is_valid() && origin_only_pattern.MatchesURL(url); |
| 820 } | 820 } |
| 821 | 821 |
| 822 } // namespace extensions | 822 } // namespace extensions |
| OLD | NEW |