| 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 <cctype> | 7 #include <cctype> |
| 8 | 8 |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/extensions/crx_installer.h" | 10 #include "chrome/browser/extensions/crx_installer.h" |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 web_app_info.icons.push_back(icon_info); | 110 web_app_info.icons.push_back(icon_info); |
| 111 } | 111 } |
| 112 callback.Run(web_app_info); | 112 callback.Run(web_app_info); |
| 113 } | 113 } |
| 114 | 114 |
| 115 std::set<int> SizesToGenerate() { | 115 std::set<int> SizesToGenerate() { |
| 116 // Generate container icons from smaller icons. | 116 // Generate container icons from smaller icons. |
| 117 const int kIconSizesToGenerate[] = { | 117 const int kIconSizesToGenerate[] = { |
| 118 extension_misc::EXTENSION_ICON_SMALL, | 118 extension_misc::EXTENSION_ICON_SMALL, |
| 119 extension_misc::EXTENSION_ICON_MEDIUM, | 119 extension_misc::EXTENSION_ICON_MEDIUM, |
| 120 extension_misc::EXTENSION_ICON_LARGE, |
| 120 }; | 121 }; |
| 121 return std::set<int>(kIconSizesToGenerate, | 122 return std::set<int>(kIconSizesToGenerate, |
| 122 kIconSizesToGenerate + arraysize(kIconSizesToGenerate)); | 123 kIconSizesToGenerate + arraysize(kIconSizesToGenerate)); |
| 123 } | 124 } |
| 124 | 125 |
| 125 void GenerateIcons(std::set<int> generate_sizes, | 126 void GenerateIcons(std::set<int> generate_sizes, |
| 126 const GURL& app_url, | 127 const GURL& app_url, |
| 127 SkColor generated_icon_color, | 128 SkColor generated_icon_color, |
| 128 std::map<int, SkBitmap>* bitmap_map) { | 129 std::map<int, SkBitmap>* bitmap_map) { |
| 129 // The letter that will be painted on the generated icon. | 130 // The letter that will be painted on the generated icon. |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); | 411 extension, info_list, base::Bind(&OnIconsLoaded, web_app_info, callback)); |
| 411 } | 412 } |
| 412 | 413 |
| 413 bool IsValidBookmarkAppUrl(const GURL& url) { | 414 bool IsValidBookmarkAppUrl(const GURL& url) { |
| 414 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes); | 415 URLPattern origin_only_pattern(Extension::kValidWebExtentSchemes); |
| 415 origin_only_pattern.SetMatchAllURLs(true); | 416 origin_only_pattern.SetMatchAllURLs(true); |
| 416 return url.is_valid() && origin_only_pattern.MatchesURL(url); | 417 return url.is_valid() && origin_only_pattern.MatchesURL(url); |
| 417 } | 418 } |
| 418 | 419 |
| 419 } // namespace extensions | 420 } // namespace extensions |
| OLD | NEW |