diff options
author | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 21:13:47 +0000 |
---|---|---|
committer | mpcomplete@chromium.org <mpcomplete@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-15 21:13:47 +0000 |
commit | b671760bb1967f74d584c7790af86a5aee6fd43c (patch) | |
tree | 293ed23ee335c9300dbf72b679cbaf083b41bb4f /chrome/browser/extensions/extensions_service.cc | |
parent | f9a2b2fe071c001a6864e527fd7035489a985243 (diff) | |
download | chromium_src-b671760bb1967f74d584c7790af86a5aee6fd43c.zip chromium_src-b671760bb1967f74d584c7790af86a5aee6fd43c.tar.gz chromium_src-b671760bb1967f74d584c7790af86a5aee6fd43c.tar.bz2 |
Use the extension icon for extension omnibox results instead of the generic
search icon.
I refactored the extension menu manager to separate the icon-specific bits.
BUG=46479
TEST=load the chrome search extension at
src/chrome/common/extensions/docs/examples/extensions/chrome_search/
and type "src foo" into the omnibox. You should see the extension icon instead of the magnifying glass. Switch back and forth between the "src" keyword result, other results, and other keywords and the icons should update properly.
Review URL: http://codereview.chromium.org/2973006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52535 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extensions_service.cc')
-rw-r--r-- | chrome/browser/extensions/extensions_service.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 9a91533..3259c11 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -186,6 +186,9 @@ ExtensionsService::ExtensionsService(Profile* profile, } backend_ = new ExtensionsServiceBackend(install_directory_); + + // Use monochrome icons for omnibox icons. + omnibox_icon_manager_.set_monochrome(true); } ExtensionsService::~ExtensionsService() { @@ -906,6 +909,11 @@ void ExtensionsService::OnExtensionLoaded(Extension* extension, if (profile_->GetTemplateURLModel()) profile_->GetTemplateURLModel()->RegisterExtensionKeyword(extension); + + // Load the icon for omnibox-enabled extensions so it will be ready to display + // in the URL bar. + if (!extension->omnibox_keyword().empty()) + omnibox_icon_manager_.LoadIcon(extension); } void ExtensionsService::UpdateActiveExtensionsInCrashReporter() { @@ -1029,6 +1037,11 @@ Extension* ExtensionsService::GetExtensionByOverlappingWebExtent( return NULL; } +const SkBitmap& ExtensionsService::GetOmniboxIcon( + const std::string& extension_id) { + return omnibox_icon_manager_.GetIcon(extension_id); +} + void ExtensionsService::ClearProvidersForTesting() { ChromeThread::PostTask( ChromeThread::FILE, FROM_HERE, |