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

Side by Side Diff: chrome/common/extensions/extension_constants.cc

Issue 10833057: Re-apply CL's to force store-hosted extension update checks to use SSL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension_constants.h ('k') | no next file » | 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) 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/common/extensions/extension_constants.h" 5 #include "chrome/common/extensions/extension_constants.h"
6 #include "chrome/common/extensions/extension_manifest_constants.h" 6 #include "chrome/common/extensions/extension_manifest_constants.h"
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 26 matching lines...) Expand all
37 url = chrome_common_net::AppendQueryParameter(url, "_wi", action); 37 url = chrome_common_net::AppendQueryParameter(url, "_wi", action);
38 url = chrome_common_net::AppendQueryParameter(url, "_mt", type); 38 url = chrome_common_net::AppendQueryParameter(url, "_mt", type);
39 39
40 return url; 40 return url;
41 } 41 }
42 42
43 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { 43 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) {
44 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); 44 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id);
45 } 45 }
46 46
47 const char kGalleryUpdateHttpUrl[] =
48 "http://clients2.google.com/service/update2/crx";
49 const char kGalleryUpdateHttpsUrl[] = 47 const char kGalleryUpdateHttpsUrl[] =
50 "https://clients2.google.com/service/update2/crx"; 48 "https://clients2.google.com/service/update2/crx";
51 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. 49 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS.
52 const char kExtensionBlocklistUrlPrefix[] = 50 const char kExtensionBlocklistUrlPrefix[] =
53 "http://www.gstatic.com/chrome/extensions/blacklist"; 51 "http://www.gstatic.com/chrome/extensions/blacklist";
54 const char kExtensionBlocklistHttpsUrlPrefix[] = 52 const char kExtensionBlocklistHttpsUrlPrefix[] =
55 "https://www.gstatic.com/chrome/extensions/blacklist"; 53 "https://www.gstatic.com/chrome/extensions/blacklist";
56 54
57 GURL GetWebstoreUpdateUrl(bool secure) { 55 GURL GetWebstoreUpdateUrl() {
58 CommandLine* cmdline = CommandLine::ForCurrentProcess(); 56 CommandLine* cmdline = CommandLine::ForCurrentProcess();
59 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) 57 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL))
60 return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL)); 58 return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL));
61 else 59 else
62 return GURL(secure ? kGalleryUpdateHttpsUrl : kGalleryUpdateHttpUrl); 60 return GURL(kGalleryUpdateHttpsUrl);
63 } 61 }
64 62
65 bool IsWebstoreUpdateUrl(const GURL& update_url) { 63 bool IsWebstoreUpdateUrl(const GURL& update_url) {
66 return update_url == GetWebstoreUpdateUrl(false) || 64 GURL store_url = GetWebstoreUpdateUrl();
67 update_url == GetWebstoreUpdateUrl(true); 65 if (update_url == store_url) {
66 return true;
67 } else {
68 return (update_url.host() == store_url.host() &&
69 update_url.path() == store_url.path());
70 }
68 } 71 }
69 72
70 bool IsBlacklistUpdateUrl(const GURL& url) { 73 bool IsBlacklistUpdateUrl(const GURL& url) {
71 // The extension blacklist URL is returned from the update service and 74 // The extension blacklist URL is returned from the update service and
72 // therefore not determined by Chromium. If the location of the blacklist file 75 // therefore not determined by Chromium. If the location of the blacklist file
73 // ever changes, we need to update this function. A DCHECK in the 76 // ever changes, we need to update this function. A DCHECK in the
74 // ExtensionUpdater ensures that we notice a change. This is the full URL 77 // ExtensionUpdater ensures that we notice a change. This is the full URL
75 // of a blacklist: 78 // of a blacklist:
76 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt 79 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt
77 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) || 80 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) ||
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 const char kAppStateDisabled[] = "disabled"; 138 const char kAppStateDisabled[] = "disabled";
136 const char kAppStateRunning[] = "running"; 139 const char kAppStateRunning[] = "running";
137 const char kAppStateCannotRun[] = "cannot_run"; 140 const char kAppStateCannotRun[] = "cannot_run";
138 const char kAppStateReadyToRun[] = "ready_to_run"; 141 const char kAppStateReadyToRun[] = "ready_to_run";
139 142
140 const char kAppNotificationsIncognitoError[] = 143 const char kAppNotificationsIncognitoError[] =
141 "This API is not accessible by 'split' mode " 144 "This API is not accessible by 'split' mode "
142 "extensions in incognito windows."; 145 "extensions in incognito windows.";
143 146
144 } // namespace extension_misc 147 } // namespace extension_misc
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension_constants.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698