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

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

Issue 2973006: Use the extension icon for extension omnibox results instead of the generic (Closed)
Patch Set: fixed mac Created 10 years, 5 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/extensions_service.h" 5 #include "chrome/browser/extensions/extensions_service.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/histogram.h" 10 #include "base/histogram.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 if (autoupdate_enabled) { 179 if (autoupdate_enabled) {
180 int update_frequency = kDefaultUpdateFrequencySeconds; 180 int update_frequency = kDefaultUpdateFrequencySeconds;
181 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) { 181 if (command_line->HasSwitch(switches::kExtensionsUpdateFrequency)) {
182 update_frequency = StringToInt(command_line->GetSwitchValueASCII( 182 update_frequency = StringToInt(command_line->GetSwitchValueASCII(
183 switches::kExtensionsUpdateFrequency)); 183 switches::kExtensionsUpdateFrequency));
184 } 184 }
185 updater_ = new ExtensionUpdater(this, prefs, update_frequency); 185 updater_ = new ExtensionUpdater(this, prefs, update_frequency);
186 } 186 }
187 187
188 backend_ = new ExtensionsServiceBackend(install_directory_); 188 backend_ = new ExtensionsServiceBackend(install_directory_);
189
190 // Use monochrome icons for omnibox icons.
191 omnibox_icon_manager_.set_monochrome(true);
189 } 192 }
190 193
191 ExtensionsService::~ExtensionsService() { 194 ExtensionsService::~ExtensionsService() {
192 UnloadAllExtensions(); 195 UnloadAllExtensions();
193 if (updater_.get()) { 196 if (updater_.get()) {
194 updater_->Stop(); 197 updater_->Stop();
195 } 198 }
196 } 199 }
197 200
198 void ExtensionsService::InitEventRouters() { 201 void ExtensionsService::InitEventRouters() {
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
899 break; 902 break;
900 } 903 }
901 } 904 }
902 905
903 extension->set_being_upgraded(false); 906 extension->set_being_upgraded(false);
904 907
905 UpdateActiveExtensionsInCrashReporter(); 908 UpdateActiveExtensionsInCrashReporter();
906 909
907 if (profile_->GetTemplateURLModel()) 910 if (profile_->GetTemplateURLModel())
908 profile_->GetTemplateURLModel()->RegisterExtensionKeyword(extension); 911 profile_->GetTemplateURLModel()->RegisterExtensionKeyword(extension);
912
913 // Load the icon for omnibox-enabled extensions so it will be ready to display
914 // in the URL bar.
915 if (!extension->omnibox_keyword().empty())
916 omnibox_icon_manager_.LoadIcon(extension);
909 } 917 }
910 918
911 void ExtensionsService::UpdateActiveExtensionsInCrashReporter() { 919 void ExtensionsService::UpdateActiveExtensionsInCrashReporter() {
912 std::set<std::string> extension_ids; 920 std::set<std::string> extension_ids;
913 for (size_t i = 0; i < extensions_.size(); ++i) { 921 for (size_t i = 0; i < extensions_.size(); ++i) {
914 if (!extensions_[i]->is_theme()) 922 if (!extensions_[i]->is_theme())
915 extension_ids.insert(extensions_[i]->id()); 923 extension_ids.insert(extensions_[i]->id());
916 } 924 }
917 925
918 child_process_logging::SetActiveExtensions(extension_ids); 926 child_process_logging::SetActiveExtensions(extension_ids);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1022 Extension* ExtensionsService::GetExtensionByOverlappingWebExtent( 1030 Extension* ExtensionsService::GetExtensionByOverlappingWebExtent(
1023 const ExtensionExtent& extent) { 1031 const ExtensionExtent& extent) {
1024 for (size_t i = 0; i < extensions_.size(); ++i) { 1032 for (size_t i = 0; i < extensions_.size(); ++i) {
1025 if (extensions_[i]->web_extent().OverlapsWith(extent)) 1033 if (extensions_[i]->web_extent().OverlapsWith(extent))
1026 return extensions_[i]; 1034 return extensions_[i];
1027 } 1035 }
1028 1036
1029 return NULL; 1037 return NULL;
1030 } 1038 }
1031 1039
1040 const SkBitmap& ExtensionsService::GetOmniboxIcon(
1041 const std::string& extension_id) {
1042 return omnibox_icon_manager_.GetIcon(extension_id);
1043 }
1044
1032 void ExtensionsService::ClearProvidersForTesting() { 1045 void ExtensionsService::ClearProvidersForTesting() {
1033 ChromeThread::PostTask( 1046 ChromeThread::PostTask(
1034 ChromeThread::FILE, FROM_HERE, 1047 ChromeThread::FILE, FROM_HERE,
1035 NewRunnableMethod( 1048 NewRunnableMethod(
1036 backend_.get(), &ExtensionsServiceBackend::ClearProvidersForTesting)); 1049 backend_.get(), &ExtensionsServiceBackend::ClearProvidersForTesting));
1037 } 1050 }
1038 1051
1039 void ExtensionsService::SetProviderForTesting( 1052 void ExtensionsService::SetProviderForTesting(
1040 Extension::Location location, ExternalExtensionProvider* test_provider) { 1053 Extension::Location location, ExternalExtensionProvider* test_provider) {
1041 ChromeThread::PostTask( 1054 ChromeThread::PostTask(
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
1307 // Finish installing on UI thread. 1320 // Finish installing on UI thread.
1308 ChromeThread::PostTask( 1321 ChromeThread::PostTask(
1309 ChromeThread::UI, FROM_HERE, 1322 ChromeThread::UI, FROM_HERE,
1310 NewRunnableMethod( 1323 NewRunnableMethod(
1311 frontend_, 1324 frontend_,
1312 &ExtensionsService::ContinueLoadAllExtensions, 1325 &ExtensionsService::ContinueLoadAllExtensions,
1313 extensions_to_reload, 1326 extensions_to_reload,
1314 start_time, 1327 start_time,
1315 true)); 1328 true));
1316 } 1329 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extensions_service.h ('k') | chrome/browser/gtk/location_bar_view_gtk.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698