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

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

Issue 119256: Fix user scripts not getting initialized. (Closed)
Patch Set: Fix unit tests Created 11 years, 6 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
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 "app/l10n_util.h" 7 #include "app/l10n_util.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/gfx/png_encoder.h" 10 #include "base/gfx/png_encoder.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 // The kill-bit only applies to External extensions so this check fails 352 // The kill-bit only applies to External extensions so this check fails
353 // for internal locations that have the kill-bit set. In other words, 353 // for internal locations that have the kill-bit set. In other words,
354 // the kill-bit cannot be set unless the extension is external. 354 // the kill-bit cannot be set unless the extension is external.
355 Extension::Location ext_location = 355 Extension::Location ext_location =
356 static_cast<Extension::Location>(location); 356 static_cast<Extension::Location>(location);
357 DCHECK(state != Extension::KILLBIT || 357 DCHECK(state != Extension::KILLBIT ||
358 Extension::IsExternalLocation(ext_location)); 358 Extension::IsExternalLocation(ext_location));
359 } 359 }
360 } 360 }
361 361
362 // If extensions aren't enabled, we still want to add themes. However, themes
363 // should not trigger EXTENSIONS_LOADED.
364 // TODO(aa): This can be re-enabled when BUG 13128 is fixed.
365 bool has_extension = false;
366 for (ExtensionList::iterator iter = new_extensions->begin(); 362 for (ExtensionList::iterator iter = new_extensions->begin();
367 iter != new_extensions->end(); ++iter) { 363 iter != new_extensions->end(); ++iter) {
368 if (extensions_enabled() || (*iter)->IsTheme()) { 364 if (extensions_enabled() || (*iter)->IsTheme())
369 extensions_.push_back(*iter); 365 extensions_.push_back(*iter);
370 if (!(*iter)->IsTheme())
371 has_extension = true;
372 }
373 } 366 }
374 367
375 if (has_extension) { 368 NotificationService::current()->Notify(
376 NotificationService::current()->Notify( 369 NotificationType::EXTENSIONS_LOADED,
377 NotificationType::EXTENSIONS_LOADED, 370 NotificationService::AllSources(),
378 NotificationService::AllSources(), 371 Details<ExtensionList>(new_extensions));
379 Details<ExtensionList>(new_extensions)); 372
380 }
381 delete new_extensions; 373 delete new_extensions;
382 } 374 }
383 375
384 void ExtensionsService::OnExtensionInstalled(Extension* extension, 376 void ExtensionsService::OnExtensionInstalled(Extension* extension,
385 bool update) { 377 bool update) {
386 UpdateExtensionPref(ASCIIToWide(extension->id()), kState, 378 UpdateExtensionPref(ASCIIToWide(extension->id()), kState,
387 Value::CreateIntegerValue(Extension::ENABLED), false); 379 Value::CreateIntegerValue(Extension::ENABLED), false);
388 UpdateExtensionPref(ASCIIToWide(extension->id()), kLocation, 380 UpdateExtensionPref(ASCIIToWide(extension->id()), kLocation,
389 Value::CreateIntegerValue(Extension::INTERNAL), true); 381 Value::CreateIntegerValue(Extension::INTERNAL), true);
390 382
(...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 1263
1272 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id, 1264 bool ExtensionsServiceBackend::ShouldInstall(const std::string& id,
1273 const std::string& version) { 1265 const std::string& version) {
1274 FilePath dir(install_directory_.AppendASCII(id.c_str())); 1266 FilePath dir(install_directory_.AppendASCII(id.c_str()));
1275 std::string current_version; 1267 std::string current_version;
1276 if (ReadCurrentVersion(dir, &current_version)) { 1268 if (ReadCurrentVersion(dir, &current_version)) {
1277 return CheckCurrentVersion(version, current_version, dir); 1269 return CheckCurrentVersion(version, current_version, dir);
1278 } 1270 }
1279 return true; 1271 return true;
1280 } 1272 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/extensions_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698