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

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

Issue 1281313003: base: Remove using:: declaration from version.h header. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more fixes Created 5 years, 4 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 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/constants.h"
16 #include "extensions/common/extension.h" 16 #include "extensions/common/extension.h"
17 #include "url/gurl.h" 17 #include "url/gurl.h"
18 18
19 using content::BrowserThread; 19 using content::BrowserThread;
20 20
21 namespace { 21 namespace {
22 22
23 // Install predicate used by AddFromExternalUpdateUrl(). 23 // Install predicate used by AddFromExternalUpdateUrl().
24 bool AlwaysInstall(const extensions::Extension* extension) { 24 bool AlwaysInstall(const extensions::Extension* extension) {
25 return true; 25 return true;
26 } 26 }
27 27
28 std::string GetVersionString(const Version& version) { 28 std::string GetVersionString(const base::Version& version) {
29 return version.IsValid() ? version.GetString() : "invalid"; 29 return version.IsValid() ? version.GetString() : "invalid";
30 } 30 }
31 31
32 } // namespace 32 } // namespace
33 33
34 namespace extensions { 34 namespace extensions {
35 35
36 PendingExtensionManager::PendingExtensionManager( 36 PendingExtensionManager::PendingExtensionManager(
37 content::BrowserContext* context) 37 content::BrowserContext* context)
38 : context_(context) {} 38 : context_(context) {}
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN; 114 creation_flags |= Extension::WAS_INSTALLED_BY_CUSTODIAN;
115 } 115 }
116 116
117 static const bool kIsFromSync = true; 117 static const bool kIsFromSync = true;
118 static const Manifest::Location kSyncLocation = Manifest::INTERNAL; 118 static const Manifest::Location kSyncLocation = Manifest::INTERNAL;
119 static const bool kMarkAcknowledged = false; 119 static const bool kMarkAcknowledged = false;
120 120
121 return AddExtensionImpl(id, 121 return AddExtensionImpl(id,
122 std::string(), 122 std::string(),
123 update_url, 123 update_url,
124 Version(), 124 base::Version(),
125 should_allow_install, 125 should_allow_install,
126 kIsFromSync, 126 kIsFromSync,
127 kSyncLocation, 127 kSyncLocation,
128 creation_flags, 128 creation_flags,
129 kMarkAcknowledged, 129 kMarkAcknowledged,
130 remote_install); 130 remote_install);
131 } 131 }
132 132
133 bool PendingExtensionManager::AddFromExtensionImport( 133 bool PendingExtensionManager::AddFromExtensionImport(
134 const std::string& id, 134 const std::string& id,
135 const GURL& update_url, 135 const GURL& update_url,
136 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install) { 136 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install) {
137 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 137 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
138 138
139 if (ExtensionRegistry::Get(context_)->GetExtensionById( 139 if (ExtensionRegistry::Get(context_)->GetExtensionById(
140 id, ExtensionRegistry::EVERYTHING)) { 140 id, ExtensionRegistry::EVERYTHING)) {
141 LOG(ERROR) << "Trying to add pending extension " << id 141 LOG(ERROR) << "Trying to add pending extension " << id
142 << " which already exists"; 142 << " which already exists";
143 return false; 143 return false;
144 } 144 }
145 145
146 static const bool kIsFromSync = false; 146 static const bool kIsFromSync = false;
147 static const Manifest::Location kManifestLocation = Manifest::INTERNAL; 147 static const Manifest::Location kManifestLocation = Manifest::INTERNAL;
148 static const bool kMarkAcknowledged = false; 148 static const bool kMarkAcknowledged = false;
149 static const bool kRemoteInstall = false; 149 static const bool kRemoteInstall = false;
150 150
151 return AddExtensionImpl(id, 151 return AddExtensionImpl(id,
152 std::string(), 152 std::string(),
153 update_url, 153 update_url,
154 Version(), 154 base::Version(),
155 should_allow_install, 155 should_allow_install,
156 kIsFromSync, 156 kIsFromSync,
157 kManifestLocation, 157 kManifestLocation,
158 Extension::NO_FLAGS, 158 Extension::NO_FLAGS,
159 kMarkAcknowledged, 159 kMarkAcknowledged,
160 kRemoteInstall); 160 kRemoteInstall);
161 } 161 }
162 162
163 bool PendingExtensionManager::AddFromExternalUpdateUrl( 163 bool PendingExtensionManager::AddFromExternalUpdateUrl(
164 const std::string& id, 164 const std::string& id,
(...skipping 20 matching lines...) Expand all
185 if (extension) { 185 if (extension) {
186 LOG(DFATAL) << "Trying to add extension " << id 186 LOG(DFATAL) << "Trying to add extension " << id
187 << " by external update, but it is already installed."; 187 << " by external update, but it is already installed.";
188 return false; 188 return false;
189 } 189 }
190 } 190 }
191 191
192 return AddExtensionImpl(id, 192 return AddExtensionImpl(id,
193 install_parameter, 193 install_parameter,
194 update_url, 194 update_url,
195 Version(), 195 base::Version(),
196 &AlwaysInstall, 196 &AlwaysInstall,
197 kIsFromSync, 197 kIsFromSync,
198 location, 198 location,
199 creation_flags, 199 creation_flags,
200 mark_acknowledged, 200 mark_acknowledged,
201 kRemoteInstall); 201 kRemoteInstall);
202 } 202 }
203 203
204
205 bool PendingExtensionManager::AddFromExternalFile( 204 bool PendingExtensionManager::AddFromExternalFile(
206 const std::string& id, 205 const std::string& id,
207 Manifest::Location install_source, 206 Manifest::Location install_source,
208 const Version& version, 207 const base::Version& version,
209 int creation_flags, 208 int creation_flags,
210 bool mark_acknowledged) { 209 bool mark_acknowledged) {
211 // TODO(skerner): AddFromSync() checks to see if the extension is 210 // TODO(skerner): AddFromSync() checks to see if the extension is
212 // installed, but this method assumes that the caller already 211 // installed, but this method assumes that the caller already
213 // made sure it is not installed. Make all AddFrom*() methods 212 // made sure it is not installed. Make all AddFrom*() methods
214 // consistent. 213 // consistent.
215 const GURL& kUpdateUrl = GURL::EmptyGURL(); 214 const GURL& kUpdateUrl = GURL::EmptyGURL();
216 static const bool kIsFromSync = false; 215 static const bool kIsFromSync = false;
217 static const bool kRemoteInstall = false; 216 static const bool kRemoteInstall = false;
218 217
(...skipping 27 matching lines...) Expand all
246 } 245 }
247 246
248 out_ids_for_update_check->push_back(iter->id()); 247 out_ids_for_update_check->push_back(iter->id());
249 } 248 }
250 } 249 }
251 250
252 bool PendingExtensionManager::AddExtensionImpl( 251 bool PendingExtensionManager::AddExtensionImpl(
253 const std::string& id, 252 const std::string& id,
254 const std::string& install_parameter, 253 const std::string& install_parameter,
255 const GURL& update_url, 254 const GURL& update_url,
256 const Version& version, 255 const base::Version& version,
257 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install, 256 PendingExtensionInfo::ShouldAllowInstallPredicate should_allow_install,
258 bool is_from_sync, 257 bool is_from_sync,
259 Manifest::Location install_source, 258 Manifest::Location install_source,
260 int creation_flags, 259 int creation_flags,
261 bool mark_acknowledged, 260 bool mark_acknowledged,
262 bool remote_install) { 261 bool remote_install) {
263 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 262 CHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
264 263
265 PendingExtensionInfo info(id, 264 PendingExtensionInfo info(id,
266 install_parameter, 265 install_parameter,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 306
308 return true; 307 return true;
309 } 308 }
310 309
311 void PendingExtensionManager::AddForTesting( 310 void PendingExtensionManager::AddForTesting(
312 const PendingExtensionInfo& pending_extension_info) { 311 const PendingExtensionInfo& pending_extension_info) {
313 pending_extension_list_.push_back(pending_extension_info); 312 pending_extension_list_.push_back(pending_extension_info);
314 } 313 }
315 314
316 } // namespace extensions 315 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/extensions/pending_extension_info.cc ('k') | chrome/browser/extensions/unpacked_installer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698