Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(326)

Side by Side Diff: chrome/browser/extensions/bookmark_app_helper.cc

Issue 2052013002: Adding ChromeLauncherController interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome_launcher_smaller_api
Patch Set: Updating comment. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h" 75 #include "ash/shelf/shelf_delegate.h"
76 #include "ash/shell.h"
76 #endif 77 #endif
77 78
78 namespace { 79 namespace {
79 80
80 using extensions::BookmarkAppHelper; 81 using extensions::BookmarkAppHelper;
81 82
82 // 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.
83 class GeneratedIconImageSource : public gfx::CanvasImageSource { 84 class GeneratedIconImageSource : public gfx::CanvasImageSource {
84 public: 85 public:
85 explicit GeneratedIconImageSource(char letter, SkColor color, int output_size) 86 explicit GeneratedIconImageSource(char letter, SkColor color, int output_size)
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 creation_locations.on_desktop = true; 710 creation_locations.on_desktop = true;
710 #else 711 #else
711 creation_locations.on_desktop = false; 712 creation_locations.on_desktop = false;
712 #endif 713 #endif
713 creation_locations.applications_menu_location = 714 creation_locations.applications_menu_location =
714 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS; 715 web_app::APP_MENU_LOCATION_SUBDIR_CHROMEAPPS;
715 creation_locations.in_quick_launch_bar = false; 716 creation_locations.in_quick_launch_bar = false;
716 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER, 717 web_app::CreateShortcuts(web_app::SHORTCUT_CREATION_BY_USER,
717 creation_locations, current_profile, extension); 718 creation_locations, current_profile, extension);
718 #else 719 #else
719 ChromeLauncherController::instance()->PinAppWithID(extension->id()); 720 ash::Shell::GetInstance()->GetShelfDelegate()->PinAppWithID(extension->id());
msw 2016/06/10 19:24:58 We should avoid adding Shell::GetInstance calls to
720 #endif // !defined(USE_ASH) 721 #endif // !defined(USE_ASH)
721 #endif // !defined(OS_MACOSX) 722 #endif // !defined(OS_MACOSX)
722 723
723 #if defined(OS_MACOSX) 724 #if defined(OS_MACOSX)
724 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 725 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
725 switches::kDisableHostedAppShimCreation)) { 726 switches::kDisableHostedAppShimCreation)) {
726 web_app::RevealAppShimInFinderForApp(current_profile, extension); 727 web_app::RevealAppShimInFinderForApp(current_profile, extension);
727 } 728 }
728 #endif 729 #endif
729 730
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); 796 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback));
796 } 797 }
797 798
798 bool IsValidBookmarkAppUrl(const GURL& url) { 799 bool IsValidBookmarkAppUrl(const GURL& url) {
799 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes); 800 URLPattern origin_only_pattern(Extension::kValidBookmarkAppSchemes);
800 origin_only_pattern.SetMatchAllURLs(true); 801 origin_only_pattern.SetMatchAllURLs(true);
801 return url.is_valid() && origin_only_pattern.MatchesURL(url); 802 return url.is_valid() && origin_only_pattern.MatchesURL(url);
802 } 803 }
803 804
804 } // namespace extensions 805 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698