OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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> | |
8 | |
9 #include "base/logging.h" | 7 #include "base/logging.h" |
10 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
11 #include "base/version.h" | 9 #include "base/version.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/pending_extension_info.h" | 11 #include "chrome/browser/extensions/pending_extension_info.h" |
14 #include "chrome/common/extensions/extension.h" | 12 #include "chrome/common/extensions/extension.h" |
15 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
16 | 14 |
| 15 #include <algorithm> |
| 16 |
17 using content::BrowserThread; | 17 using content::BrowserThread; |
18 | 18 |
19 namespace { | 19 namespace { |
20 | 20 |
21 // Install predicate used by AddFromExternalUpdateUrl(). | 21 // Install predicate used by AddFromExternalUpdateUrl(). |
22 bool AlwaysInstall(const extensions::Extension& extension) { | 22 bool AlwaysInstall(const extensions::Extension& extension) { |
23 return true; | 23 return true; |
24 } | 24 } |
25 | 25 |
26 } // namespace | 26 } // namespace |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 for (iter = pending_extension_list_.begin(); | 66 for (iter = pending_extension_list_.begin(); |
67 iter != pending_extension_list_.end(); | 67 iter != pending_extension_list_.end(); |
68 ++iter) { | 68 ++iter) { |
69 if (id == iter->id()) | 69 if (id == iter->id()) |
70 return true; | 70 return true; |
71 } | 71 } |
72 | 72 |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 bool PendingExtensionManager::HasPendingExtensionFromSync() const { | |
77 PendingExtensionList::const_iterator iter; | |
78 for (iter = pending_extension_list_.begin(); | |
79 iter != pending_extension_list_.end(); | |
80 ++iter) { | |
81 if (iter->is_from_sync()) | |
82 return true; | |
83 } | |
84 | |
85 return false; | |
86 } | |
87 | |
88 bool PendingExtensionManager::AddFromSync( | 76 bool PendingExtensionManager::AddFromSync( |
89 const std::string& id, | 77 const std::string& id, |
90 const GURL& update_url, | 78 const GURL& update_url, |
91 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, | 79 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, |
92 bool install_silently) { | 80 bool install_silently) { |
93 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 81 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
94 | 82 |
95 if (service_.GetInstalledExtension(id)) { | 83 if (service_.GetInstalledExtension(id)) { |
96 LOG(ERROR) << "Trying to add pending extension " << id | 84 LOG(ERROR) << "Trying to add pending extension " << id |
97 << " which already exists"; | 85 << " which already exists"; |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 | 238 |
251 return true; | 239 return true; |
252 } | 240 } |
253 | 241 |
254 void PendingExtensionManager::AddForTesting( | 242 void PendingExtensionManager::AddForTesting( |
255 const PendingExtensionInfo& pending_extension_info) { | 243 const PendingExtensionInfo& pending_extension_info) { |
256 pending_extension_list_.push_back(pending_extension_info); | 244 pending_extension_list_.push_back(pending_extension_info); |
257 } | 245 } |
258 | 246 |
259 } // namespace extensions | 247 } // namespace extensions |
OLD | NEW |