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

Side by Side Diff: chrome/browser/sync/glue/extension_util.cc

Issue 2884025: Disallow syncing of extensions with third-party update URLs or plugins. (Closed)
Patch Set: Tightened check Created 10 years, 5 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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/sync/glue/extension_util.h" 5 #include "chrome/browser/sync/glue/extension_util.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
11 #include "base/version.h" 11 #include "base/version.h"
12 #include "chrome/browser/extensions/extensions_service.h" 12 #include "chrome/browser/extensions/extensions_service.h"
13 #include "chrome/browser/sync/protocol/extension_specifics.pb.h" 13 #include "chrome/browser/sync/protocol/extension_specifics.pb.h"
14 #include "chrome/common/extensions/extension.h" 14 #include "chrome/common/extensions/extension.h"
15 #include "chrome/common/extensions/extension_constants.h"
15 #include "googleurl/src/gurl.h" 16 #include "googleurl/src/gurl.h"
16 17
17 namespace browser_sync { 18 namespace browser_sync {
18 19
19 bool IsExtensionSyncable(const Extension& extension) { 20 bool IsExtensionSyncable(const Extension& extension) {
20 if (extension.is_theme()) { 21 if (extension.is_theme()) {
21 return false; 22 return false;
22 } 23 }
23 24
24 // TODO(akalin): Add Extensions::is_app(). 25 // TODO(akalin): Add Extensions::is_app().
25 if (!extension.GetFullLaunchURL().is_empty()) { 26 if (!extension.GetFullLaunchURL().is_empty()) {
26 // We have an app. 27 // We have an app.
27 return false; 28 return false;
28 } 29 }
29 30
30 // TODO(akalin): Figure out if we need to allow some other types. 31 // TODO(akalin): Figure out if we need to allow some other types.
31 if (extension.location() != Extension::INTERNAL) { 32 if (extension.location() != Extension::INTERNAL) {
32 // We have a non-standard location. 33 // We have a non-standard location.
33 return false; 34 return false;
34 } 35 }
35 36
37 // Disallow extensions with non-gallery auto-update URLs for now.
38 //
39 // TODO(akalin): Relax this restriction once we've put in UI to
40 // approve synced extensions.
41 if (!extension.update_url().is_empty() &&
42 (extension.update_url() !=
43 GURL(extension_urls::kGalleryUpdateHttpUrl)) &&
44 (extension.update_url() !=
45 GURL(extension_urls::kGalleryUpdateHttpsUrl))) {
46 return false;
47 }
48
49 // Disallow extensions with native code plugins.
50 //
51 // TODO(akalin): Relax this restriction once we've put in UI to
52 // approve synced extensions.
53 if (!extension.plugins().empty()) {
54 return false;
55 }
56
36 return true; 57 return true;
37 } 58 }
38 59
39 std::string ExtensionSpecificsToString( 60 std::string ExtensionSpecificsToString(
40 const sync_pb::ExtensionSpecifics& specifics) { 61 const sync_pb::ExtensionSpecifics& specifics) {
41 std::stringstream ss; 62 std::stringstream ss;
42 ss << "{ "; 63 ss << "{ ";
43 ss << "id: " << specifics.id() << ", "; 64 ss << "id: " << specifics.id() << ", ";
44 ss << "version: " << specifics.version() << ", "; 65 ss << "version: " << specifics.version() << ", ";
45 ss << "update_url: " << specifics.update_url() << ", "; 66 ss << "update_url: " << specifics.update_url() << ", ";
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 // |specifics| has a more recent or the same version, so merge it 242 // |specifics| has a more recent or the same version, so merge it
222 // in. 243 // in.
223 CopyNonUserProperties(specifics, merged_specifics); 244 CopyNonUserProperties(specifics, merged_specifics);
224 if (merge_user_properties) { 245 if (merge_user_properties) {
225 CopyUserProperties(specifics, merged_specifics); 246 CopyUserProperties(specifics, merged_specifics);
226 } 247 }
227 } 248 }
228 } 249 }
229 250
230 } // namespace browser_sync 251 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698