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

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

Issue 2738553002: [Extensions] Log instances of invalid extensions being added (Closed)
Patch Set: Created 3 years, 9 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 | extensions/common/manifest.h » ('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) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/extension_service.h" 5 #include "chrome/browser/extensions/extension_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <iterator> 10 #include <iterator>
11 #include <memory> 11 #include <memory>
12 #include <set> 12 #include <set>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/debug/alias.h"
17 #include "base/debug/dump_without_crashing.h"
16 #include "base/location.h" 18 #include "base/location.h"
17 #include "base/metrics/histogram_macros.h" 19 #include "base/metrics/histogram_macros.h"
18 #include "base/single_thread_task_runner.h" 20 #include "base/single_thread_task_runner.h"
19 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
20 #include "base/strings/string_tokenizer.h" 22 #include "base/strings/string_tokenizer.h"
21 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
22 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
23 #include "base/threading/sequenced_worker_pool.h" 25 #include "base/threading/sequenced_worker_pool.h"
24 #include "base/threading/thread_restrictions.h" 26 #include "base/threading/thread_restrictions.h"
25 #include "base/threading/thread_task_runner_handle.h" 27 #include "base/threading/thread_task_runner_handle.h"
(...skipping 1448 matching lines...) Expand 10 before | Expand all | Expand 10 after
1474 to_enable.push_back(extension); 1476 to_enable.push_back(extension);
1475 } 1477 }
1476 for (const auto& extension : to_enable) { 1478 for (const auto& extension : to_enable) {
1477 EnableExtension(extension->id()); 1479 EnableExtension(extension->id());
1478 } 1480 }
1479 1481
1480 OnBlacklistUpdated(); 1482 OnBlacklistUpdated();
1481 } 1483 }
1482 1484
1483 void ExtensionService::AddExtension(const Extension* extension) { 1485 void ExtensionService::AddExtension(const Extension* extension) {
1486 if (!Manifest::IsValidLocation(extension->location())) {
1487 // TODO(devlin): We should *never* add an extension with an invalid
lazyboy 2017/03/06 23:08:11 nit: the TODO should also be explicitly talking ab
Devlin 2017/03/07 01:31:40 Done.
1488 // location, but some bugs (e.g. crbug.com/692069) seem to indicate we do.
1489 // Track down the cases when this can happen.
1490 NOTREACHED();
1491 base::debug::Alias(extension);
1492 base::debug::DumpWithoutCrashing();
Devlin 2017/03/06 22:10:00 I don't think I've ever actually used this before
lazyboy 2017/03/06 23:08:11 I think this is fine, however, the Alias on the li
Devlin 2017/03/07 01:31:40 Ah, got it. Done (I think) in the latest patch se
lfg 2017/03/07 17:00:30 Yes, this is fine. In most cases now, you don't ev
1493 }
1494
1484 // TODO(jstritar): We may be able to get rid of this branch by overriding the 1495 // TODO(jstritar): We may be able to get rid of this branch by overriding the
1485 // default extension state to DISABLED when the --disable-extensions flag 1496 // default extension state to DISABLED when the --disable-extensions flag
1486 // is set (http://crbug.com/29067). 1497 // is set (http://crbug.com/29067).
1487 if (!extensions_enabled() && !extension->is_theme() && 1498 if (!extensions_enabled() && !extension->is_theme() &&
1488 extension->location() != Manifest::COMPONENT && 1499 extension->location() != Manifest::COMPONENT &&
1489 !Manifest::IsExternalLocation(extension->location()) && 1500 !Manifest::IsExternalLocation(extension->location()) &&
1490 disable_flag_exempted_extensions_.count(extension->id()) == 0) { 1501 disable_flag_exempted_extensions_.count(extension->id()) == 0) {
1491 return; 1502 return;
1492 } 1503 }
1493 1504
(...skipping 1026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2520 } 2531 }
2521 2532
2522 void ExtensionService::OnProfileDestructionStarted() { 2533 void ExtensionService::OnProfileDestructionStarted() {
2523 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs(); 2534 ExtensionIdSet ids_to_unload = registry_->enabled_extensions().GetIDs();
2524 for (ExtensionIdSet::iterator it = ids_to_unload.begin(); 2535 for (ExtensionIdSet::iterator it = ids_to_unload.begin();
2525 it != ids_to_unload.end(); 2536 it != ids_to_unload.end();
2526 ++it) { 2537 ++it) {
2527 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN); 2538 UnloadExtension(*it, UnloadedExtensionInfo::REASON_PROFILE_SHUTDOWN);
2528 } 2539 }
2529 } 2540 }
OLDNEW
« no previous file with comments | « no previous file | extensions/common/manifest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698