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 #import "chrome/browser/web_applications/web_app_mac.h" | 5 #import "chrome/browser/web_applications/web_app_mac.h" |
6 | 6 |
7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
9 | 9 |
10 #include "apps/app_shim/app_shim_mac.h" | 10 #include "apps/app_shim/app_shim_mac.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_util.h" | 12 #include "base/file_util.h" |
13 #include "base/files/file_enumerator.h" | 13 #include "base/files/file_enumerator.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/mac/foundation_util.h" | 15 #include "base/mac/foundation_util.h" |
16 #include "base/mac/launch_services_util.h" | 16 #include "base/mac/launch_services_util.h" |
17 #include "base/mac/mac_util.h" | 17 #include "base/mac/mac_util.h" |
18 #include "base/mac/scoped_cftyperef.h" | 18 #include "base/mac/scoped_cftyperef.h" |
19 #include "base/mac/scoped_nsobject.h" | 19 #include "base/mac/scoped_nsobject.h" |
20 #include "base/path_service.h" | 20 #include "base/path_service.h" |
21 #include "base/process/process_handle.h" | 21 #include "base/process/process_handle.h" |
22 #include "base/strings/string16.h" | 22 #include "base/strings/string16.h" |
23 #include "base/strings/string_number_conversions.h" | 23 #include "base/strings/string_number_conversions.h" |
24 #include "base/strings/string_util.h" | 24 #include "base/strings/string_util.h" |
25 #include "base/strings/sys_string_conversions.h" | 25 #include "base/strings/sys_string_conversions.h" |
26 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
27 #import "chrome/browser/mac/dock.h" | 27 #import "chrome/browser/mac/dock.h" |
28 #include "chrome/browser/profiles/profile.h" | 28 #include "chrome/browser/profiles/profile.h" |
29 #include "chrome/browser/ui/web_applications/web_app_ui.h" | |
30 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
31 #include "chrome/common/chrome_paths.h" | 30 #include "chrome/common/chrome_paths.h" |
32 #include "chrome/common/chrome_switches.h" | 31 #include "chrome/common/chrome_switches.h" |
33 #include "chrome/common/chrome_version_info.h" | 32 #include "chrome/common/chrome_version_info.h" |
34 #import "chrome/common/mac/app_mode_common.h" | 33 #import "chrome/common/mac/app_mode_common.h" |
35 #include "content/public/browser/browser_thread.h" | 34 #include "content/public/browser/browser_thread.h" |
36 #include "extensions/common/extension.h" | 35 #include "extensions/common/extension.h" |
37 #include "grit/chrome_unscaled_resources.h" | 36 #include "grit/chrome_unscaled_resources.h" |
38 #include "grit/chromium_strings.h" | 37 #include "grit/chromium_strings.h" |
39 #import "skia/ext/skia_utils_mac.h" | 38 #import "skia/ext/skia_utils_mac.h" |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 argb += 4; | 90 argb += 4; |
92 } | 91 } |
93 } | 92 } |
94 } | 93 } |
95 | 94 |
96 // Adds |image| to |icon_family|. Returns true on success, false on failure. | 95 // Adds |image| to |icon_family|. Returns true on success, false on failure. |
97 bool AddGfxImageToIconFamily(IconFamilyHandle icon_family, | 96 bool AddGfxImageToIconFamily(IconFamilyHandle icon_family, |
98 const gfx::Image& image) { | 97 const gfx::Image& image) { |
99 // When called via ShowCreateChromeAppShortcutsDialog the ImageFamily will | 98 // When called via ShowCreateChromeAppShortcutsDialog the ImageFamily will |
100 // have all the representations desired here for mac, from the kDesiredSizes | 99 // have all the representations desired here for mac, from the kDesiredSizes |
101 // array in web_app_ui.cc. | 100 // array in web_app.cc. |
102 SkBitmap bitmap = image.AsBitmap(); | 101 SkBitmap bitmap = image.AsBitmap(); |
103 if (bitmap.config() != SkBitmap::kARGB_8888_Config || | 102 if (bitmap.config() != SkBitmap::kARGB_8888_Config || |
104 bitmap.width() != bitmap.height()) { | 103 bitmap.width() != bitmap.height()) { |
105 return false; | 104 return false; |
106 } | 105 } |
107 | 106 |
108 OSType icon_type; | 107 OSType icon_type; |
109 switch (bitmap.width()) { | 108 switch (bitmap.width()) { |
110 case 512: | 109 case 512: |
111 icon_type = kIconServices512PixelDataARGB; | 110 icon_type = kIconServices512PixelDataARGB; |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 ShellIntegration::ShortcutInfo shortcut_info = | 855 ShellIntegration::ShortcutInfo shortcut_info = |
857 BuildShortcutInfoFromBundle(*it); | 856 BuildShortcutInfoFromBundle(*it); |
858 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); | 857 WebAppShortcutCreator shortcut_creator(it->DirName(), shortcut_info); |
859 shortcut_creator.DeleteShortcuts(); | 858 shortcut_creator.DeleteShortcuts(); |
860 } | 859 } |
861 } | 860 } |
862 | 861 |
863 } // namespace internals | 862 } // namespace internals |
864 | 863 |
865 } // namespace web_app | 864 } // namespace web_app |
OLD | NEW |