diff options
author | benwells <benwells@chromium.org> | 2014-12-11 04:38:27 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-12-11 12:38:52 +0000 |
commit | d4b64a7bf6f7d450e41f5133890cdaebb30623da (patch) | |
tree | 6e63062001ca6d7a39182ca0633bac82f517f7b9 /extensions | |
parent | 206d4d3e569857c3e8f11e4f8364225688ea8507 (diff) | |
download | chromium_src-d4b64a7bf6f7d450e41f5133890cdaebb30623da.zip chromium_src-d4b64a7bf6f7d450e41f5133890cdaebb30623da.tar.gz chromium_src-d4b64a7bf6f7d450e41f5133890cdaebb30623da.tar.bz2 |
Ensure there are always nice icons for bookmark apps.
This change does a few things. Firstly, it stops bookmark apps from
using downloaded favicons / manifest icons. Secondly, it syncs the
color it uses to generate icons. Thirdly, machines that bookmark apps
are synced onto will now generate icons using the synced color.
This means bookmark apps will always have nice icons (although not the
ones downloaded) and they will always be consistent across machines.
Once blob sync is available the downloaded icons will be kept and
synced.
BUG=439347
Review URL: https://codereview.chromium.org/782693002
Cr-Commit-Position: refs/heads/master@{#307889}
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/BUILD.gn | 2 | ||||
-rw-r--r-- | extensions/DEPS | 1 | ||||
-rw-r--r-- | extensions/browser/BUILD.gn | 2 | ||||
-rw-r--r-- | extensions/browser/DEPS | 1 | ||||
-rw-r--r-- | extensions/browser/api/app_window/app_window_api.cc | 2 | ||||
-rw-r--r-- | extensions/common/BUILD.gn | 2 | ||||
-rw-r--r-- | extensions/common/image_util.cc (renamed from extensions/browser/image_util.cc) | 8 | ||||
-rw-r--r-- | extensions/common/image_util.h (renamed from extensions/browser/image_util.h) | 7 | ||||
-rw-r--r-- | extensions/common/image_util_unittest.cc (renamed from extensions/browser/image_util_unittest.cc) | 2 | ||||
-rw-r--r-- | extensions/common/manifest_constants.cc | 2 | ||||
-rw-r--r-- | extensions/common/manifest_constants.h | 2 | ||||
-rw-r--r-- | extensions/extensions.gyp | 6 |
12 files changed, 25 insertions, 12 deletions
diff --git a/extensions/BUILD.gn b/extensions/BUILD.gn index ee5a09f..4a0fbe6 100644 --- a/extensions/BUILD.gn +++ b/extensions/BUILD.gn @@ -193,7 +193,6 @@ if (false) { "browser/file_reader_unittest.cc", "browser/guest_view/guest_view_manager_unittest.cc", "browser/image_loader_unittest.cc", - "browser/image_util_unittest.cc", "browser/info_map_unittest.cc", "browser/lazy_background_task_queue_unittest.cc", "browser/management_policy_unittest.cc", @@ -217,6 +216,7 @@ if (false) { "common/extension_resource_unittest.cc", "common/extension_set_unittest.cc", "common/file_util_unittest.cc", + "common/image_util_unittest.cc", "common/manifest_handler_unittest.cc", "common/manifest_handlers/content_capabilities_manifest_unittest.cc", "common/manifest_handlers/oauth2_manifest_unittest.cc", diff --git a/extensions/DEPS b/extensions/DEPS index 1aaa24c..b237be8 100644 --- a/extensions/DEPS +++ b/extensions/DEPS @@ -12,6 +12,7 @@ include_rules = [ "+grit/extensions_renderer_resources.h", "+grit/extensions_resources.h", "+mojo/public", + "+third_party/skia/include", "+testing", # Minimal UI dependencies. There are two good rules for UI dependencies here: diff --git a/extensions/browser/BUILD.gn b/extensions/browser/BUILD.gn index ec4c4dd..fee6426 100644 --- a/extensions/browser/BUILD.gn +++ b/extensions/browser/BUILD.gn @@ -412,8 +412,6 @@ source_set("browser") { "image_loader.h", "image_loader_factory.cc", "image_loader_factory.h", - "image_util.cc", - "image_util.h", "info_map.cc", "info_map.h", "install/crx_installer_error.h", diff --git a/extensions/browser/DEPS b/extensions/browser/DEPS index ca34eba..eb71651 100644 --- a/extensions/browser/DEPS +++ b/extensions/browser/DEPS @@ -19,7 +19,6 @@ include_rules = [ "+sync", "+third_party/leveldatabase", "+third_party/re2", - "+third_party/skia/include", "+third_party/WebKit/public/web", ] diff --git a/extensions/browser/api/app_window/app_window_api.cc b/extensions/browser/api/app_window/app_window_api.cc index e5f23e6..f0a4e83 100644 --- a/extensions/browser/api/app_window/app_window_api.cc +++ b/extensions/browser/api/app_window/app_window_api.cc @@ -21,9 +21,9 @@ #include "extensions/browser/app_window/app_window_registry.h" #include "extensions/browser/app_window/native_app_window.h" #include "extensions/browser/extensions_browser_client.h" -#include "extensions/browser/image_util.h" #include "extensions/common/api/app_window.h" #include "extensions/common/features/simple_feature.h" +#include "extensions/common/image_util.h" #include "extensions/common/manifest.h" #include "extensions/common/permissions/permissions_data.h" #include "extensions/common/switches.h" diff --git a/extensions/common/BUILD.gn b/extensions/common/BUILD.gn index 54c712f..e25b766 100644 --- a/extensions/common/BUILD.gn +++ b/extensions/common/BUILD.gn @@ -104,6 +104,8 @@ if (enable_extensions) { "file_util.h", "guest_view/guest_view_constants.cc", "guest_view/guest_view_constants.h", + "image_util.cc", + "image_util.h", "install_warning.cc", "install_warning.h", "manifest.cc", diff --git a/extensions/browser/image_util.cc b/extensions/common/image_util.cc index 2454a63..4b16367 100644 --- a/extensions/browser/image_util.cc +++ b/extensions/common/image_util.cc @@ -2,12 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "extensions/browser/image_util.h" +#include "extensions/common/image_util.h" #include <stdint.h> #include <vector> #include "base/strings/string_number_conversions.h" +#include "base/strings/stringprintf.h" #include "third_party/skia/include/core/SkColor.h" namespace extensions { @@ -41,5 +42,10 @@ bool ParseCSSColorString(const std::string& color_string, SkColor* result) { return true; } +std::string GenerateCSSColorString(SkColor color) { + return base::StringPrintf("#%02X%02X%02X", SkColorGetR(color), + SkColorGetG(color), SkColorGetB(color)); +} + } // namespace image_util } // namespace extensions diff --git a/extensions/browser/image_util.h b/extensions/common/image_util.h index 2886b66..e9d2dfd 100644 --- a/extensions/browser/image_util.h +++ b/extensions/common/image_util.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef EXTENSIONS_BROWSER_IMAGE_UTIL_H_ -#define EXTENSIONS_BROWSER_IMAGE_UTIL_H_ +#ifndef EXTENSIONS_COMMON_IMAGE_UTIL_H_ +#define EXTENSIONS_COMMON_IMAGE_UTIL_H_ #include <string> @@ -16,6 +16,9 @@ namespace image_util { // Parses a string like #FF9982 or #EEE to a color. Returns true for success. bool ParseCSSColorString(const std::string& color_string, SkColor* result); +// Creates a string like #FF9982 from a color. +std::string GenerateCSSColorString(SkColor color); + } // namespace image_util } // namespace extensions diff --git a/extensions/browser/image_util_unittest.cc b/extensions/common/image_util_unittest.cc index 5dd0cee3..ca13ab2 100644 --- a/extensions/browser/image_util_unittest.cc +++ b/extensions/common/image_util_unittest.cc @@ -4,7 +4,7 @@ #include <string> -#include "extensions/browser/image_util.h" +#include "extensions/common/image_util.h" #include "testing/gtest/include/gtest/gtest.h" #include "third_party/skia/include/core/SkColor.h" diff --git a/extensions/common/manifest_constants.cc b/extensions/common/manifest_constants.cc index a7c287a..e8099df 100644 --- a/extensions/common/manifest_constants.cc +++ b/extensions/common/manifest_constants.cc @@ -12,6 +12,7 @@ const char kAboutPage[] = "about_page"; const char kAllFrames[] = "all_frames"; const char kAltKey[] = "altKey"; const char kApp[] = "app"; +const char kAppIconColor[] = "app.icon_color"; const char kAutomation[] = "automation"; const char kBackgroundAllowJsAccess[] = "background.allow_js_access"; const char kBackgroundPage[] = "background.page"; @@ -279,6 +280,7 @@ const char kInvalidAboutPageExpectRelativePath[] = "Invalid value for 'about_page'. Value must be a relative path."; const char kInvalidAllFrames[] = "Invalid value for 'content_scripts[*].all_frames'."; +const char kInvalidAppIconColor[] = "Invalid value for app.icon_color."; const char kInvalidBackground[] = "Invalid value for 'background_page'."; const char kInvalidBackgroundAllowJsAccess[] = diff --git a/extensions/common/manifest_constants.h b/extensions/common/manifest_constants.h index d0e1d88..4c137ce 100644 --- a/extensions/common/manifest_constants.h +++ b/extensions/common/manifest_constants.h @@ -14,6 +14,7 @@ extern const char kAboutPage[]; extern const char kAllFrames[]; extern const char kAltKey[]; extern const char kApp[]; +extern const char kAppIconColor[]; extern const char kAutomation[]; extern const char kBackgroundAllowJsAccess[]; extern const char kBackgroundPage[]; @@ -258,6 +259,7 @@ extern const char kExperimentalFlagRequired[]; extern const char kInvalidAboutPage[]; extern const char kInvalidAboutPageExpectRelativePath[]; extern const char kInvalidAllFrames[]; +extern const char kInvalidAppIconColor[]; extern const char kInvalidBackground[]; extern const char kInvalidBackgroundAllowJsAccess[]; extern const char kInvalidBackgroundCombination[]; diff --git a/extensions/extensions.gyp b/extensions/extensions.gyp index e7c350c..f4b6a83 100644 --- a/extensions/extensions.gyp +++ b/extensions/extensions.gyp @@ -148,6 +148,8 @@ 'common/file_util.h', 'common/guest_view/guest_view_constants.cc', 'common/guest_view/guest_view_constants.h', + 'common/image_util.cc', + 'common/image_util.h', 'common/install_warning.cc', 'common/install_warning.h', 'common/manifest.cc', @@ -692,8 +694,6 @@ 'browser/image_loader.h', 'browser/image_loader_factory.cc', 'browser/image_loader_factory.h', - 'browser/image_util.cc', - 'browser/image_util.h', 'browser/info_map.cc', 'browser/info_map.h', 'browser/install/crx_installer_error.h', @@ -1209,7 +1209,6 @@ 'browser/file_reader_unittest.cc', 'browser/guest_view/guest_view_manager_unittest.cc', 'browser/image_loader_unittest.cc', - 'browser/image_util_unittest.cc', 'browser/info_map_unittest.cc', 'browser/lazy_background_task_queue_unittest.cc', 'browser/management_policy_unittest.cc', @@ -1237,6 +1236,7 @@ 'common/features/complex_feature_unittest.cc', 'common/features/simple_feature_unittest.cc', 'common/file_util_unittest.cc', + 'common/image_util_unittest.cc', 'common/manifest_handler_unittest.cc', 'common/manifest_handlers/content_capabilities_manifest_unittest.cc', 'common/manifest_handlers/default_locale_manifest_unittest.cc', |