| 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/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 25 matching lines...) Expand all Loading... |
| 36 url = chrome_common_net::AppendQueryParameter(url, "_wi", action); | 36 url = chrome_common_net::AppendQueryParameter(url, "_wi", action); |
| 37 url = chrome_common_net::AppendQueryParameter(url, "_mt", type); | 37 url = chrome_common_net::AppendQueryParameter(url, "_mt", type); |
| 38 | 38 |
| 39 return url; | 39 return url; |
| 40 } | 40 } |
| 41 | 41 |
| 42 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { | 42 GURL GetWebstoreItemJsonDataURL(const std::string& extension_id) { |
| 43 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); | 43 return GURL(GetWebstoreLaunchURL() + "/inlineinstall/detail/" + extension_id); |
| 44 } | 44 } |
| 45 | 45 |
| 46 const char kGalleryUpdateHttpUrl[] = |
| 47 "http://clients2.google.com/service/update2/crx"; |
| 46 const char kGalleryUpdateHttpsUrl[] = | 48 const char kGalleryUpdateHttpsUrl[] = |
| 47 "https://clients2.google.com/service/update2/crx"; | 49 "https://clients2.google.com/service/update2/crx"; |
| 48 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. | 50 // TODO(battre): Delete the HTTP URL once the blacklist is downloaded via HTTPS. |
| 49 const char kExtensionBlocklistUrlPrefix[] = | 51 const char kExtensionBlocklistUrlPrefix[] = |
| 50 "http://www.gstatic.com/chrome/extensions/blacklist"; | 52 "http://www.gstatic.com/chrome/extensions/blacklist"; |
| 51 const char kExtensionBlocklistHttpsUrlPrefix[] = | 53 const char kExtensionBlocklistHttpsUrlPrefix[] = |
| 52 "https://www.gstatic.com/chrome/extensions/blacklist"; | 54 "https://www.gstatic.com/chrome/extensions/blacklist"; |
| 53 | 55 |
| 54 GURL GetWebstoreUpdateUrl() { | 56 GURL GetWebstoreUpdateUrl(bool secure) { |
| 55 CommandLine* cmdline = CommandLine::ForCurrentProcess(); | 57 CommandLine* cmdline = CommandLine::ForCurrentProcess(); |
| 56 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) | 58 if (cmdline->HasSwitch(switches::kAppsGalleryUpdateURL)) |
| 57 return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL)); | 59 return GURL(cmdline->GetSwitchValueASCII(switches::kAppsGalleryUpdateURL)); |
| 58 else | 60 else |
| 59 return GURL(kGalleryUpdateHttpsUrl); | 61 return GURL(secure ? kGalleryUpdateHttpsUrl : kGalleryUpdateHttpUrl); |
| 60 } | 62 } |
| 61 | 63 |
| 62 bool IsWebstoreUpdateUrl(const GURL& update_url) { | 64 bool IsWebstoreUpdateUrl(const GURL& update_url) { |
| 63 GURL store_url = GetWebstoreUpdateUrl(); | 65 return update_url == GetWebstoreUpdateUrl(false) || |
| 64 if (update_url == store_url) { | 66 update_url == GetWebstoreUpdateUrl(true); |
| 65 return true; | |
| 66 } else { | |
| 67 return (update_url.host() == store_url.host() && | |
| 68 update_url.path() == store_url.path()); | |
| 69 } | |
| 70 } | 67 } |
| 71 | 68 |
| 72 bool IsBlacklistUpdateUrl(const GURL& url) { | 69 bool IsBlacklistUpdateUrl(const GURL& url) { |
| 73 // The extension blacklist URL is returned from the update service and | 70 // The extension blacklist URL is returned from the update service and |
| 74 // therefore not determined by Chromium. If the location of the blacklist file | 71 // therefore not determined by Chromium. If the location of the blacklist file |
| 75 // ever changes, we need to update this function. A DCHECK in the | 72 // ever changes, we need to update this function. A DCHECK in the |
| 76 // ExtensionUpdater ensures that we notice a change. This is the full URL | 73 // ExtensionUpdater ensures that we notice a change. This is the full URL |
| 77 // of a blacklist: | 74 // of a blacklist: |
| 78 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt | 75 // http://www.gstatic.com/chrome/extensions/blacklist/l_0_0_0_7.txt |
| 79 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) || | 76 return StartsWithASCII(url.spec(), kExtensionBlocklistUrlPrefix, true) || |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 const char kAppStateInstalled[] = "installed"; | 129 const char kAppStateInstalled[] = "installed"; |
| 133 const char kAppStateDisabled[] = "disabled"; | 130 const char kAppStateDisabled[] = "disabled"; |
| 134 const char kAppStateRunning[] = "running"; | 131 const char kAppStateRunning[] = "running"; |
| 135 const char kAppStateCannotRun[] = "cannot_run"; | 132 const char kAppStateCannotRun[] = "cannot_run"; |
| 136 const char kAppStateReadyToRun[] = "ready_to_run"; | 133 const char kAppStateReadyToRun[] = "ready_to_run"; |
| 137 | 134 |
| 138 const char kAppNotificationsIncognitoError[] = | 135 const char kAppNotificationsIncognitoError[] = |
| 139 "This API is not accessible by 'split' mode " | 136 "This API is not accessible by 'split' mode " |
| 140 "extensions in incognito windows."; | 137 "extensions in incognito windows."; |
| 141 } | 138 } |
| OLD | NEW |