OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/pending_extension_manager.h" | 5 #include "chrome/browser/extensions/pending_extension_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/version.h" | 10 #include "base/version.h" |
11 #include "chrome/common/extensions/extension_constants.h" | 11 #include "chrome/common/extensions/extension_constants.h" |
12 #include "content/public/browser/browser_thread.h" | 12 #include "content/public/browser/browser_thread.h" |
13 #include "extensions/browser/extension_prefs.h" | 13 #include "extensions/browser/extension_prefs.h" |
14 #include "extensions/browser/extension_registry.h" | 14 #include "extensions/browser/extension_registry.h" |
| 15 #include "extensions/common/constants.h" |
15 #include "extensions/common/extension.h" | 16 #include "extensions/common/extension.h" |
16 #include "url/gurl.h" | 17 #include "url/gurl.h" |
17 | 18 |
18 using content::BrowserThread; | 19 using content::BrowserThread; |
19 | 20 |
20 namespace { | 21 namespace { |
21 | 22 |
22 // Install predicate used by AddFromExternalUpdateUrl(). | 23 // Install predicate used by AddFromExternalUpdateUrl(). |
23 bool AlwaysInstall(const extensions::Extension* extension) { | 24 bool AlwaysInstall(const extensions::Extension* extension) { |
24 return true; | 25 return true; |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (ExtensionRegistry::Get(context_)->GetExtensionById( | 98 if (ExtensionRegistry::Get(context_)->GetExtensionById( |
98 id, ExtensionRegistry::EVERYTHING)) { | 99 id, ExtensionRegistry::EVERYTHING)) { |
99 LOG(ERROR) << "Trying to add pending extension " << id | 100 LOG(ERROR) << "Trying to add pending extension " << id |
100 << " which already exists"; | 101 << " which already exists"; |
101 return false; | 102 return false; |
102 } | 103 } |
103 | 104 |
104 // Make sure we don't ever try to install the CWS app, because even though | 105 // Make sure we don't ever try to install the CWS app, because even though |
105 // it is listed as a syncable app (because its values need to be synced) it | 106 // it is listed as a syncable app (because its values need to be synced) it |
106 // should already be installed on every instance. | 107 // should already be installed on every instance. |
107 if (id == extension_misc::kWebStoreAppId) { | 108 if (id == extensions::kWebStoreAppId) { |
108 NOTREACHED(); | 109 NOTREACHED(); |
109 return false; | 110 return false; |
110 } | 111 } |
111 | 112 |
112 int creation_flags = Extension::NO_FLAGS; | 113 int creation_flags = Extension::NO_FLAGS; |
113 if (installed_by_custodian) { | 114 if (installed_by_custodian) { |
114 creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN; | 115 creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN; |
115 } | 116 } |
116 | 117 |
117 static const bool kIsFromSync = true; | 118 static const bool kIsFromSync = true; |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 | 315 |
315 return true; | 316 return true; |
316 } | 317 } |
317 | 318 |
318 void PendingExtensionManager::AddForTesting( | 319 void PendingExtensionManager::AddForTesting( |
319 const PendingExtensionInfo& pending_extension_info) { | 320 const PendingExtensionInfo& pending_extension_info) { |
320 pending_extension_list_.push_back(pending_extension_info); | 321 pending_extension_list_.push_back(pending_extension_info); |
321 } | 322 } |
322 | 323 |
323 } // namespace extensions | 324 } // namespace extensions |
OLD | NEW |